freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Need clarification on font cutoff


From: madana gopal
Subject: Re: [ft-devel] Need clarification on font cutoff
Date: Thu, 12 Jul 2018 22:05:28 +0530

Thanks Werner for the details. Font file is ttf based. And cut-off randomly happened only for few letters. I tried your suggestion of taking ascend parameter from global FT_Face structure, after which issue is not coming.

Also, we are seeing some light lines, or dots are coming in between characters for some x scale value (say 0.75) (this is also attached). Do you have any inputs on how to address this extra dots/lines?.Attached is screenshot. Freetype version is 2.8.1. Please guide how this problem need to be addressed. 

Thanks.

Regards,
Madan

On Thu, Jul 12, 2018 at 10:20 AM, Werner LEMBERG <address@hidden> wrote:

> We are using freetype-2.8.1.  When we try to print the text
> characters, sometimes little top portion of text characters got
> stripped off.  Pixel size passed to FT library is 30. No issue is
> seen with freetype-2.5.2.

Please give an example.  Which font, which character, which hinting
mode?

> It is seen, ascent value returned from font metrics is not returned
> properly from the ttdriver.c in recent versions of freetype.

Have you seen the following entry in the `CHANGES' file for
version 2.8?

  Global size metrics values in the `FT_Size_Metrics' structure can be
  different for TrueType fonts.  Reason is that in older FreeType
  versions the metrics were rounded differently to integer pixels
  compared to all other font formats, yielding an inconsistent
  behaviour if you used non-native hinting.  Starting with this
  version, global size metrics for TrueType fonts are handled the same
  as other font formats: `ascender' gets rounded up, `descender' gets
  rounded down, `height' gets normally rounded, and `max_advance' gets
  normally rounded, too.

  If you need more precise values of (global) ascender, descender,
  height, or `max_advance', please take the corresponding values from
  the `FT_Face' structure and scale them manually.

In version 2.9 I updated the documentation for `FT_Size_Metrics' as
follows.

   TrueType fonts with native bytecode hinting
   -------------------------------------------

   All applications that handle TrueType fonts with native hinting
   must be aware that TTFs expect different rounding of vertical font
   dimensions.  The application has to cater for this, especially if
   it wants to rely on a TTF's vertical data (for example, to properly
   align box characters vertically).

   Only the application knows _in_ _advance_ that it is going to use
   native hinting for TTFs!  FreeType, on the other hand, selects the
   hinting mode not at the time of creating an @FT_Size object but
   much later, namely while calling @FT_Load_Glyph.

   Here is some pseudo code that illustrates a possible solution.

     font_format = FT_Get_Font_Format( face );

     if ( !strcmp( font_format, "TrueType" ) &&
          do_native_bytecode_hinting         )
     {
       ascender  = ROUND( FT_MulFix( face->ascender,
                                     size_metrics->y_scale ) );
       descender = ROUND( FT_MulFix( face->descender,
                                     size_metrics->y_scale ) );
     }
     else
     {   
       ascender  = size_metrics->ascender;
       descender = size_metrics->descender;
     }

     height      = size_metrics->height;
     max_advance = size_metrics->max_advance;


       Werner

Attachment: lines.png
Description: PNG image


reply via email to

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