Fonts
A Font is a collection of images that can be used to represent text on a screen.
There are various font classes that you can use.
The Default Font (provided by CL_Font ) uses CL_Font_System
The Freetype Font (provided by
The system font (provided by CL_Font_System ) uses the operating system font, stored in a texture group ( CL_TextureGroup ).
The vector font (provided by
The sprite font (provided by CL_Font_Sprite ) uses a font stored as a CL_Sprite.
Constructing fonts
CL_FontDescription desc;
font_desc.set_typeface_name("myfont.ttf");
CL_Font_Freetype freetype_font(gc, font_desc);
freetype_font.draw_text(gc, 100, 100, "Hello World");
CL_FontDescription desc;
font_desc.set_typeface_name("tahoma");
CL_Font_System system_font(gc, font_desc);
system_font.draw_text(gc, 100, 100, "Hello World");
CL_FontDescription desc;
font_desc.set_typeface_name("myfont.ttf");
CL_Font_Vector vector_font(font_desc);
vector_font.draw_text(gc, 100, 100, "Hello World");
CL_Font_Sprite sprite_font(gc, "ClanFont", &app_resources); sprite_font.draw_text(gc, 100, 100, "Hello World"); (See Examples/Font/resources.xml)
ClanGUI and Fonts
If you want ClanGUI to use a custom font, instead of a native font, you will first need to register the font as follows
CL_Font_Sprite sprite_font(gc, "ClanFont", &app_resources);
CL_FontDescription font_desc;
font_desc.set_typeface_name("GUI Font Name");
font_desc.set_height(32);
font_desc.set_weight(400);
gui->register_font(sprite_font, font_desc);
