[cff] Remove size/slot checks.

After the previous commit, cff_glyph_load is no longer called
without first checking for valid size and glyph objects in
FT_Glyph_Load and these checks can be removed downstream.

* src/cff/cffdrivr.c (cff_glyph_load): Remove `size` and `glyph` checks.
* src/cff/cffgload.c (cff_slot_load): Ditto.
This commit is contained in:
Alexei Podtelezhnikov 2025-01-08 15:45:32 -05:00
parent c7a255b462
commit 73318c864a
2 changed files with 3 additions and 30 deletions

View File

@ -168,26 +168,8 @@
CFF_Size cffsize = (CFF_Size)size;
if ( !cffslot )
return FT_THROW( Invalid_Slot_Handle );
FT_TRACE1(( "cff_glyph_load: glyph index %d\n", glyph_index ));
/* check whether we want a scaled outline or bitmap */
if ( !cffsize )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
/* reset the size object if necessary */
if ( load_flags & FT_LOAD_NO_SCALE )
size = NULL;
if ( size )
{
/* these two objects must have the same parent */
if ( size->face != slot->face )
return FT_THROW( Invalid_Face_Handle );
}
/* now load the glyph outline if necessary */
error = cff_slot_load( cffslot, cffsize, glyph_index, load_flags );

View File

@ -238,24 +238,12 @@
else if ( glyph_index >= cff->num_glyphs )
return FT_THROW( Invalid_Argument );
if ( load_flags & FT_LOAD_NO_RECURSE )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
glyph->x_scale = 0x10000L;
glyph->y_scale = 0x10000L;
if ( size )
{
glyph->x_scale = size->root.metrics.x_scale;
glyph->y_scale = size->root.metrics.y_scale;
}
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/* try to load embedded bitmap if any */
/* */
/* XXX: The convention should be emphasized in */
/* the documents because it can be confusing. */
if ( size )
{
CFF_Face cff_face = (CFF_Face)size->root.face;
SFNT_Service sfnt = (SFNT_Service)cff_face->sfnt;
@ -423,6 +411,9 @@
/* if we have a CID subfont, use its matrix (which has already */
/* been multiplied with the root matrix) */
glyph->x_scale = size->root.metrics.x_scale;
glyph->y_scale = size->root.metrics.y_scale;
/* this scaling is only relevant if the PS hinter isn't active */
if ( cff->num_subfonts )
{