freetype
[Top][All Lists]
Advanced

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

Re: [ft] how to put the character into a rect instead of the baseline co


From: Werner LEMBERG
Subject: Re: [ft] how to put the character into a rect instead of the baseline corrdinate?
Date: Thu, 15 Mar 2012 22:44:37 +0100 (CET)

[Please *never* post BMP images to this list!  Use PNG or JPG
 instead.]

> 1. how to put the text in between my_rect.top and my_rect.bottom,
>    meanwhile all the letters are aligned?  I find that
>    face->glyph->bitmap_top is in baseline corrdinate.  If I use
>    my_rect.top + 24 - face->glyph->bitmap_top as the bitmap base y
>    point, all the letters are aligned, but the 'g' letter will out
>    of my_rect.

This problem...

> 2. what is the difference between the value of FT_Set_Pixel_Sizes
>    setted and face->glyph->bitmap.width and rows ?  I know
>    face->glyph->bitmap could no be larger than FT_Set_Pixel_Sizes
>    setted value; But is there any letter that face->glyph->bitmap
>    size is equal with the setted size?

and this one are related.  The very problem is that for outline fonts
the the value set with FT_Set_Pixel_Sizes is *not* related to the
actual dimensions of the rendered glyphs.  If you set this to 24px,
you really set the EM size to 24px, but there is no guarantee that
glyphs are really smaller than this value.

To render a text string into a given rectangle, you have to compute
the bounding boxes of all glyphs (e.g. using FT_Glyph_Get_CBox) to
check whether everything fits into the rectangle.  If necessary, you
have to select a different size to get improved results.


    Werner



reply via email to

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