home | |||
links |
|
||
developer's mag main page article part 1 part 2 part 3 part 4 part 5 |
3 - A Group of FontsFonts can also be arranged in groups, in a structure called (surprisingly enough) FONTGROUP. This structure is worth looking at in more detail:
A font package contains an array of these FONTGROUP structures, each indicating a specific font. The fields above are quite straightforward: size is the pixel height of the font, while style is a description, and can be any of the following: CTRL_NORMAL, CTRL_BOLD, CTRL_ITALIC, CTRL_SUPERSCRIPT, CTRL_SUBSCRIPT, CTRL_BOLDITALIC, and CTRL_SMALL. These values can be used to help in font searching (for example to ignore superscript and subscript fonts). The font value may at first appear to be a miscast pointer, but is actually an offset value from the start of the FONTGROUP structure being referred to. Using it, we can arrive at the FONT pointer to the specific font, after a rather nasty cast (the value is in bytes, so we need to cast to char first). Here, fontGroupPointer points to our first FONTGROUP structure, and fontIndex to the entry within it: FONT *font=(FONT*)(((char)(fontGroupPointer))+fontGroupPointer[fontIndex].font);
Previous Section Next Section |
||
Copyright © 2001-2006 ebmDevMag.com - Legal Notice |