From 73318c864a1bd0b1f5c4638bbdc87b81176b844f Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Wed, 8 Jan 2025 15:45:32 -0500 Subject: [PATCH] [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. --- src/cff/cffdrivr.c | 18 ------------------ src/cff/cffgload.c | 15 +++------------ 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 8a41371c9..bab7d349a 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -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 ); diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 727df9f8c..1abee3aec 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -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 ) {