A font rasterization and shaping library for libGDX using HarfBuzz.
- Font rasterization
- GPU glyph rendering (Slug)
- Complex script shaping
Create a Typeface
Typeface face = new Typeface(myFontFile);Create an atlas
GlyphAtlas atlas = new GlyphAtlas();Create a Font from the Typeface and set options
Font boldFont = new Font(face, atlas);
boldFont.weight(800); // Sets the OpenType MM weight
// if doesn't have weight/variations
boldFont.setSyntheticBold(.01f);Draw:
@Override
public void render() {
batch.begin();
batch.setColor(Color.WHITE);
boldFont.drawText(batch, "Hello, World!", 48, x, y);
batch.end();
}After use:
font.dispose();
atlas.dispose();
face.dispose();