diff options
Diffstat (limited to 'pango/opentype/harfbuzz-gdef.c')
-rw-r--r-- | pango/opentype/harfbuzz-gdef.c | 149 |
1 files changed, 75 insertions, 74 deletions
diff --git a/pango/opentype/harfbuzz-gdef.c b/pango/opentype/harfbuzz-gdef.c index 7a30d8bd..859c81bb 100644 --- a/pango/opentype/harfbuzz-gdef.c +++ b/pango/opentype/harfbuzz-gdef.c @@ -14,9 +14,9 @@ #include "harfbuzz-gdef-private.h" #include "harfbuzz-open-private.h" -static FT_Error Load_AttachList( HB_AttachList* al, +static HB_Error Load_AttachList( HB_AttachList* al, FT_Stream stream ); -static FT_Error Load_LigCaretList( HB_LigCaretList* lcl, +static HB_Error Load_LigCaretList( HB_LigCaretList* lcl, FT_Stream stream ); static void Free_AttachList( HB_AttachList* al, @@ -37,7 +37,7 @@ static void Free_NewGlyphClasses( HB_GDEFHeader* gdef, #define GDEF_ID Build_Extension_ID( 'G', 'D', 'E', 'F' ) -static FT_Error GDEF_Create( void* ext, +static HB_Error GDEF_Create( void* ext, PFace face ) { DEFINE_LOAD_LOCALS( face->stream ); @@ -49,7 +49,7 @@ static FT_Error GDEF_Create( void* ext, /* by convention */ if ( !gdef ) - return FT_Err_Ok; + return HB_Err_Ok; /* a null offset indicates that there is no GDEF table */ @@ -59,7 +59,7 @@ static FT_Error GDEF_Create( void* ext, table = HB_LookUp_Table( face, TTAG_GDEF ); if ( table < 0 ) - return FT_Err_Ok; /* The table is optional */ + return HB_Err_Ok; /* The table is optional */ if ( FILE_Seek( face->dirTables[table].Offset ) || ACCESS_Frame( 4L ) ) @@ -72,11 +72,11 @@ static FT_Error GDEF_Create( void* ext, gdef->loaded = FALSE; - return FT_Err_Ok; + return HB_Err_Ok; } -static FT_Error GDEF_Destroy( void* ext, +static HB_Error GDEF_Destroy( void* ext, PFace face ) { HB_GDEFHeader* gdef = (HB_GDEFHeader*)ext; @@ -85,7 +85,7 @@ static FT_Error GDEF_Destroy( void* ext, /* by convention */ if ( !gdef ) - return FT_Err_Ok; + return HB_Err_Ok; if ( gdef->loaded ) { @@ -97,18 +97,18 @@ static FT_Error GDEF_Destroy( void* ext, Free_NewGlyphClasses( gdef, memory ); } - return FT_Err_Ok; + return HB_Err_Ok; } -FT_Error HB_Init_GDEF_Extension( HB_Engine engine ) +HB_Error HB_Init_GDEF_Extension( HB_Engine engine ) { PEngine_Instance _engine = HANDLE_Engine( engine ); if ( !_engine ) - return FT_Err_Invalid_Engine; + return HB_Err_Invalid_Engine; return HB_Register_Extension( _engine, GDEF_ID, @@ -130,16 +130,16 @@ FT_Error HB_Init_GDEF_Extension( HB_Engine engine ) -FT_Error HB_New_GDEF_Table( FT_Face face, +HB_Error HB_New_GDEF_Table( FT_Face face, HB_GDEFHeader** retptr ) { - FT_Error error; + HB_Error error; FT_Memory memory = face->memory; HB_GDEFHeader* gdef; if ( !retptr ) - return FT_Err_Invalid_Argument; + return HB_Err_Invalid_Argument; if ( ALLOC( gdef, sizeof( *gdef ) ) ) return error; @@ -157,14 +157,14 @@ FT_Error HB_New_GDEF_Table( FT_Face face, *retptr = gdef; - return FT_Err_Ok; + return HB_Err_Ok; } -FT_Error HB_Load_GDEF_Table( FT_Face face, +HB_Error HB_Load_GDEF_Table( FT_Face face, HB_GDEFHeader** retptr ) { - FT_Error error; + HB_Error error; FT_Memory memory = face->memory; FT_Stream stream = face->stream; FT_ULong cur_offset, new_offset, base_offset; @@ -173,7 +173,7 @@ FT_Error HB_Load_GDEF_Table( FT_Face face, if ( !retptr ) - return FT_Err_Invalid_Argument; + return HB_Err_Invalid_Argument; if (( error = _hb_ftglue_face_goto_table( face, TTAG_GDEF, stream ) )) return error; @@ -204,7 +204,7 @@ FT_Error HB_Load_GDEF_Table( FT_Face face, cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || ( error = _HB_OPEN_Load_ClassDefinition( &gdef->GlyphClassDef, 5, - stream ) ) != FT_Err_Ok ) + stream ) ) != HB_Err_Ok ) goto Fail0; (void)FILE_Seek( cur_offset ); } @@ -223,7 +223,7 @@ FT_Error HB_Load_GDEF_Table( FT_Face face, cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || ( error = Load_AttachList( &gdef->AttachList, - stream ) ) != FT_Err_Ok ) + stream ) ) != HB_Err_Ok ) goto Fail1; (void)FILE_Seek( cur_offset ); } @@ -242,7 +242,7 @@ FT_Error HB_Load_GDEF_Table( FT_Face face, cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || ( error = Load_LigCaretList( &gdef->LigCaretList, - stream ) ) != FT_Err_Ok ) + stream ) ) != HB_Err_Ok ) goto Fail2; (void)FILE_Seek( cur_offset ); } @@ -265,7 +265,7 @@ FT_Error HB_Load_GDEF_Table( FT_Face face, *retptr = gdef; - return FT_Err_Ok; + return HB_Err_Ok; Fail3: Free_LigCaretList( &gdef->LigCaretList, memory ); @@ -283,7 +283,7 @@ Fail0: } -FT_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef ) +HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef ) { FT_Memory memory = gdef->memory; @@ -296,7 +296,7 @@ FT_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef ) FREE( gdef ); - return FT_Err_Ok; + return HB_Err_Ok; } @@ -309,11 +309,11 @@ FT_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef ) /* AttachPoint */ -static FT_Error Load_AttachPoint( HB_AttachPoint* ap, +static HB_Error Load_AttachPoint( HB_AttachPoint* ap, FT_Stream stream ) { FT_Memory memory = stream->memory; - FT_Error error; + HB_Error error; FT_UShort n, count; FT_UShort* pi; @@ -347,7 +347,7 @@ static FT_Error Load_AttachPoint( HB_AttachPoint* ap, FORGET_Frame(); } - return FT_Err_Ok; + return HB_Err_Ok; } @@ -360,11 +360,11 @@ static void Free_AttachPoint( HB_AttachPoint* ap, /* AttachList */ -static FT_Error Load_AttachList( HB_AttachList* al, +static HB_Error Load_AttachList( HB_AttachList* al, FT_Stream stream ) { FT_Memory memory = stream->memory; - FT_Error error; + HB_Error error; FT_UShort n, m, count; FT_ULong cur_offset, new_offset, base_offset; @@ -383,7 +383,7 @@ static FT_Error Load_AttachList( HB_AttachList* al, cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || - ( error = _HB_OPEN_Load_Coverage( &al->Coverage, stream ) ) != FT_Err_Ok ) + ( error = _HB_OPEN_Load_Coverage( &al->Coverage, stream ) ) != HB_Err_Ok ) return error; (void)FILE_Seek( cur_offset ); @@ -412,14 +412,14 @@ static FT_Error Load_AttachList( HB_AttachList* al, cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || - ( error = Load_AttachPoint( &ap[n], stream ) ) != FT_Err_Ok ) + ( error = Load_AttachPoint( &ap[n], stream ) ) != HB_Err_Ok ) goto Fail1; (void)FILE_Seek( cur_offset ); } al->loaded = TRUE; - return FT_Err_Ok; + return HB_Err_Ok; Fail1: for ( m = 0; m < n; m++ ) @@ -470,10 +470,10 @@ static void Free_AttachList( HB_AttachList* al, /* CaretValueFormat3 */ /* CaretValueFormat4 */ -static FT_Error Load_CaretValue( HB_CaretValue* cv, +static HB_Error Load_CaretValue( HB_CaretValue* cv, FT_Stream stream ) { - FT_Error error; + HB_Error error; FT_ULong cur_offset, new_offset, base_offset; @@ -522,7 +522,7 @@ static FT_Error Load_CaretValue( HB_CaretValue* cv, cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || ( error = _HB_OPEN_Load_Device( &cv->cvf.cvf3.Device, - stream ) ) != FT_Err_Ok ) + stream ) ) != HB_Err_Ok ) return error; (void)FILE_Seek( cur_offset ); @@ -538,10 +538,10 @@ static FT_Error Load_CaretValue( HB_CaretValue* cv, break; default: - return HB_Err_Invalid_GDEF_SubTable_Format; + return _hb_err(HB_Err_Invalid_GDEF_SubTable_Format); } - return FT_Err_Ok; + return HB_Err_Ok; } @@ -555,11 +555,11 @@ static void Free_CaretValue( HB_CaretValue* cv, /* LigGlyph */ -static FT_Error Load_LigGlyph( HB_LigGlyph* lg, +static HB_Error Load_LigGlyph( HB_LigGlyph* lg, FT_Stream stream ) { FT_Memory memory = stream->memory; - FT_Error error; + HB_Error error; FT_UShort n, m, count; FT_ULong cur_offset, new_offset, base_offset; @@ -594,12 +594,12 @@ static FT_Error Load_LigGlyph( HB_LigGlyph* lg, cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || - ( error = Load_CaretValue( &cv[n], stream ) ) != FT_Err_Ok ) + ( error = Load_CaretValue( &cv[n], stream ) ) != HB_Err_Ok ) goto Fail; (void)FILE_Seek( cur_offset ); } - return FT_Err_Ok; + return HB_Err_Ok; Fail: for ( m = 0; m < n; m++ ) @@ -633,11 +633,11 @@ static void Free_LigGlyph( HB_LigGlyph* lg, /* LigCaretList */ -static FT_Error Load_LigCaretList( HB_LigCaretList* lcl, +static HB_Error Load_LigCaretList( HB_LigCaretList* lcl, FT_Stream stream ) { FT_Memory memory = stream->memory; - FT_Error error; + HB_Error error; FT_UShort m, n, count; FT_ULong cur_offset, new_offset, base_offset; @@ -656,7 +656,7 @@ static FT_Error Load_LigCaretList( HB_LigCaretList* lcl, cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || - ( error = _HB_OPEN_Load_Coverage( &lcl->Coverage, stream ) ) != FT_Err_Ok ) + ( error = _HB_OPEN_Load_Coverage( &lcl->Coverage, stream ) ) != HB_Err_Ok ) return error; (void)FILE_Seek( cur_offset ); @@ -685,14 +685,14 @@ static FT_Error Load_LigCaretList( HB_LigCaretList* lcl, cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || - ( error = Load_LigGlyph( &lg[n], stream ) ) != FT_Err_Ok ) + ( error = Load_LigGlyph( &lg[n], stream ) ) != HB_Err_Ok ) goto Fail1; (void)FILE_Seek( cur_offset ); } lcl->loaded = TRUE; - return FT_Err_Ok; + return HB_Err_Ok; Fail1: for ( m = 0; m < n; m++ ) @@ -778,17 +778,17 @@ static FT_UShort Get_New_Class( HB_GDEFHeader* gdef, -FT_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef, +HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef, FT_UShort glyphID, FT_UShort* property ) { FT_UShort class, index; - FT_Error error; + HB_Error error; if ( !gdef || !property ) - return FT_Err_Invalid_Argument; + return HB_Err_Invalid_Argument; /* first, we check for mark attach classes */ @@ -800,7 +800,7 @@ FT_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef, if ( !error ) { *property = class << 8; - return FT_Err_Ok; + return HB_Err_Ok; } } @@ -816,6 +816,7 @@ FT_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef, switch ( class ) { + default: case UNCLASSIFIED_GLYPH: *property = 0; break; @@ -837,17 +838,17 @@ FT_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef, break; } - return FT_Err_Ok; + return HB_Err_Ok; } -static FT_Error Make_ClassRange( HB_ClassDefinition* cd, +static HB_Error Make_ClassRange( HB_ClassDefinition* cd, FT_UShort start, FT_UShort end, FT_UShort class, FT_Memory memory ) { - FT_Error error; + HB_Error error; FT_UShort index; HB_ClassDefFormat2* cdf2; @@ -873,12 +874,12 @@ static FT_Error Make_ClassRange( HB_ClassDefinition* cd, cd->Defined[class] = TRUE; - return FT_Err_Ok; + return HB_Err_Ok; } -FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, +HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, FT_UShort num_glyphs, FT_UShort glyph_count, FT_UShort* glyph_array, @@ -886,7 +887,7 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, { FT_UShort start, curr_glyph, curr_class; FT_UShort n, m, count; - FT_Error error; + HB_Error error; FT_Memory memory; HB_ClassDefinition* gcd; @@ -895,7 +896,7 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, if ( !gdef || !glyph_array || !class_array ) - return FT_Err_Invalid_Argument; + return HB_Err_Invalid_Argument; memory = gdef->memory; gcd = &gdef->GlyphClassDef; @@ -918,13 +919,13 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, if ( curr_class >= 5 ) { - error = FT_Err_Invalid_Argument; + error = HB_Err_Invalid_Argument; goto Fail4; } glyph_count--; - for ( n = 0; n <= glyph_count; n++ ) + for ( n = 0; n < glyph_count + 1; n++ ) { if ( curr_glyph == glyph_array[n] && curr_class == class_array[n] ) { @@ -933,14 +934,14 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, if ( ( error = Make_ClassRange( gcd, start, curr_glyph, curr_class, - memory ) ) != FT_Err_Ok ) + memory ) ) != HB_Err_Ok ) goto Fail3; } else { if ( curr_glyph == 0xFFFF ) { - error = FT_Err_Invalid_Argument; + error = HB_Err_Invalid_Argument; goto Fail3; } else @@ -952,12 +953,12 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, if ( ( error = Make_ClassRange( gcd, start, curr_glyph - 1, curr_class, - memory ) ) != FT_Err_Ok ) + memory ) ) != HB_Err_Ok ) goto Fail3; if ( curr_glyph > glyph_array[n] ) { - error = FT_Err_Invalid_Argument; + error = HB_Err_Invalid_Argument; goto Fail3; } @@ -967,7 +968,7 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, if ( curr_class >= 5 ) { - error = FT_Err_Invalid_Argument; + error = HB_Err_Invalid_Argument; goto Fail3; } @@ -976,14 +977,14 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, if ( ( error = Make_ClassRange( gcd, start, curr_glyph, curr_class, - memory ) ) != FT_Err_Ok ) + memory ) ) != HB_Err_Ok ) goto Fail3; } else { if ( curr_glyph == 0xFFFF ) { - error = FT_Err_Invalid_Argument; + error = HB_Err_Invalid_Argument; goto Fail3; } else @@ -1046,7 +1047,7 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, gcd->loaded = TRUE; - return FT_Err_Ok; + return HB_Err_Ok; Fail1: for ( m = 0; m < n; m++ ) @@ -1084,11 +1085,11 @@ static void Free_NewGlyphClasses( HB_GDEFHeader* gdef, } -FT_Error _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef, +HB_Error _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef, FT_UShort glyphID, FT_UShort property ) { - FT_Error error; + HB_Error error; FT_UShort class, new_class, index; FT_UShort byte, bits, mask; FT_UShort array_index, glyph_index, count; @@ -1129,7 +1130,7 @@ FT_Error _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef, break; default: - return FT_Err_Invalid_Argument; + return HB_Err_Invalid_Argument; } count = gdef->GlyphClassDef.cd.cd2.ClassRangeCount; @@ -1165,16 +1166,16 @@ FT_Error _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef, ngc[array_index][glyph_index / 4] |= bits; } - return FT_Err_Ok; + return HB_Err_Ok; } -FT_Error _HB_GDEF_Check_Property( HB_GDEFHeader* gdef, +HB_Error _HB_GDEF_Check_Property( HB_GDEFHeader* gdef, HB_GlyphItem gitem, FT_UShort flags, FT_UShort* property ) { - FT_Error error; + HB_Error error; if ( gdef ) { @@ -1221,7 +1222,7 @@ FT_Error _HB_GDEF_Check_Property( HB_GDEFHeader* gdef, *property = 0; } - return FT_Err_Ok; + return HB_Err_Ok; } |