The font manager has been replaced by something which does the same thing, but it has been rebuilt largely from scratch.
It offers most of the same functionality, actually slightly more. The main change is that it is now a display object in its own right rather than pretending to be one. So you can use it much as if it was a display.newText() object.
The one downer is that if you turn animation on, and you rely on the system to remove it, (e.g. garbage collection in Composer) it will keep the reference to the bitmap string - it needs it to generate the animations.
So in your exit events, turn animations off on any bitmap strings you use (or remove them). If it's not animated, there's no reference.
https://github.com/autismuk/Font-Manager
List of changes
a) setScale() no longer functions. Adjust font size to suit, or scale overall.
b) there is no FontManager object, really, though setEncoding(),setTintBrackets() and setAnimationRate() still work as there is a 'pretend' FontManager. These are now all methods of BitmapString, though all affect the global state of the fonts, so setAnimationRate() sets the rate for all the bitmap strings, not just one.
c) curve and scale have been switched so they are the right way round. Previously they were 'visual' opposites.
d) FontManager:Clear() does not exist. The primary reason for this is that it maintained a reference to the object. If there is sufficient demand I will add a tracking of creation on demand approach which will do the same thing.
e) You cannot directly subclass BitMapString, because it is now a mixin.
Your new method for a subclass should look something like
local function SubclassBitmapString:new(font,fontSize)
local newInstance = BitmapString:new(font,fontSize)
.. do class specific initialisation.
.. create mixin - you can do this with a for loop as well.
newInstance.someFunction = SubclassBitmapString.someFunction
return newInstance
end
f) Curve is now a static class in its own right rather than being a method of FontManager.
No comments:
Post a Comment