Strings and Fonts
When you load the GD module the five built-in fonts are imported
into your script’s namespace as the global variables gdGiantFont, gdLargeFont, gdMediumBoldFont, gdSmallFont, and gdTinyFont (see Figure 2-7). They are all
fixed-width fonts with 256 characters in their character sets. The
dimensions of each can be determined with the width( ) and height( ) object methods, or by consulting
Table 2-1.
Font name | Width (pixels) | Height (pixels) |
gdTinyFont | 5 | 8 |
gdSmallFont | 6 | 12 |
gdMediumBoldFont | 7 | 12 |
gdLargeFont | 8 | 16 |
gdGiantFont | 9 | 15 |

To draw a string with the bitmapped fonts, use the char( ), charUp(
), string( ), or stringUp( ) methods. To use a TrueType font,
use the stringFT( )
method.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access