Represents a font that can be used to render a sprites::Text_sprite.
To create a font, you must specify the TrueType font file (.ttf
) to load, and that file must be in the Resources/
directory of your project. You can create multiple Font instances for the same font file at different sizes.
One TTF file, sans.ttf
, is included among ge211's built-in resources, and can always be used even if you haven't added any fonts yourself.
Note that Fonts cannot be constructed until the text subsystem is initialized. The text subsystem is initialized with the rest of ge211 when the Abstract_game underlying your game struct or class is constructed. Thus, you cannot create namespace level (or global) Fonts. The usual place to define Fonts is as member variables in your game struct, since member variables of a derived class are initialized after the base class is initialized.
Definition at line 69 of file ge211_resource.hxx.
Public Member Functions | |
Font (const std::string &filename, int size) | |
Loads a font from the specified TrueType font file, at the specified size. | |