MyGUI font file overview


07-09-2008 04:37:39

I'm trying to learn about the various config files used by MyGUI, and the one I'm not really clear on is the *.font files. I haven't really been able to find any sort of docs or explanations of the Font element in these files, and my knowledge on TrueType fonts is a bit a limited, so I'm not really able to deduce the meaning of many of the attributes on my own. I was hoping someone who is knowledgeable would be able to give me a quick run down of what all the various attributes mean. Here's one from core.font as an example:

<Font name="MyGUI_CoreFont.18" default_height="18" source="Comic.TTF" size="18" resolution="50"
antialias_colour="false" space_width="4" tab_width="8" cursor_width="2" distance="5" offset_height="1">
<Code range="33 126"/>
<Code range="1025 1105"/>
<Code range="8470 8470" help="�"/>
<Code hide="128"/>
<Code hide="1026 1039"/>
<Code hide="1104"/>

The name and source attributes are pretty self explanatory -- I'm guessing the former is what you actually use to refer to that font inside the GUI engine. antialias_color is also pretty easy to guess.

default_height I take it is simply the font size in points?

resolution I'm willing to guess is some sort of dots per inch (DPI) setting? I really have no clue otherwise though.

space_width, tab_width, and cursor_width while are descriptive, I'd like to know what units they're in. tab_width I'm guessing in terms of spaces, but what about space_width and cursor_width? Are these pixel values or what?

distance and offset_height I have no real clue as to what these are.

When we get to the Code element, I'm not sure what its attributes actually specify. I assume for each range/hide attribute, you can specify some range. where the first number is the lower bound and the second is the upper bound. As far as I know, characters that can be represented by a TTF have some integer code associated with them, but given a TTF is it possible to figure out what codes map to what characters easily? And if so how? Is it just basically its ASCII/Unicode code? Also, what is meant by the hide attribute? Exactly what is it hiding those characters from? Does it simply mean "don't render these characters"? And what is the help attribute for? I have no clue on that one.

Thanks for your help, and thanks for your work on MyGUI. It's definitely been a lot easier to work with than CEGUI, and overall I find it covers pretty much all my needs so far. Mad props.