freetype
[Top][All Lists]
Advanced

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

Re: [ft] FT_Set_Char_Size vs. FT_Set_Pixel_Sizes


From: Werner LEMBERG
Subject: Re: [ft] FT_Set_Char_Size vs. FT_Set_Pixel_Sizes
Date: Thu, 17 Nov 2016 19:25:11 +0100 (CET)

> I have used FT_Set_Pixel_Sizes( face , 32 , 32 ) -- because 32 by 32
> is the maximum font dimension of a font in my application. Upon
> inspection of the resulting face->glyph I get a bitmap that's only
> about 25% of the size specified in FT_Set_Pixel_Sizes (Bitmap
> details: rows = top = 22, width = 13, left = 1).  Of course I may
> have completely misunderstood what FT_Set_Pixel_Sizes does.  Please
> do correct me where my thinking or understanding is incorrect.

Your thinking *is* incorrect :-) FT_Set_Pixel_Sizes sets the *nominal*
size for the whole font, this is, the size the font designer thinks
the font looks best for a given pixel size.  In many cases, the
largest glyphs in the font (e.g., `|', `(', or `)') have this height,
but usually the actual glyph heights are lower.

You might try the `FT_Request_Size' function using
`FT_SIZE_REQUEST_TYPE_REAL_DIM' or `FT_SIZE_REQUEST_TYPE_BBOX' to
better approximate your desired height.  Note, however, that with
activated hinting the only possibility to exactly make a glyph fit
into a given height is trial and error: You start with an
approximation value, then look at the delta relative to the wanted
height, then decrease or increase the size as needed and try again.
If you are unfortunate, the glyph height jumps by two pixels, not
fitting your desired height at all...

> Also, how is are the bitmap properties (rows, top and width)
> determined?  Are they partly based on some meta data the TTF font
> file or are they _solely_ based on the user specified size?

What do mean with `determined'?  Normally you load and render a glyph,
and FreeType returns the metrics and bitmap size of the rendered
glyph.


    Werner



reply via email to

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