freetype
[Top][All Lists]
Advanced

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

[ft] Freetype2 returns different descender value after upgrading 2.6.x t


From: 선민호
Subject: [ft] Freetype2 returns different descender value after upgrading 2.6.x to 2.8.x
Date: Fri, 06 Apr 2018 13:49:29 +0900

   Hello freetype!


   I'm minho sun who is working at Samsung Research.

   My main work is making text winset work in our UI framework named DALi.


   We use freetype to get font information and freetype2 worked perfectly
   since we updated it 2.6.x to 2.8.x.


   After updating, freetype2 returns different descender value when using
   same font.


   Here is our code.

   FontId FontClient::Plugin::CreateFont( const FontPath& path,
                                          PointSize26Dot6
   requestedPointSize,
                                          FaceIndex faceIndex,
                                          bool cacheDescription )
   {

   ....snip....

         int error = FT_Set_Char_Size( ftFace,
                                   0,
                                   requestedPointSize,  // 28px to point
   size -> 457
                                   mDpiHorizontal,      // 282
                                   mDpiVertical );        // 282

         if( FT_Err_Ok == error )
         {

           FT_Size_Metrics& ftMetrics = ftFace->size->metrics;

           FontMetrics metrics( static_cast< float >( ftMetrics.ascender
   ) * FROM_266,  // it means 1/64
                                static_cast< float >( ftMetrics.descender
   ) * FROM_266,
                                static_cast< float >( ftMetrics.height
   ) * FROM_266,
                                static_cast< float >(
   ftFace->underline_position ) * FROM_266,
                                static_cast< float >(
   ftFace->underline_thickness ) * FROM_266 );

           mFontCache.push_back( FontFaceCacheItem( ftFace, path,
   requestedPointSize, faceIndex, metrics ) );
           id = mFontCache.size();

   ....snip....



   We use FT_Set_Char_Size and pass 457 as required size and pass 282 as
   dpi.

   Then, in 2.6.x, we got 24 as ascender value and -4 as descender value.

   But in 2.8.x, we got 24 as ascender value and -5 as descender value
   even if using same font file.


   This makes big problem because when sum of ascender and
   descender is bigger than winset height, we change text to
   ellipsis(...).


   Is it kind of bug? I think it should return same value because we use
   same font.

   And plus, is it possible that the sum of asender and descender is
   bigger than required size?


   Best Regards,

   Minho.


   ( I hope I can share the font file but it is secured file so I cannot
   send to you now :( Sorry for that....)


   [cid:cafe_image_0@s-core.co.kr]

   [update?userid=minho.sun&do=bWFpbElEPTIwMTgwNDA2MDQ0OTI5ZXBjbXMxcDFiODA
   yMjIzNGJkYzdhODc0OGZkNjMxNTFjMTA3ODUyNCZyZWNpcGllbnRBZGRyZXNzPWZyZWV0eX
   BlQG5vbmdudS5vcmc_]

GIF image


reply via email to

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