PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

GetFontHeight - DrawFontWrap question

Is it possible to find out the height and width of a text drawn by DrawFontWrap on a screen? If yes, wich font is used to calculate?
Hi Yucani,

The best way to calculate the height of a wrapped font is to first call PrepareFontWrap, then call GetFontHeight and GetFontWidth.

Call all functions on the surface containing the font image. Make sure BuildFont is called successfully before using PrepareFontWrap.
yucani · 21 Mar 2008, 09:17 UTC — i tried and this are my results:
after creating the font , i run following code:

char dst[89], src[89];
ulong w,h;
estrcpy(src,"alles wird gut, und noch viel besser");
font.PrepareFontWrap(dst, src, 100);
h=font.GetFontHeight(src);
w=font.GetFontWidth(src);

the results:
alles wird gut, und
noch viel besser
w=167
h=12

so the GetFontWidth ignores the wrap, but after counting the CR in the dest string one is able to find out the real hight.
Does i understand the procedure correct?
Hi Yucani,

I think you've made a small mistake, pass the destination (dst) string to GetFontWidth/GetFontHeight and all should work correctly.

I hope this helps :)