AtlasGL.kl

Types

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.

参考

FreeTypeAtlas

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 )

Functions

GetAtlasGL

Ref<AtlasGL> GetAtlasGL ( in FilePath fontPath, in UInt32 fontSize )

Gets an GetOrCreateAtlasGL singleton (if it exists already).

name The singleton name.

GetOrCreateAtlasGL

Ref<AtlasGL> GetOrCreateAtlasGL ( in FilePath fontPath, in UInt32 fontSize )

Gets or creates an AtlasGL singleton.

fontPath Font path, use default Roboto font if path is not valid
fontSize Font size