Page 1 of 1
Font character width?
Posted: 27.03.2005, 17:51
by maxim
Is there any tool for examining txf-files?
OR
Can anybody tell the width of default (and other?) cel font characters in pixel?
maxim
Posted: 27.03.2005, 18:14
by Christophe
The tools available on Mark Kilgard's
site don't work with Celestia's txf files. But I'm working on getting a working version to add a preview to the font generator.
Posted: 28.03.2005, 13:57
by Christophe
A txf file preview is now available
here.
Posted: 29.03.2005, 00:48
by dirkpitt
Christophe wrote:A txf file preview is now available
here.
Cool, seems to work for small TXF's. Jumbo (2k+) TXF's containing lots of CJK characters
seem to break it. I suppose though that this is just further proof that Celestia itself
needs a more scalable font system that can handle 2k+ CJK fonts. Something that
doesn't require loading one giant font texture at once. I've been thinking along the lines of
Celestia storing the texture as little strips, might be a little slower to render but should
be much more scalable.
Posted: 29.03.2005, 08:18
by Christophe
Well, I wasn't particularly cautious with the memory handling, so that may explain why the preview doesn't work with large textures.
The solution to rendering CJK fonts might be to use a different library like
FTGL which can render TTF fonts directly. But I don't know how it performs with fonts with a large number of glyphs.
Posted: 29.03.2005, 16:45
by patesi
Merci Christophe, pour cet outil g?©nial!
Enfin un program qui permet la conversion des txf sous windows.
(il y a quelques semaines il fallait encore installer un Linux, apprendre a manipuler ttf2txf etc. -une bonne journ?©e-, maintenant voici en 10 secondes le txf qui me faut, pas mal!)
Zolt??n
Posted: 30.03.2005, 08:12
by maxim
Thanks Christophe - I'll give it a try.
No one who knows the dimensions of the characters? I mean - they have to be cut out to display them on the screen. There must be an information about the sizes anywhere for that.
maxim
Posted: 30.03.2005, 09:21
by Christophe
Yes, the font geometry information is stored in the txf along the texture.
Have a look at the
src/celtxf/texturefont.cpp source file. TextureFont::load should make it clear how to retreive that information.
Posted: 30.03.2005, 16:10
by maxim
Ok, I see.
So no ready-to-use default charsize table for use in a lua-textprocessing-function - beside writing my own tool to retrieve one?
maxim
Posted: 30.03.2005, 19:30
by Christophe
Well, making TextureFont::getWidth available to Lua scripts doesn't seem all that difficult if that's all you need.
Posted: 30.03.2005, 19:35
by maxim
In fact that would be the optimal solution.
maxim
Posted: 30.03.2005, 20:45
by Christophe
OK, I'll see what I can do. Do you compile your own version from cvs or do you use the pre-release?
Posted: 31.03.2005, 07:27
by maxim
Both. Depends if I am testing, or creating mainstream stuff.
maxim
Posted: 04.04.2005, 20:49
by Christophe
I've added a celestia:gettextwidth(string) method.
It returns the width of the string in pixels, you need to divide that by celestia:gettextwidth("M") to get the em units used by celestia:print.