Use off TextMetrics?

To support elecotromeiers DX9Text project, I decided to try and make a tool like BitmapfontBuilder with VVVV, that can save a .png file with alpha, in stead off a 15MB .tga file you need to use photoshop for.

Things are going okay, I fugured, using TextMetrics to figure out the max caracter with in pixels, so I can calculate the font a font size that is as big as possible.

Okay, text metrics isn’t spreadable, that is to bad (and hard, I know for sure) but the weird thing is that the Max Charwidth Pin makes no sense to me.

I want to end up with a 512x512 pixels GDI renderer with 16x16 letters in them (making it the first 256 letters in ASCII).

So the max width should not be bigger than 512:16=32 pixels.
So I fugure out what font size has a max width off 32 pixels.

But most fonts can be bigger than that!! I am a bit puzzled on where the max width pin of the TextMetrics comes from.

attached an Example patch off my work.

TextMetricsTest.v4p (23.6 kB)

I am a bit puzzled on where the max width pin of the TextMetrics comes from.

The TextMetrics Node basically provides information on spacing for a chosen font. The Max Charwidth pin tells you the width of the widest character of the chosen font (depending on the specified font-size). If you had for instance a font which only contains the characters “i” and “w” the node would output the width of “w”.

For your purposes GlyphInfo(String) seems to be the better choice.


Hmmzz… yes, I think you are right :)
GlyphInfo + Bounds for the first 256 letters gives me a lower max, and in 2048*2048 it seems to work!!

I already use GlypInfo for the textfile… now up to the next challenge… getting a IOBox (enumeration) into a IOBox (string), hope it works with Xpatch.

edit: can’t figure out the best way to automaticly get the maximal size off the font, Arial and Roman are soo different!!

Either do the sizing manualy… or play it realy save… :(