Thanks for the quick response Alexei.
I hope I am understanding the issue correctly regarding the use of
FT_ADVANCE_FLAG_FAST_ONLY .
I've used both the 2.13.2 release and the 2.14.1 release.
I am loading in a ccf font.
In 2.13.2, the call to FT_Get_Advance always succeeds.
In 2.14.1, it always fails, regardless of the FT_ADVANCE_FLAG_FAST_ONLY
flag.
My code did set FT_ADVANCE_FLAG_FAST_ONLY.
Specifically I was setting the flag to the following
flag = (FT_LOAD_NO_SCALE | FT_ADVANCE_FLAG_FAST_ONLY );
and this would then call
FT_Get_Advance(face, glyph_index, flag, &nonscaledAdvance);
This call to FT_Get_Advance fails using the 2.14.1 release.
(As a note, we will always be doing a fast check because we set
FT_LOAD_NO_SCALE - in the function FT_Get_Advance, the call to the
LOAD_ADVANCE_FAST_CHECK macro will return true.)
Next I tested removing FT_ADVANCE_FLAG_FAST_ONLY.
So this is just
flag = FT_LOAD_NO_SCALE;
again calling
FT_Get_Advance(face, glyph_index, flag, &nonscaledAdvance);
This call to FT_Get_Advance also fails in the 2.14.1 code.
The reason for the failure is that the first check in the function
cff_get_advance, shown below, always fails. At no point is there a check
for FT_ADVANCE_FLAG_FAST_ONLY of the flag passed into the function.
cff_get_advance( ... )
{
if ( !FT_IS_SFNT( face ) ) // <-----
always fails, regardless of the flags
return FT_THROW( Unimplemented_Feature );
...
}
In the 2.13.2 release, the cff_get_advances function doesn't fail because
it drops down to some code which works on the glyphs:
cff_get_advances( ... )
{
...
...
...
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;
}
}
Finally looking at the documentation
https://freetype.org/freetype2/docs/reference/ft2-quick_advance.html
This says
This function may fail if you use FT_ADVANCE_FLAG_FAST_ONLY
<https://freetype.org/freetype2/docs/reference/ft2-quick_advance.html#ft_advance_flag_fast_only>
and if the corresponding font backend doesn't have a quick way to retrieve
the advances.
But we're now seeing a failure even if we don't use this flag.
I can see that this discussion is now getting quite involved but hopefully
my explanation makes sense.
Again thanks for the help in discussing this issue, Tony Smith
On Wed, 22 Oct 2025 at 18:05, Alexei Podtelezhnikov <[email protected]>
wrote:
>
> > 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.
>
> Reading src/base/ftadvanc.c , this is exactly what should happen *unless*
> FT_ADVANCE_FLAG_FAST_ONLY is set. No?
>
>
>
>
>
>
--
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.