Hello Allen, Am 24.06.2007 um 02:59 schrieb Allen Bierbaum:
> I have been trying to create a new foreground that renders text and I > have run into a question while looking at the SimpleStatForeground > implementation... > > Does anyone know what the scale factory in TextTXFFace is for or what > physical parameter it represents? I see the comment that says "The > scale factor used to scale font metrics", but I just don't understand > what this means or what it corresponds to physically. How does this > figure into the size of the text when it is rendered to geometry or to > the screen? The TextTXFFace::_scale factor is used to scale the size (actually the height) of the characters from pixel units to 1 world unit. When you create a TextTXFFace, you specify the size (height) of the characters in pixels via the size member variable of the TextTXFParam object you provide as an argument to the create() factory method. In practice, you won't get exactly the size you specified - which size you actually get depends on the font designer. When you create the text geometry via TextTXFFace::fillGeo, you have to specify a scale factor. This factor controls the height of the text geometry in world units. Usually, you want to render text so that one pixel of the text texture corresponds to one pixel on the screen. To do this, you have to specify 1 / TextTXFFace::_scale as the scale parameter for fillGeo. I.e. you have to write something like this: face->fillGeo(..., 1 / face->getScale()); That is the only reason why this mysterious scale factor exists in the TextTXFFace class. The whole implementation of TextTXFFace is a little bit questionable. When I implemented the class, I thought it would be a good idea to scale the text geometry to 1 world unit. But recently I changed my mind, and I plan to change/improve the interface. Unfortunately, I currently do not have time to do that. Hope this helps, Patrick ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Opensg-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users
