diff -uprw /home/otaylor/cvs/gnome2/pango-head/pango/opentype/ftxgpos.c ./opentype-munge/ftxgpos.c --- /home/otaylor/cvs/gnome2/pango-head/pango/opentype/ftxgpos.c 2003-07-25 12:59:44.000000000 -0400 +++ ./opentype-munge/ftxgpos.c 2003-07-25 12:55:55.000000000 -0400 @@ -1713,13 +1720,13 @@ if ( context_length != 0xFFFF && context_length < 2 ) return TTO_Err_Not_Covered; - if ( CHECK_Property( gpos->gdef, in->string[in->pos], flags, &property ) ) - return error; - error = Coverage_Index( &pp->Coverage, in->string[in->pos], &index ); if ( error ) return error; + if ( CHECK_Property( gpos->gdef, in->string[in->pos], flags, &property ) ) + return error; + /* second glyph */ first_pos = in->pos; @@ -1925,6 +1925,16 @@ return TTO_Err_Not_Covered; } + error = Coverage_Index( &cp->Coverage, in->string[in->pos], &index ); + if ( error ) + { + gpi->last = 0xFFFF; + return error; + } + + if ( index >= cp->EntryExitCount ) + return TTO_Err_Invalid_GPOS_SubTable; + /* Glyphs not having the right GDEF properties will be ignored, i.e., gpi->last won't be reset (contrary to user defined properties). */ @@ -1940,15 +1950,6 @@ return TTO_Err_Not_Covered; } - error = Coverage_Index( &cp->Coverage, in->string[in->pos], &index ); - if ( error ) - { - gpi->last = 0xFFFF; - return error; - } - - if ( index >= cp->EntryExitCount ) - return TTO_Err_Invalid_GPOS_SubTable; eer = &cp->EntryExitRecord[index]; @@ -2347,15 +2348,15 @@ if ( flags & IGNORE_BASE_GLYPHS ) return TTO_Err_Not_Covered; - if ( CHECK_Property( gpos->gdef, in->string[in->pos], - flags, &property ) ) - return error; - error = Coverage_Index( &mbp->MarkCoverage, in->string[in->pos], &mark_index ); if ( error ) return error; + if ( CHECK_Property( gpos->gdef, in->string[in->pos], + flags, &property ) ) + return error; + /* now we search backwards for a base glyph */ i = 1; @@ -2756,13 +2763,13 @@ mark_glyph = in->string[in->pos]; - if ( CHECK_Property( gpos->gdef, mark_glyph, flags, &property ) ) - return error; - error = Coverage_Index( &mlp->MarkCoverage, mark_glyph, &mark_index ); if ( error ) return error; + if ( CHECK_Property( gpos->gdef, mark_glyph, flags, &property ) ) + return error; + /* now we search backwards for a ligature */ i = 1; @@ -3089,15 +3092,16 @@ if ( flags & IGNORE_MARKS ) return TTO_Err_Not_Covered; - if ( CHECK_Property( gpos->gdef, in->string[in->pos], - flags, &property ) ) - return error; - error = Coverage_Index( &mmp->Mark1Coverage, in->string[in->pos], &mark1_index ); if ( error ) return error; + if ( CHECK_Property( gpos->gdef, in->string[in->pos], + flags, &property ) ) + return error; + + /* now we check the preceding glyph whether it is a suitable mark glyph */ @@ -3945,16 +3951,15 @@ TTO_PosRule* pr; TTO_GDEFHeader* gdef; + error = Coverage_Index( &cpf1->Coverage, in->string[in->pos], &index ); + if ( error ) + return error; gdef = gpos->gdef; if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) return error; - error = Coverage_Index( &cpf1->Coverage, in->string[in->pos], &index ); - if ( error ) - return error; - pr = cpf1->PosRuleSet[index].PosRule; numpr = cpf1->PosRuleSet[index].PosRuleCount; @@ -4013,22 +4013,21 @@ TTO_PosClassRule* pr; TTO_GDEFHeader* gdef; - - gdef = gpos->gdef; - - if ( ALLOC_ARRAY( classes, cpf2->MaxContextLength, FT_UShort ) ) - return error; - - if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) - return error; - /* Note: The coverage table in format 2 doesn't give an index into anything. It just lets us know whether or not we need to do any lookup at all. */ error = Coverage_Index( &cpf2->Coverage, in->string[in->pos], &index ); if ( error ) - goto End; + return error; + + gdef = gpos->gdef; + + if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) + return error; + + if ( ALLOC_ARRAY( classes, cpf2->MaxContextLength, FT_UShort ) ) + return error; error = Get_Class( &cpf2->ClassDef, in->string[in->pos], &classes[0], NULL ); @@ -4127,15 +4131,15 @@ gdef = gpos->gdef; - if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) - return error; - if ( context_length != 0xFFFF && context_length < cpf3->GlyphCount ) return TTO_Err_Not_Covered; if ( in->pos + cpf3->GlyphCount > in->length ) return TTO_Err_Not_Covered; /* context is too long */ + if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) + return error; + s_in = &in->string[in->pos]; c = cpf3->Coverage; @@ -5230,15 +5237,15 @@ TTO_GDEFHeader* gdef; + error = Coverage_Index( &ccpf1->Coverage, in->string[in->pos], &index ); + if ( error ) + return error; + gdef = gpos->gdef; if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) return error; - error = Coverage_Index( &ccpf1->Coverage, in->string[in->pos], &index ); - if ( error ) - return error; - cpr = ccpf1->ChainPosRuleSet[index].ChainPosRule; num_cpr = ccpf1->ChainPosRuleSet[index].ChainPosRuleCount; @@ -5382,9 +5389,6 @@ gdef = gpos->gdef; - if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) - return error; - /* Note: The coverage table in format 2 doesn't give an index into anything. It just lets us know whether or not we need to do any lookup at all. */ @@ -5393,6 +5397,9 @@ if ( error ) return error; + if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) + return error; + if ( ALLOC_ARRAY( backtrack_classes, ccpf2->MaxBacktrackLength, FT_UShort ) ) return error; known_backtrack_classes = 0; @@ -5588,11 +5595,6 @@ TTO_GDEFHeader* gdef; - gdef = gpos->gdef; - - if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) - return error; - bgc = ccpf3->BacktrackGlyphCount; igc = ccpf3->InputGlyphCount; lgc = ccpf3->LookaheadGlyphCount; @@ -5605,6 +5607,11 @@ if ( bgc > in->pos || in->pos + igc + lgc > in->length ) return TTO_Err_Not_Covered; + gdef = gpos->gdef; + + if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) + return error; + if ( bgc ) { /* Since we don't know in advance the number of glyphs to inspect, diff -uprw /home/otaylor/cvs/gnome2/pango-head/pango/opentype/ftxgsub.c ./opentype-munge/ftxgsub.c --- /home/otaylor/cvs/gnome2/pango-head/pango/opentype/ftxgsub.c 2003-07-25 12:59:44.000000000 -0400 +++ ./opentype-munge/ftxgsub.c 2003-07-25 12:55:55.000000000 -0400 @@ -516,11 +516,11 @@ if ( context_length != 0xFFFF && context_length < 1 ) return TTO_Err_Not_Covered; - if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) - return error; - error = Coverage_Index( &ss->Coverage, in->string[in->pos], &index ); if ( error ) + return error; + + if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) return error; switch ( ss->SubstFormat ) @@ -721,11 +721,11 @@ if ( context_length != 0xFFFF && context_length < 1 ) return TTO_Err_Not_Covered; - if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) - return error; - error = Coverage_Index( &ms->Coverage, in->string[in->pos], &index ); if ( error ) + return error; + + if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) return error; if ( index >= ms->SequenceCount ) @@ -933,13 +912,13 @@ if ( context_length != 0xFFFF && context_length < 1 ) return TTO_Err_Not_Covered; - if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) - return error; - error = Coverage_Index( &as->Coverage, in->string[in->pos], &index ); if ( error ) return error; + if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) + return error; + aset = as->AlternateSet[index]; /* we use a user-defined callback function to get the alternate index */ @@ -1212,6 +1190,9 @@ TTO_Ligature* lig; + error = Coverage_Index( &ls->Coverage, in->string[in->pos], &index ); + if ( error ) + return error; if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) return error; @@ -1219,10 +1200,6 @@ if ( property == TTO_MARK ) first_is_mark = TRUE; - error = Coverage_Index( &ls->Coverage, in->string[in->pos], &index ); - if ( error ) - return error; - if ( index >= ls->LigatureSetCount ) return TTO_Err_Invalid_GSUB_SubTable; @@ -2119,15 +2077,15 @@ TTO_GDEFHeader* gdef; + error = Coverage_Index( &csf1->Coverage, in->string[in->pos], &index ); + if ( error ) + return error; + gdef = gsub->gdef; if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) return error; - error = Coverage_Index( &csf1->Coverage, in->string[in->pos], &index ); - if ( error ) - return error; - sr = csf1->SubRuleSet[index].SubRule; numsr = csf1->SubRuleSet[index].SubRuleCount; @@ -2181,19 +2181,18 @@ gdef = gsub->gdef; - if ( ALLOC_ARRAY( classes, csf2->MaxContextLength, FT_UShort ) ) + /* Note: The coverage table in format 2 doesn't give an index into + anything. It just lets us know whether or not we need to + do any lookup at all. */ + + if ( (error = Coverage_Index( &csf2->Coverage, in->string[in->pos], &index ) ) ) return error; if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) return error; - /* Note: The coverage table in format 2 doesn't give an index into - anything. It just lets us know whether or not we need to - do any lookup at all. */ - - error = Coverage_Index( &csf2->Coverage, in->string[in->pos], &index ); - if ( error ) - goto End; + if ( ALLOC_ARRAY( classes, csf2->MaxContextLength, FT_UShort ) ) + return error; error = Get_Class( &csf2->ClassDef, in->string[in->pos], &classes[0], NULL ); @@ -2300,15 +2257,15 @@ gdef = gsub->gdef; - if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) - return error; - if ( context_length != 0xFFFF && context_length < csf3->GlyphCount ) return TTO_Err_Not_Covered; if ( in->pos + csf3->GlyphCount > in->length ) return TTO_Err_Not_Covered; /* context is too long */ + if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) + return error; + s_in = &in->string[in->pos]; c = csf3->Coverage; @@ -3406,16 +3369,15 @@ TTO_ChainSubRule curr_csr; TTO_GDEFHeader* gdef; + error = Coverage_Index( &ccsf1->Coverage, in->string[in->pos], &index ); + if ( error ) + return error; gdef = gsub->gdef; if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) return error; - error = Coverage_Index( &ccsf1->Coverage, in->string[in->pos], &index ); - if ( error ) - return error; - csr = ccsf1->ChainSubRuleSet[index].ChainSubRule; num_csr = ccsf1->ChainSubRuleSet[index].ChainSubRuleCount; @@ -3559,9 +3521,6 @@ gdef = gsub->gdef; memory = gsub->memory; - if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) - return error; - /* Note: The coverage table in format 2 doesn't give an index into anything. It just lets us know whether or not we need to do any lookup at all. */ @@ -3570,6 +3529,9 @@ if ( error ) return error; + if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) + return error; + if ( ALLOC_ARRAY( backtrack_classes, ccsf2->MaxBacktrackLength, FT_UShort ) ) return error; known_backtrack_classes = 0; @@ -3766,9 +3728,6 @@ gdef = gsub->gdef; - if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) - return error; - bgc = ccsf3->BacktrackGlyphCount; igc = ccsf3->InputGlyphCount; lgc = ccsf3->LookaheadGlyphCount; @@ -3781,6 +3740,9 @@ if ( bgc > in->pos || in->pos + igc + lgc > in->length ) return TTO_Err_Not_Covered; + if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) + return error; + if ( bgc ) { /* Since we don't know in advance the number of glyphs to inspect,