[autofit] Updated to reduce casting.

* src/autofit/afglobal.h (AF_FaceGlobalsRec): Change `glyph_count` type.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage,
af_face_globals_get_metrics, af_face_globals_is_digit,
af_face_globals_new): Changed local types and updated accordingly.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Ditto.
This commit is contained in:
Alexei Podtelezhnikov 2022-08-01 09:52:43 -04:00
parent 9de432f7f2
commit 4f195185ee
3 changed files with 20 additions and 20 deletions

View File

@ -129,13 +129,13 @@
FT_Face face = globals->face;
FT_CharMap old_charmap = face->charmap;
FT_UShort* gstyles = globals->glyph_styles;
FT_UInt ss;
FT_UShort ss;
FT_UShort dflt = 0xFFFFU; /* a non-valid value */
FT_UInt i;
FT_UInt dflt = ~0U; /* a non-valid value */
/* the value AF_STYLE_UNASSIGNED means `uncovered glyph' */
for ( i = 0; i < (FT_UInt)globals->glyph_count; i++ )
for ( i = 0; i < globals->glyph_count; i++ )
gstyles[i] = AF_STYLE_UNASSIGNED;
error = FT_Select_Charmap( face, FT_ENCODING_UNICODE );
@ -183,9 +183,9 @@
gindex = FT_Get_Char_Index( face, charcode );
if ( gindex != 0 &&
gindex < (FT_ULong)globals->glyph_count &&
gindex < globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
gstyles[gindex] = (FT_UShort)ss;
gstyles[gindex] = ss;
for (;;)
{
@ -194,9 +194,9 @@
if ( gindex == 0 || charcode > range->last )
break;
if ( gindex < (FT_ULong)globals->glyph_count &&
if ( gindex < globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
gstyles[gindex] = (FT_UShort)ss;
gstyles[gindex] = ss;
}
}
@ -211,9 +211,9 @@
gindex = FT_Get_Char_Index( face, charcode );
if ( gindex != 0 &&
gindex < (FT_ULong)globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss )
if ( gindex != 0 &&
gindex < globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == ss )
gstyles[gindex] |= AF_NONBASE;
for (;;)
@ -223,8 +223,8 @@
if ( gindex == 0 || charcode > range->last )
break;
if ( gindex < (FT_ULong)globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss )
if ( gindex < globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == ss )
gstyles[gindex] |= AF_NONBASE;
}
}
@ -255,7 +255,7 @@
FT_UInt gindex = FT_Get_Char_Index( face, i );
if ( gindex != 0 && gindex < (FT_ULong)globals->glyph_count )
if ( gindex != 0 && gindex < globals->glyph_count )
gstyles[gindex] |= AF_DIGIT;
}
@ -266,7 +266,7 @@
*/
if ( globals->module->fallback_style != AF_STYLE_UNASSIGNED )
{
FT_Long nn;
FT_UInt nn;
for ( nn = 0; nn < globals->glyph_count; nn++ )
@ -290,7 +290,7 @@
{
AF_StyleClass style_class = af_style_classes[ss];
FT_UInt count = 0;
FT_Long idx;
FT_UInt idx;
FT_TRACE4(( "%s:\n", af_style_names[style_class->style] ));
@ -345,7 +345,7 @@
FT_ZERO( &globals->metrics );
globals->face = face;
globals->glyph_count = face->num_glyphs;
globals->glyph_count = (FT_UInt)face->num_glyphs;
/* right after the globals structure come the glyph styles */
globals->glyph_styles = (FT_UShort*)( globals + 1 );
globals->module = module;
@ -429,7 +429,7 @@
FT_Error error = FT_Err_Ok;
if ( gindex >= (FT_ULong)globals->glyph_count )
if ( gindex >= globals->glyph_count )
{
error = FT_THROW( Invalid_Argument );
goto Exit;
@ -501,7 +501,7 @@
af_face_globals_is_digit( AF_FaceGlobals globals,
FT_UInt gindex )
{
if ( gindex < (FT_ULong)globals->glyph_count )
if ( gindex < globals->glyph_count )
return FT_BOOL( globals->glyph_styles[gindex] & AF_DIGIT );
return FT_BOOL( 0 );

View File

@ -105,7 +105,7 @@ FT_BEGIN_HEADER
typedef struct AF_FaceGlobalsRec_
{
FT_Face face;
FT_Long glyph_count; /* same as face->num_glyphs */
FT_UInt glyph_count; /* unsigned face->num_glyphs */
FT_UShort* glyph_styles;
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ

View File

@ -1043,7 +1043,7 @@
AF_FaceGlobals globals = metrics->root.globals;
FT_UShort* gstyles = globals->glyph_styles;
FT_Long i;
FT_UInt i;
FT_TRACE5(( "no blue zones found:"