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: Z C
Subject: Re: [ft] How to generate a glyph bitmap of a specific pixel size using FT_Set_Pixel_Sizes
Date: Mon, 9 Jun 2014 19:57:20 +0800

Thx for your reply.

I'm not very clear on what the parameters of `FT_Request_Size' represent and what this function does.
This function appears to be some kind of maximum size for the glyph.
Actually, I am just wondering what I should do if I want to generate a glyph of exactly a specific bounding size.
Does this function meet my need?
If not, what function should I call to convert the size of what I need, to the size of what I should pass to `FT_Set_Pixel_Sizes'

Thanks!


On Mon, Jun 9, 2014 at 2:05 PM, Werner LEMBERG <address@hidden> wrote:

> 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]