[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Finding out the appropriate texture size for a font
From: |
Sagar Tiwari |
Subject: |
Re: Finding out the appropriate texture size for a font |
Date: |
Sat, 27 Jul 2024 13:27:23 +0530 |
> which you
have to convert to pixels
Can you explain how to do that? Since the bounding box is fixed, I presume
it will somehow involve the pixel size I'm passing to to
FT_Set_Pixel_Sizes. I've gone through the documentation and am still a
little confused. I'm pretty new to text rendering. Are there any other
resources you recommend I should go through as prerequisites? Thanks.
On Sat, 27 Jul, 2024, 13:17 Werner LEMBERG, <wl@gnu.org> wrote:
> >> 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
>