freetype
[Top][All Lists]
Advanced

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

Re: [ft] How to generate a glyph bitmap of a specific pixel size using F


From: Werner LEMBERG
Subject: Re: [ft] How to generate a glyph bitmap of a specific pixel size using FT_Set_Pixel_Sizes
Date: Mon, 09 Jun 2014 08:05:42 +0200 (CEST)

> I called
>
>   FT_Set_Pixel_Sizes(face, 40, 20);
>
> hoping to get a glyph of 20x40 dimension in pixels, but when I used
> `face->glyph->bitmap' to access the bitmap, its dimension is 26*14.

The documentation of FT_Set_Pixel_Sizes says

  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.

and FT_Request_Size says

  The relation between the requested size and the resulting glyph size
  is dependent entirely on how the size is defined in the source face.
  The font designer chooses the final size of each glyph relative to
  this size.  For more information refer to
  `http://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'

Assuming an arbitrary outline font there is only the trial and error
method to get a glyph bitmap with an exact bbox of 20x40 pixels,
playing around with `pixel_width' and `pixel_height' parameters of
`FT_Set_Pixel_Sizes'.


    Werner



reply via email to

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