Hello Freetype Development

We use Freetype in our software to handle fonts.
We have noticed a difference in behaviour between versions 2.13.3 and
2.14.1.
Specifically we have example pdf files which contain embedded fonts.
In this case the font type we are interested in are type1 fonts stored in
the compact font format (CFF).

The problem is in the Freetype function cff_get_advances (file
src\cff\cffdrivr.c).
In the 2.14.1 code there is the following check at the start of the
function which now fails
    if ( !FT_IS_SFNT( face ) )
      return FT_THROW( Unimplemented_Feature );

When we load in a font we see that the face->flag is set to 2577 (0x0a11)
And the FT_IS_SFNT call fails because we don't have the following set in
the face->flag
FT_FACE_FLAG_SFNT = 0x08

Now previously in version 2.13.3 we still had a  FT_IS_SFNT check but this
didn't result in an error.
There was code at the end of the cff_get_advances  function which generated
valid metric data.

  Missing_Table:
    flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;

    for ( nn = 0; nn < count; nn++ )
    {
      error = cff_glyph_load( slot, face->size, start + nn, flags );
      if ( error )
        break;

      advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
                     ? slot->linearVertAdvance
                     : slot->linearHoriAdvance;
    }

Looking through the ChangeLog I think this was the change, as it is the
only mention of  cff_get_advances in the ChangeLog.

2025-01-08  Alexei Podtelezhnikov  <[email protected]>

* src/cff/cffdrivr.c (cff_get_advances): Do only fast advances.

Otherwise, let TT_Get_Advances fall back on cff_load_glyph to do
slow advances. This avoids unchecked access to cff_load_glyph and
 this is how tt_get_advances is implemented.


Given that the new code no longer returns advances for some fonts that
previously worked under 2.13.3, should this 2.13.3 behaviour be reinstated?


Regards Tony Smith

-- 
This e-mail message has been scanned and cleared by Google Message Security 
and the UNICOM Global security systems. This message is for the named 
person's use only. If you receive this message in error, please delete it 
and notify the sender. 

Reply via email to