Moai SDK
2.0
|
Function List | |
setColorFormat | |
setPadding | |
This is the default implementation of a dynamic glyph cache. Right now it can only grow but support for reference counting glyphs and garbage collection will be added later.
The current implementation is set up in anticipation of garbage collection. If you use MOAIFont's getImage () to inspect the work of this cache you'll see that it is not as efficient in terms of texture use as it could be - glyphs are grouped by size, all glyphs for a given face size are given the same height and layout is orientated around rows. All of this will make it much easier to replace individual glyph slots as the set of glyphs that needs to be in memory changes. That said, we may offer an alternative dynamic cache implementation that attempts a more compact use of texture space, the tradeoff being that there won't be any garbage collection.
This implementation of the dynamic glyph cache does not implement setImage ().
Of course, you can also derive your own implementation from MOAIGlyphCache.
|
The color format may be used by dynamic cache implementations when allocating new textures.
function setColorFormat ( MOAIDynamicGlyphCache self, number colorFmt )
MOAIDynamicGlyphCache | self |
number | colorFmt One of MOAIImage.COLOR_FMT_A_8, MOAIImage.COLOR_FMT_RGB_888, MOAIImage.COLOR_FMT_RGB_565, MOAIImage.COLOR_FMT_RGBA_5551, MOAIImage.COLOR_FMT_RGBA_4444, COLOR_FMT_RGBA_8888 |
|
Add padding to glyphs when ripping from font.
function setPadding ( MOAIDynamicGlyphCache self, number hPad, number vPad )
MOAIDynamicGlyphCache | self |
number | hPad glyph xMin -= hPad * 0.5, glyph xMax += hPad * 0.5 |
number | vPad glyph yMin -= vPad * 0.5, glyph yMax += vPad * 0.5 |
function setPadding ( MOAIDynamicGlyphCache self, xMinP glyph, yMinP glyph, xMaxP glyph, yMaxP glyph )
MOAIDynamicGlyphCache | self |
xMinP | glyph xMin -= xMinP |
yMinP | glyph yMin -= yMinP |
xMaxP | glyph xMax += xMaxP |
yMaxP | glyph yMax += yMaxP |