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 @@ -32,6 +32,7 @@ #include "fterrcompat.h" #include "ftxopen.h" +#include "ftxgsub.h" #include "ftxopenf.h" @@ -6113,16 +6120,13 @@ /* apply one lookup to the input string object */ - static FT_Error Do_String_Lookup( GPOS_Instance* gpi, + static FT_Error GPos_Do_String_Lookup( GPOS_Instance* gpi, FT_UShort lookup_index, +// unsigned char *where_to_apply, TTO_GSUB_String* in, TTO_GPOS_Data* out ) { FT_Error error = TTO_Err_Not_Covered; - TTO_GPOSHeader* gpos = gpi->gpos; - - FT_UShort* properties = gpos->LookupList.Properties; - FT_UShort* p_in = in->properties; int nesting_level = 0; @@ -6133,7 +6137,7 @@ while ( in->pos < in->length ) { - if ( ~p_in[in->pos] & properties[lookup_index] ) + if (1) //where_to_apply[in->pos]) { /* 0xFFFF indicates that we don't have a context length yet. */ @@ -6166,52 +6170,6 @@ } - EXPORT_FUNC - FT_Error TT_GPOS_Add_Feature( TTO_GPOSHeader* gpos, - FT_UShort feature_index, - FT_UShort property ) - { - FT_UShort i; - - TTO_Feature feature; - FT_UShort* properties; - FT_UShort* index; - - - if ( !gpos || - feature_index >= gpos->FeatureList.FeatureCount ) - return TT_Err_Invalid_Argument; - - properties = gpos->LookupList.Properties; - - feature = gpos->FeatureList.FeatureRecord[feature_index].Feature; - index = feature.LookupListIndex; - - for ( i = 0; i < feature.LookupListCount; i++ ) - properties[index[i]] |= property; - - return TT_Err_Ok; - } - - - EXPORT_FUNC - FT_Error TT_GPOS_Clear_Features( TTO_GPOSHeader* gpos ) - { - FT_UShort i; - - FT_UShort* properties; - - - if ( !gpos ) - return TT_Err_Invalid_Argument; - - properties = gpos->LookupList.Properties; - - for ( i = 0; i < gpos->LookupList.LookupCount; i++ ) - properties[i] = 0; - - return TT_Err_Ok; - } EXPORT_FUNC @@ -6246,44 +6204,41 @@ tables are ignored -- you will get device independent values. */ EXPORT_FUNC - FT_Error TT_GPOS_Apply_String( FT_Face face, + FT_Error TT_GPOS_Apply_Feature(FT_Face face, TTO_GPOSHeader* gpos, + FT_UShort feature_index, FT_UShort load_flags, TTO_GSUB_String* in, TTO_GPOS_Data** out, FT_Bool dvi, FT_Bool r2l ) { - FT_Memory memory = gpos->memory; FT_Error error = TTO_Err_Not_Covered; GPOS_Instance gpi; + TTO_Feature feature; + FT_UShort *index; FT_UShort j; - FT_UShort* properties; - - if ( !face || !gpos || !in || in->length == 0 || in->pos >= in->length ) return TT_Err_Invalid_Argument; - properties = gpos->LookupList.Properties; - gpi.face = face; gpi.gpos = gpos; gpi.load_flags = load_flags; gpi.r2l = r2l; gpi.dvi = dvi; - if ( *out ) - FREE( *out ); - if ( ALLOC_ARRAY( *out, in->length, TTO_GPOS_Data ) ) - return error; + feature = gpos->FeatureList.FeatureRecord[feature_index].Feature; + index = feature.LookupListIndex; - for ( j = 0; j < gpos->LookupList.LookupCount; j++ ) - if ( !properties || properties[j] ) - { - error = Do_String_Lookup( &gpi, j, in, *out ); + //###### need to order lookups in the order they appear in the + //###### lookup list, not the order they appear in the + //###### featurelist. + + for ( j = 0; j < feature.LookupListCount; j++ ) { + error = GPos_Do_String_Lookup( &gpi, index[j], in, *out ); if ( error && error != TTO_Err_Not_Covered ) return error; } diff -uprw /home/otaylor/cvs/gnome2/pango-head/pango/opentype/ftxgpos.h ./opentype-munge/ftxgpos.h --- /home/otaylor/cvs/gnome2/pango-head/pango/opentype/ftxgpos.h 2000-12-19 23:41:36.000000000 -0500 +++ ./opentype-munge/ftxgpos.h 2003-07-25 12:55:55.000000000 -0400 @@ -821,13 +821,6 @@ extern "C" { FT_ULong** feature_tag_list ); EXPORT_DEF - FT_Error TT_GPOS_Add_Feature( TTO_GPOSHeader* gpos, - FT_UShort feature_index, - FT_UShort property ); - EXPORT_DEF - FT_Error TT_GPOS_Clear_Features( TTO_GPOSHeader* gpos ); - - EXPORT_DEF FT_Error TT_GPOS_Register_Glyph_Function( TTO_GPOSHeader* gpos, TTO_GlyphFunction gfunc ); @@ -840,8 +833,9 @@ extern "C" { tables are ignored -- you will get device independent values. */ EXPORT_DEF - FT_Error TT_GPOS_Apply_String( FT_Face face, + FT_Error TT_GPOS_Apply_Feature( FT_Face face, TTO_GPOSHeader* gpos, + FT_UShort feature_index, FT_UShort load_flags, TTO_GSUB_String* in, TTO_GPOS_Data** out, 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 @@ -34,19 +36,19 @@ #include "ftxopen.h" #include "ftxopenf.h" - +#include #define GSUB_ID Build_Extension_ID( 'G', 'S', 'U', 'B' ) -#define ADD_String( in, num_in, out, num_out, glyph_data, component, ligID ) \ +#define ADD_String( in, num_in, out, num_out, glyph_data, component ) \ ( ( error = TT_GSUB_Add_String( (in), (num_in), \ (out), (num_out), \ - (glyph_data), (component), (ligID) \ + (glyph_data), (component) \ ) ) != TT_Err_Ok ) - static FT_Error Do_Glyph_Lookup( TTO_GSUBHeader* gsub, + static FT_Error GSub_Do_Glyph_Lookup( TTO_GSUBHeader* gsub, FT_UShort lookup_index, TTO_GSUB_String* in, TTO_GSUB_String* out, @@ -88,90 +90,64 @@ TTO_GSUB_String* out, FT_UShort num_out, FT_UShort* glyph_data, - FT_UShort component, - FT_UShort ligID ) + FT_UShort component) { - FT_Memory memory = in->memory; - FT_Error error; - FT_UShort i; - FT_UShort p_in; - FT_UShort*p_out; - /* sanity check */ + //assert( !( !in || !out || in->length == 0 || in->pos >= in->length || in->length < in->pos + num_in ) ); - if ( !in || !out || - in->length == 0 || in->pos >= in->length || - in->length < in->pos + num_in ) - return TT_Err_Invalid_Argument; - - if ( out->pos + num_out >= out->allocated ) - { - FT_ULong size = out->pos + num_out + 256L; - - - /* The following works because all fields in `out' must be - initialized to zero (including the `string' field) for the - first use. */ - - if ( REALLOC_ARRAY( out->string, out->allocated, size, FT_UShort ) ) - return error; - if ( REALLOC_ARRAY( out->components, out->allocated, size, FT_UShort ) ) - return error; - if ( REALLOC_ARRAY( out->ligIDs, out->allocated, size, FT_UShort ) ) - return error; - if ( in->properties ) - if ( REALLOC_ARRAY( out->properties, out->allocated, size, FT_UShort ) ) - return error; - if ( REALLOC_ARRAY( out->logClusters, out->allocated, size, FT_Int ) ) - return error; - - out->allocated = size; - } + if ( out->pos + num_out > out->allocated ) + TT_GSUB_String_Allocate( out, out->pos + num_out ); if ( num_out ) { - MEM_Copy( &out->string[out->pos], glyph_data, - num_out * sizeof ( FT_UShort ) ); + int n = num_out; + FT_UShort *dest_glyph = out->string + out->pos; + TTO_Glyph_property *dest_prop = out->glyph_properties + out->pos; + FT_Int *dest_ci = out->character_index + out->pos; + FT_Int src_ci = in->character_index[in->pos]; if ( component == 0xFFFF ) - component = in->components[in->pos]; + component = in->glyph_properties[in->pos].component; - p_out = out->components; + while ( n-- ) { + *(dest_glyph++) = *(glyph_data++); + (dest_prop++)->component = component; + *(dest_ci++) = src_ci; + } - for ( i = out->pos; i < out->pos + num_out; i++ ) - p_out[i] = component; + out->pos += num_out; + } + + in->pos += num_in; + out->length = out->pos; - p_out = out->ligIDs; + return TT_Err_Ok; + } - if ( ligID == 0xFFFF ) - ligID = in->ligIDs[in->pos]; - for ( i = out->pos; i < out->pos + num_out; i++ ) - p_out[i] = ligID; - if ( in->properties ) +/* optimised function for the common case of copying copying 1 glyph to out, replacing n in glyphs */ +static void glyph_copy( TTO_GSUB_String* in, + FT_UShort num_in, + TTO_GSUB_String* out, + FT_UShort glyph, + FT_UShort component) { - p_in = in->properties[in->pos]; - p_out = out->properties; - for ( i = out->pos; i < out->pos + num_out; i++ ) - p_out[i] = p_in; - } + /* sanity check */ + //assert( !( !in || !out || in->length == 0 || in->pos >= in->length || in->length < in->pos + num_in ) ); - for ( i = out->pos; i < out->pos + num_out; i++ ) - out->logClusters[i] = in->logClusters[in->pos]; - } + if ( out->pos >= out->allocated ) + TT_GSUB_String_Allocate( out, out->pos + 1 ); + out->string[out->pos] = glyph; + out->glyph_properties[out->pos].component = component; + out->character_index[out->pos] = in->character_index[in->pos]; + out->pos++; in->pos += num_in; - out->pos += num_out; - out->length = out->pos; - - return TT_Err_Ok; } - - #if 0 /********************** @@ -509,7 +509,7 @@ FT_UShort context_length, TTO_GDEFHeader* gdef ) { - FT_UShort index, value[1], property; + FT_UShort index, value, property; FT_Error error; @@ -526,17 +526,17 @@ switch ( ss->SubstFormat ) { case 1: - value[0] = ( in->string[in->pos] + ss->ssf.ssf1.DeltaGlyphID ) & 0xFFFF; - if ( ADD_String( in, 1, out, 1, value, 0xFFFF, 0xFFFF ) ) - return error; + value = ( in->string[in->pos] + ss->ssf.ssf1.DeltaGlyphID ) & 0xFFFF; + glyph_copy( in, 1, out, value, + in->glyph_properties[in->pos].component); break; case 2: if ( index >= ss->ssf.ssf2.GlyphCount ) return TTO_Err_Invalid_GSUB_SubTable; - value[0] = ss->ssf.ssf2.Substitute[index]; - if ( ADD_String( in, 1, out, 1, value, 0xFFFF, 0xFFFF ) ) - return error; + value = ss->ssf.ssf2.Substitute[index]; + glyph_copy( in, 1, out, value, + in->glyph_properties[in->pos].component); break; default: @@ -560,7 +539,7 @@ { /* we inherit the old glyph class to the substituted glyph */ - error = Add_Glyph_Property( gdef, value[0], property ); + error = Add_Glyph_Property( gdef, value, property ); if ( error && error != TTO_Err_Not_Covered ) return error; } @@ -734,7 +734,7 @@ count = ms->Sequence[index].GlyphCount; s = ms->Sequence[index].Substitute; - if ( ADD_String( in, 1, out, count, s, 0xFFFF, 0xFFFF ) ) + if ( ADD_String( in, 1, out, count, s, 0xFFFF ) ) return error; if ( gdef && gdef->NewGlyphClasses ) @@ -951,9 +930,8 @@ else alt_index = 0; - if ( ADD_String( in, 1, out, 1, &aset.Alternate[alt_index], - 0xFFFF, 0xFFFF ) ) - return error; + glyph_copy( in, 1, out, aset.Alternate[alt_index], + in->glyph_properties[in->pos].component); if ( gdef && gdef->NewGlyphClasses ) { @@ -1277,29 +1254,13 @@ if ( i == j ) { - /* We don't use a new ligature ID if there are no skipped - glyphs and the ligature already has an ID. */ - - if ( in->ligIDs[in->pos] ) - { - if ( ADD_String( in, i, out, 1, &lig->LigGlyph, - 0xFFFF, 0xFFFF ) ) - return error; + glyph_copy( in, i, out, lig->LigGlyph, + in->glyph_properties[in->pos].component ); } else { - if ( ADD_String( in, i, out, 1, &lig->LigGlyph, - 0xFFFF, in->max_ligID ) ) - return error; - - (in->max_ligID)++; - } - } - else - { - if ( ADD_String( in, 1, out, 1, &lig->LigGlyph, - 0xFFFF, in->max_ligID ) ) - return error; + glyph_copy( in, 1, out, lig->LigGlyph, + in->glyph_properties[in->pos].component); /* Now we must do a second loop to copy the skipped glyphs to `out' and assign component values to it. We start with the @@ -1312,14 +1273,9 @@ { while ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) ) - if ( ADD_String( in, 1, out, 1, &in->string[in->pos], - i, in->max_ligID ) ) - return error; - + glyph_copy( in, 1, out, in->string[in->pos], i); (in->pos)++; } - - (in->max_ligID)++; } return TT_Err_Ok; @@ -1367,9 +1323,8 @@ { /* XXX "can't happen" -- but don't count on it */ - if ( ADD_String( in, 1, out, 1, &in->string[in->pos], - 0xFFFF, 0xFFFF ) ) - return error; + glyph_copy( in, 1, out, in->string[in->pos], + in->glyph_properties[in->pos].component); i++; } else if ( error ) @@ -1379,8 +1334,8 @@ { /* No substitution for this index */ - if ( ADD_String( in, 1, out, 1, &in->string[in->pos], - 0xFFFF, 0xFFFF ) ) + glyph_copy( in, 1, out, in->string[in->pos], + in->glyph_properties[in->pos].component); return error; i++; } @@ -4375,30 +4279,16 @@ EXPORT_FUNC - FT_Error TT_GSUB_String_New( FT_Memory memory, - TTO_GSUB_String **result ) + FT_Error TT_GSUB_String_New( TTO_GSUB_String **str ) { - FT_Error error; - - TTO_GSUB_String *str; - - if ( ALLOC( str, sizeof( *str ) ) ) - return error; - - str->memory = memory; - - str->length = 0; - str->allocated = 0; - str->pos = 0; - str->string = NULL; - str->properties = NULL; - str->components = NULL; - str->max_ligID = 0; - str->ligIDs = 0; - str->logClusters = 0; - - *result = str; + *str = (TTO_GSUB_String *) malloc( sizeof(TTO_GSUB_String) ); + (*str)->length = 0; + (*str)->allocated = 0; + (*str)->pos = 0; + (*str)->string = NULL; + (*str)->glyph_properties = NULL; + (*str)->character_index = NULL; return TT_Err_Ok; } @@ -4406,24 +4296,26 @@ FT_Error TT_GSUB_String_Set_Length( TTO_GSUB_String *str, FT_ULong new_length) { - FT_Memory memory = str->memory; - FT_Error error; - if ( new_length > str->allocated ) + TT_GSUB_String_Allocate( str, new_length ); + str->length = new_length; + + return TT_Err_Ok; + } + + EXPORT_DEF + FT_Error TT_GSUB_String_Allocate( TTO_GSUB_String *str, + FT_ULong alloc) { - if ( REALLOC_ARRAY( str->string, str->allocated, new_length, FT_UShort ) ) - return error; - if ( REALLOC_ARRAY( str->properties, str->allocated, new_length, FT_UShort ) ) - return error; - if ( REALLOC_ARRAY( str->components, str->allocated, new_length, FT_UShort ) ) - return error; - if ( REALLOC_ARRAY( str->ligIDs, str->allocated, new_length, FT_UShort ) ) - return error; - if ( REALLOC_ARRAY( str->logClusters, str->allocated, new_length, FT_Int ) ) - return error; + if ( alloc > str->allocated ) + { + alloc = (alloc + (1<<5)) >> 5 << 5; + str->string = (FT_UShort *) realloc(str->string, alloc*sizeof(FT_UShort)); + str->glyph_properties = (TTO_Glyph_property *) + realloc(str->glyph_properties, alloc*sizeof(TTO_Glyph_property)); + str->character_index = (FT_Int *) realloc(str->character_index, alloc*sizeof(FT_Int)); - str->allocated = new_length; - str->length = new_length; + str->allocated = alloc; } return TT_Err_Ok; @@ -4312,54 +4264,6 @@ EXPORT_FUNC - FT_Error TT_GSUB_Add_Feature( TTO_GSUBHeader* gsub, - FT_UShort feature_index, - FT_UShort property ) - { - FT_UShort i; - - TTO_Feature feature; - FT_UShort* properties; - FT_UShort* index; - - - if ( !gsub || - feature_index >= gsub->FeatureList.FeatureCount ) - return TT_Err_Invalid_Argument; - - properties = gsub->LookupList.Properties; - - feature = gsub->FeatureList.FeatureRecord[feature_index].Feature; - index = feature.LookupListIndex; - - for ( i = 0; i < feature.LookupListCount; i++ ) - properties[index[i]] |= property; - - return TT_Err_Ok; - } - - - EXPORT_FUNC - FT_Error TT_GSUB_Clear_Features( TTO_GSUBHeader* gsub ) - { - FT_UShort i; - - FT_UShort* properties; - - - if ( !gsub ) - return TT_Err_Invalid_Argument; - - properties = gsub->LookupList.Properties; - - for ( i = 0; i < gsub->LookupList.LookupCount; i++ ) - properties[i] = 0; - - return TT_Err_Ok; - } - - - EXPORT_FUNC FT_Error TT_GSUB_Register_Alternate_Function( TTO_GSUBHeader* gsub, TTO_AltFunction altfunc, void* data ) @@ -4275,35 +4229,33 @@ /* apply one lookup to the input string object */ - static FT_Error Do_String_Lookup( TTO_GSUBHeader* gsub, + static FT_Error GSub_Do_String_Lookup( TTO_GSUBHeader* gsub, FT_UShort lookup_index, + unsigned char *where_to_apply, TTO_GSUB_String* in, TTO_GSUB_String* out ) { FT_Error error = TTO_Err_Not_Covered; - FT_UShort* properties = gsub->LookupList.Properties; - FT_UShort* p_in = in->properties; FT_UShort* s_in = in->string; - int nesting_level = 0; - + const int nesting_level = 0; while ( in->pos < in->length ) { - if ( ~p_in[in->pos] & properties[lookup_index] ) + if ( where_to_apply[in->pos] ) { /* 0xFFFF indicates that we don't have a context length yet */ - error = Do_Glyph_Lookup( gsub, lookup_index, in, out, + error = GSub_Do_Glyph_Lookup( gsub, lookup_index, in, out, 0xFFFF, nesting_level ); - if ( error && error != TTO_Err_Not_Covered ) - return error; } else error = TTO_Err_Not_Covered; if ( error == TTO_Err_Not_Covered ) - if ( ADD_String( in, 1, out, 1, &s_in[in->pos], 0xFFFF, 0xFFFF ) ) + glyph_copy( in, 1, out, s_in[in->pos], + in->glyph_properties[in->pos].component); + else if ( error ) return error; } @@ -4432,125 +4324,70 @@ EXPORT_FUNC FT_Error TT_GSUB_String_Done( TTO_GSUB_String *str ) { - FT_Memory memory = str->memory; - - FREE( str->string ); - FREE( str->properties ); - FREE( str->components ); - FREE( str->ligIDs ); - FREE( str->logClusters ); + free( str->string ); + free( str->glyph_properties ); + free( str->character_index ); - FREE( str ); + free( str ); return TT_Err_Ok; } EXPORT_FUNC - FT_Error TT_GSUB_Apply_String( TTO_GSUBHeader* gsub, - TTO_GSUB_String* in, - TTO_GSUB_String* out ) + FT_Error TT_GSUB_Apply_Feature( TTO_GSUBHeader* gsub, + FT_UShort feature_index, + unsigned char *where_to_apply, + TTO_GSUB_String** str, + TTO_GSUB_String** tmp ) { FT_Error error = TTO_Err_Not_Covered; - FT_Memory memory = in->memory; FT_UShort j; - TTO_GSUB_String tmp1; - TTO_GSUB_String* ptmp1; - TTO_GSUB_String tmp2; - TTO_GSUB_String* ptmp2; TTO_GSUB_String* t; + TTO_GSUB_String *tmp1 = *str; + TTO_GSUB_String *tmp2 = *tmp; - FT_UShort* properties; - + TTO_Feature feature; + FT_UShort* index; - if ( !gsub || - !in || !out || in->length == 0 || in->pos >= in->length ) + if ( !gsub || tmp1->length == 0 || feature_index >= gsub->FeatureList.FeatureCount ) return TT_Err_Invalid_Argument; - properties = gsub->LookupList.Properties; - - tmp1.memory = memory; - tmp1.length = in->length; - tmp1.allocated = in->length; - tmp1.pos = in->pos; - tmp1.max_ligID = 1; - - if ( ALLOC_ARRAY( tmp1.string, tmp1.length, FT_UShort ) ) - return error; - MEM_Copy( tmp1.string, in->string, in->length * sizeof ( FT_UShort ) ); - - /* make sure that we always have a `properties', `components', and - `ligIDs' array in the string object */ + feature = gsub->FeatureList.FeatureRecord[feature_index].Feature; + index = feature.LookupListIndex; - if ( ALLOC_ARRAY( tmp1.components, tmp1.length, FT_UShort ) ) - return error; - if ( ALLOC_ARRAY( tmp1.ligIDs, tmp1.length, FT_UShort ) ) - return error; - if ( ALLOC_ARRAY( tmp1.properties, tmp1.length, FT_UShort ) ) - return error; - if ( in->properties ) - MEM_Copy( tmp1.properties, in->properties, - in->length * sizeof( FT_UShort ) ); - if ( ALLOC_ARRAY( tmp1.logClusters, tmp1.length, FT_Int ) ) - return error; - MEM_Copy( tmp1.logClusters, in->logClusters, - in->length * sizeof( FT_Int ) ); + TT_GSUB_String_Allocate( tmp1, 3*tmp1->length+1 ); + TT_GSUB_String_Allocate( tmp2, 3*tmp1->length+1 ); - tmp2.memory = memory; - tmp2.allocated = 0; - tmp2.pos = 0; - tmp2.string = NULL; - tmp2.properties = NULL; - tmp2.components = NULL; - tmp2.ligIDs = NULL; - tmp2.logClusters = NULL; + tmp1->pos = 0; + tmp2->pos = 0; - ptmp1 = &tmp1; - ptmp2 = &tmp2; + //###### need to order lookups in the order they appear in the + //###### lookup list, not the order they appear in the + //###### featurelist. - for ( j = 0; j < gsub->LookupList.LookupCount; j++ ) - if ( properties[j] ) - { - error = Do_String_Lookup( gsub, j, ptmp1, ptmp2 ); + for ( j = 0; j < feature.LookupListCount; j++ ) { + error = GSub_Do_String_Lookup( gsub, index[j], where_to_apply, tmp1, tmp2 ); if ( error && error != TTO_Err_Not_Covered ) return error; /* flipping `in' and `out', preparing the next loop */ - ptmp1->pos = in->pos; - ptmp2->length = ptmp2->pos; - ptmp2->pos = in->pos; - ptmp2->max_ligID = ptmp1->max_ligID; - - t = ptmp2; - ptmp2 = ptmp1; - ptmp1 = t; - } - - out->length = ptmp1->length; - out->pos = 0; - out->allocated = ptmp1->allocated; - out->string = ptmp1->string; - out->components = ptmp1->components; - out->ligIDs = ptmp1->ligIDs; - out->logClusters = ptmp1->logClusters; + tmp1->pos = 0; + tmp2->length = tmp2->pos; + tmp2->pos = 0; - if ( in->properties ) - out->properties = ptmp1->properties; - else - { - FREE( ptmp1->properties ); - out->properties = NULL; + t = tmp2; + tmp2 = tmp1; + tmp1 = t; } - FREE( ptmp2->string ); - FREE( ptmp2->properties ); - FREE( ptmp2->components ); - FREE( ptmp2->ligIDs ); - FREE( ptmp2->logClusters ); + *str = tmp1; + (*str)->pos = 0; + + *tmp = tmp2; return error; } - /* END */ diff -uprw /home/otaylor/cvs/gnome2/pango-head/pango/opentype/ftxgsub.h ./opentype-munge/ftxgsub.h --- /home/otaylor/cvs/gnome2/pango-head/pango/opentype/ftxgsub.h 2000-12-19 23:41:36.000000000 -0500 +++ ./opentype-munge/ftxgsub.h 2003-07-25 12:55:55.000000000 -0400 @@ -478,6 +478,12 @@ extern "C" { typedef union TTO_GSUB_SubTable_ TTO_GSUB_SubTable; + struct TTO_Glyph_property_ { + unsigned char type : 3; + unsigned char component :5; + }; + typedef struct TTO_Glyph_property_ TTO_Glyph_property; +#define MAX_COMPONENT_INDEX = 0x1f; /* A simple string object. It can both `send' and `receive' data. In case of sending, `length' and `pos' will be used. In case of @@ -503,19 +509,15 @@ extern "C" { TT_Add_String() will also handle allocation; you should use free() in case you want to destroy the arrays in the object. */ + struct TTO_GSUB_String_ { - FT_Memory memory; - FT_ULong length; FT_ULong pos; FT_ULong allocated; FT_UShort* string; - FT_UShort* properties; - FT_UShort* components; - FT_UShort max_ligID; - FT_UShort* ligIDs; - FT_Int* logClusters; + TTO_Glyph_property* glyph_properties; + FT_Int* character_index; }; typedef struct TTO_GSUB_String_ TTO_GSUB_String; @@ -565,33 +567,32 @@ extern "C" { FT_ULong** feature_tag_list ); EXPORT_DEF - FT_Error TT_GSUB_Add_Feature( TTO_GSUBHeader* gsub, - FT_UShort feature_index, - FT_UShort property ); - EXPORT_DEF - FT_Error TT_GSUB_Clear_Features( TTO_GSUBHeader* gsub ); - - EXPORT_DEF FT_Error TT_GSUB_Register_Alternate_Function( TTO_GSUBHeader* gsub, TTO_AltFunction altfunc, void* data ); EXPORT_DEF - FT_Error TT_GSUB_String_New( FT_Memory memory, - TTO_GSUB_String **result ); + FT_Error TT_GSUB_String_New( TTO_GSUB_String **result ); EXPORT_DEF FT_Error TT_GSUB_String_Set_Length( TTO_GSUB_String *str, FT_ULong new_length); EXPORT_DEF + FT_Error TT_GSUB_String_Allocate( TTO_GSUB_String *str, + FT_ULong alloc); + + EXPORT_DEF FT_Error TT_GSUB_String_Done( TTO_GSUB_String *str ); EXPORT_DEF - FT_Error TT_GSUB_Apply_String( TTO_GSUBHeader* gsub, - TTO_GSUB_String* in, - TTO_GSUB_String* out ); + FT_Error TT_GSUB_Apply_Feature( TTO_GSUBHeader* gsub, + FT_UShort feature_index, + unsigned char *where_to_apply, + TTO_GSUB_String** str, + TTO_GSUB_String** tmp); + EXPORT_DEF FT_Error TT_GSUB_Add_String( TTO_GSUB_String* in, @@ -599,8 +600,7 @@ extern "C" { TTO_GSUB_String* out, FT_UShort num_out, FT_UShort* glyph_data, - FT_UShort component, - FT_UShort ligID ); + FT_UShort component); #ifdef __cplusplus } diff -uprw /home/otaylor/cvs/gnome2/pango-head/pango/opentype/ftxopen.c ./opentype-munge/ftxopen.c --- /home/otaylor/cvs/gnome2/pango-head/pango/opentype/ftxopen.c 2003-07-25 12:59:44.000000000 -0400 +++ ./opentype-munge/ftxopen.c 2003-07-25 12:55:55.000000000 -0400 @@ -667,15 +670,13 @@ if ( ALLOC_ARRAY( ll->Lookup, count, TTO_Lookup ) ) return error; - if ( ALLOC_ARRAY( ll->Properties, count, FT_UShort ) ) - goto Fail2; l = ll->Lookup; for ( n = 0; n < count; n++ ) { if ( ACCESS_Frame( 2L ) ) - goto Fail1; + goto Fail; new_offset = GET_UShort() + base_offset; @@ -684,19 +685,17 @@ cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || ( error = Load_Lookup( &l[n], stream, type ) ) != TT_Err_Ok ) - goto Fail1; + goto Fail; (void)FILE_Seek( cur_offset ); } return TT_Err_Ok; - Fail1: - FREE( ll->Properties ); + Fail: for ( m = 0; m < n; m++ ) Free_Lookup( &l[m], type, memory ); - Fail2: FREE( ll->Lookup ); return error; } @@ -711,8 +710,6 @@ TTO_Lookup* l; - FREE( ll->Properties ); - if ( ll->Lookup ) { count = ll->LookupCount; diff -uprw /home/otaylor/cvs/gnome2/pango-head/pango/opentype/ftxopen.h ./opentype-munge/ftxopen.h --- /home/otaylor/cvs/gnome2/pango-head/pango/opentype/ftxopen.h 2003-07-25 12:59:44.000000000 -0400 +++ ./opentype-munge/ftxopen.h 2003-07-25 12:55:55.000000000 -0400 @@ -148,7 +152,6 @@ extern "C" { { FT_UShort LookupCount; /* number of Lookups */ TTO_Lookup* Lookup; /* array of Lookup records */ - FT_UShort* Properties; /* array of flags */ }; typedef struct TTO_LookupList_ TTO_LookupList;