FreeTypeAtlas (object)¶
バージョン 2.4.0 で追加.
FreeTypeGL extension wraps the C++ freeType-gl library in KL to draw in OpenGL 2D primitives such as text or lines. https://github.com/rougier/freetype-gl
Because the FreeTypeGL extension can be used with any OpenGL version/implementation, it doesn’t expose freeType-gl high level api.
Indeed, freeType-gl relies on OpenGL 1.2, and the managment of the OpenGL buffers (insertion/push) is limited.
Instead, the FreeTypeGL extension exposes the low level methods, and OpenGL calls (such as buffer binding) are left to specialized classes.
See BaseTextGL, BaseAtlasGL
for a complete examples.
Methods¶
Methods in detail¶
FreeTypeAtlas ( in FreeTypeAtlas other )
copy constructor
default constructor
FreeTypeAtlas.clear! ()
Clears the content of the atlas.
FreeTypeAtlas FreeTypeAtlas.clone? ()
clone method
FreeTypeAtlas.createAtlas! ( in UInt32 width, in UInt32 height )
Creates the atlas.
width | Atlas width. |
height | Atlas height. |
FreeTypeAtlas.createFont! ( in Float32 size, in String path )
Creates a new font.
size | Font size. |
path | Atlas height. |
FreeTypeAtlas.createGlyphs! ( in String glyphs )
Creates the glyphs (list of characters that composed the text we want to display).
characters | The list of characters (e.g 1234abdcABCD(),. ) |
Boolean FreeTypeAtlas.fontIsValid? ()
Checks if a font is valid (been set).
FreeTypeAtlas.getData? ( io Data data )
Gets the atlas content, used to generate the OpenGL texture.
data | Atlas content as a raw pointer. |
FreeTypeAtlas.getDimensions? ( io UInt32 width, io UInt32 height )
Gets the atlas dimensions.
width | Atlas width. |
height | Atlas height. |
String FreeTypeAtlas.getFontPath? ()
Gets path of the font used.
Float32 FreeTypeAtlas.getFontSize? ()
Gets the font size.
Float32 FreeTypeAtlas.getGlyphAdvance? ( in String glyph )
Gets the glyph advances.
glyph | Current glyph |
Boolean FreeTypeAtlas.getGlyphAttributes? ( in String current, in String previous, io Float32 kerning, io Float32 advance, io Float32 ox, io Float32 oy, io Float32 width, io Float32 height, io Float32 s0, io Float32 s1, io Float32 t0, io Float32 t1 )
Gets the glyph attributes.
current | Current glyph |
previous | Previous glyph |
kerning | Glyph kerning |
advance | Glyph advance |
ox | Horizontal offset |
oy | Vertical offset |
width | Glyph width |
height | Glyph height |
s0 | Texture index |
s1 | Texture index |
t0 | Texture index |
t1 | Texture index |
FreeTypeAtlas.getGlyphDimension? ( in String glyph, io Float32 oX, io Float32 oY, io Float32 width, io Float32 height )
Gets the glyph dimensions.
ox | Horizontal offset |
oy | Vertical offset |
width | Glyph width |
height | Glyph height |
Float32 FreeTypeAtlas.getGlyphKerning? ( in String current, in String previous )
Gets the glyph kerning.
current | Current glyph |
previous | Previous glyph |
FreeTypeAtlas.getGlyphTextureIndices? ( in String glyph, io Float32 s0, io Float32 s1, io Float32 t0, io Float32 t1 )
Gets the glyph texture indices.
s0 | Texture index |
s1 | Texture index |
t0 | Texture index |
t1 | Texture index |
String FreeTypeAtlas.getGlyphs? ()
Gets the glyps as String.
UInt32 FreeTypeAtlas.getTextureID? ()
Gets the OpenGL texture ID.
FreeTypeAtlas.init! ()
Initializes a FreeTypeAtlas (image storing the characters to draw).
Boolean FreeTypeAtlas.isValid? ()
Checks if the altas is valid.
FreeTypeAtlas.setTextureID! ( in UInt32 id )
Sets the OpenGL texture ID.
~ FreeTypeAtlas ()
Destructor, automatically called.