Game Development Reference
In-Depth Information
had to download all of those images, and worst of all, the resulting text could not be
selected, copied, resized, and the color could not be changed.
Now we can simply specify the name of a font, along with the actual font file, which
the browser can download if the user's operating system doesn't have that font in-
stalled and use just as any other font.
In the game, we use three different custom fonts to create just the right visual effect
and make the texts in the game match the desired visual theme. The three fonts
used are open source fonts, which can be downloaded from the internet and used for
free. The fonts used were Lemon, Mystery Quest, and Fredericka the Great. Amaz-
ing names, don't you agree?
Prior to looking for some fonts for the game, I had no idea that these fonts existed.
Best of all, it only took me a couple of minutes to go through a large collection of
open source fonts (from Google's Web Fonts tool) and find just what I wanted.
Since a font file is an external asset just like anything else that is downloaded from
the server, there is a period of time between the time the browser starts downloading
a font file and the time when the page is ready to be rendered. Different browsers
handle this situation differently. For example, webkit hides the text until the font asset