Search code examples
c++fontsfreetypefreetype2

Freetype2 returns bigger size value than expected


I want to get specific size of char bitmap, so use FT_Set_Pixel_Sizes() like below.

 error = FT_Set_Pixel_Sizes( ftFace, 0, 28 ); // want to get 28px size

But when get Metrics from freetype2, the sum of ascender and descender is 29.(24-(-5)).

float FROM_266 = 1.0f/64.0f;
FT_Size_Metrics& ftMetrics = ftFace->size->metrics;
printf("%f %f\n",  static_cast< float >( ftMetrics.ascender  ) * FROM_266, static_cast< float >( ftMetrics.descender ) * FROM_266);
// result : 24 -5

I think it should be 28 because I set the desired size as 28px.

Can sum of ascender and descender bigger than desired size?


Solution

  • Can sum of ascender and descender bigger than desired size?

    Yes.