freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding out the appropriate texture size for a font


From: Werner LEMBERG
Subject: Re: Finding out the appropriate texture size for a font
Date: Sat, 27 Jul 2024 07:47:48 +0000 (UTC)

>> If you can loosen this restriction you might use the font's global
>> bounding box (`FT_Face::bbox`) plus some pixels added for both the
>> x and y directions (to accommodate for hinting).
> 
> This would be good enough for me. I tried it out and found that the
> value of bbox is always *{xMin: -1735, yMin: -400, xMax: 695, yMax:
> 1120}* regardless of what value I give to *FT_Set_Pixel_Sizes* for
> the ttf file I'm using. But increasing the pixel size does increase
> the output bitmap size.

Well, yes.  As documented, the bbox is given in font units, which you
have to convert to pixels (don't forget to round away from zero if you
need integers).

> This is from the `FT_Set_Pixel_Sizes` api documentation:
> 
>   You should not rely on the resulting glyphs matching or being
>   constrained to this pixel size.  Refer to FT_Request_Size to
>   understand how requested sizes relate to actual sizes.

OK, this is an English language problem.  'Refer to' and 'need to use'
are completely different things.  The documentation simply says that
you should look up `FT_Request_Size` for more details.


    Werner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]