Game Development Reference
In-Depth Information
Figure 7.3
The UV information of a single character.
Font Data
The font data is a simple text file that is used to identify all the characters in the
texture. It is supplied on the CD and should be added to the font project in the
same way the texture was added. Remember to set its properties to ensure it's
copied to the build directory. Here are the first few lines of the data file.
info face="Courier New" size=-32 bold=1 italic=0 charset="" unicode=1
stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 outline=0
common lineHeight=36 base=26 scaleW=256 scaleH=256 pages=1 packed=0
alphaChnl=0 redChnl=0 greenChnl=0 blueChnl=0
page id=0 file="font_0.tga"
chars count=95
char id=32 x=253 y=21 width=1
height=1
xoffset=0
yoffset=26
xadvance=19 page=0 chnl=15
char id=33 x=247 y=21 width=5
height=20 xoffset=7
yoffset=6
xadvance=19 page=0 chnl=15
char id=34 x=136 y=101 width=9
height=9
xoffset=4
The first three lines are header information and can be ignored. They contain
information describing the font—that its size is 32 and its type is Courier New.
This is all information our font system doesn't need to know.
The fourth line is how many characters are contained in the font file; in this case
there are 95 characters. After this line you see information about every character,
its pixel position in the texture, and its pixel width and height.
xoffset and yoffset are used to align the characters when rendered one
after another in a word. The ''y'' character has a larger yoffset than an ''l''
 
 
 
Search WWH ::




Custom Search