Game Development Reference
In-Depth Information
The process, this method follows is quite simple—if there is already a font with that file-
name, return it, else, create a new entry in the map and load it from the file. The supported
font file formats are: TrueType (TTF), Type 1, CFF, OpenType, SFNT, X11 PCF, Win-
dows FNT, BDF, PFR, and Type 42. The most commonly used formats are TrueType
(TTF) and OpenType (OTF). The OpenType format is built similar to the TrueType
format, but it has a few more benefits, including a larger character set. It is important to
note that we need to have the font in the working directory of the project, or we need to
specify the complete path as the filename. SFML cannot load system fonts directly, so we
need to use font files—simply calling font.loadFromFile("Arial") does not
work, as the function expects a file and not a system font.
Once we get the AssetManager functionality to load fonts, using it is as simple as ever:
Remember, when we are using AssetManager , we first need to instantiate it.
Search WWH ::

Custom Search