AtlasGL (object)¶
バージョン 2.4.0 で追加.
AtlasGL extends FreeTypeAtlas to draw 2D text with FabricOGL. It’s in charge of generating and binding an OpenGL Texture from the atlas. It also provides high level methods to set the atlas properties (font and glyphs).
The size of the atlas (and of the OpenGL texture) can be big if a lot of glyphs are used. For performances and memory reasons, the same atlas should be shared between several TextGL objects. For this purpose, the atlas are registered as a singleton. The name of the singleton is created from the font path and size.
Members¶
String | fontPath | Path of the used font. |
String | glyphs | List of glyphs character. |
/*
** Example: AtlasGL
*/
require Text;
operator entry() {
Float32 fontSize = 20;
FilePath fontPath = FilePath('${FABRIC_DIR}/Resources/Fonts/Roboto/Roboto-Regular.ttf');
Ref<AtlasGL> atlas = GetOrCreateAtlasGL(fontPath, fontSize);
Ref<AtlasGL> atlas2 = GetAtlasGL(fontPath, fontSize);
}
/*
** Output:
*/
Methods¶
AtlasGL ( in AtlasGL other ) | |
AtlasGL ( in FilePath fontPath, in UInt32 fontSize ) | |
AtlasGL () | |
AtlasGL | clone ? () |
Boolean | equal ! ( in Ref<AtlasGL> atlas ) |
setFontPath ! ( in FilePath fontPath ) | |
setFontSize ! ( in Float32 fontSize ) | |
setGlyphs ! ( in String glyphs ) |
Methods in detail¶
copy constructor
AtlasGL ( in FilePath fontPath, in UInt32 fontSize )
Constructs an AtlasGL.
fontPath | Font path |
fontSize | Font size |
AtlasGL ()
default constructor
clone method
Boolean AtlasGL.equal! ( in Ref<AtlasGL> atlas )
Checks this atlas is equal to the oether.
AtlasGL.setFontPath! ( in FilePath fontPath )
Sets the font to use.
fontPath | Font path |
AtlasGL.setFontSize! ( in Float32 fontSize )
Sets the font size.
fontSize | Font size |
AtlasGL.setGlyphs! ( in String glyphs )
Updates the glyps list.
glyphs | List of glyph to use (e.g 123abcABC?) |