From a63dbbbeeb91ebf4ded2fc788f5810a3bd1e14fe Mon Sep 17 00:00:00 2001 From: Eric Mader Date: Tue, 7 May 2002 20:39:14 +0000 Subject: [PATCH] Add modules modules/indic/indic-xft.c, indic-ot.c, indic-ot.h, Mon May 06 15:07:39 2002 Eric Mader * Add modules modules/indic/indic-xft.c, indic-ot.c, indic-ot.h, indic-ot-class-tables.c * pango/opentype/ftxgdef.c: Compute full offset for mark attachment class table * pango/opentype/ftxgpos.c: Only return TTO_Err_Not_Covered if nothing matches * pango/opentype/pango-ot-ruleset.c: enable GPOS processing --- src/ftxgdef.c | 10 ++++++++-- src/ftxgpos.c | 33 ++++++++++++++------------------- src/pango-ot-ruleset.c | 35 ++++++++++++++++++++++++++++++++++- 3 files changed, 56 insertions(+), 22 deletions(-) diff --git a/src/ftxgdef.c b/src/ftxgdef.c index 6456f18ef..e3aaf92bf 100644 --- a/src/ftxgdef.c +++ b/src/ftxgdef.c @@ -230,9 +230,15 @@ /* OpenType 1.2 has introduced the `MarkAttachClassDef' field. We first have to scan the LookupFlag values to find out whether we - must load it or not. Here we only store the current file offset. */ + must load it or not. Here we only store the offset of the table. */ + + new_offset = GET_UShort(); + + if ( new_offset ) + gdef->MarkAttachClassDef_offset = new_offset + base_offset; + else + gdef->MarkAttachClassDef_offset = 0; - gdef->MarkAttachClassDef_offset = FILE_Pos(); gdef->MarkAttachClassDef.loaded = FALSE; gdef->LastGlyph = 0; diff --git a/src/ftxgpos.c b/src/ftxgpos.c index 012e82d8c..f9ba16795 100644 --- a/src/ftxgpos.c +++ b/src/ftxgpos.c @@ -267,19 +267,6 @@ if ( lo[i].LookupFlag & IGNORE_SPECIAL_MARKS ) { if ( FILE_Seek( gdef->MarkAttachClassDef_offset ) || - ACCESS_Frame( 2L ) ) - goto Fail1; - - new_offset = GET_UShort(); - - FORGET_Frame(); - - if ( !new_offset ) - return TTO_Err_Invalid_GDEF_SubTable; - - new_offset += base_offset; - - if ( FILE_Seek( new_offset ) || ( error = Load_ClassDefinition( &gdef->MarkAttachClassDef, 256, stream ) ) != TT_Err_Ok ) goto Fail1; @@ -2409,6 +2396,7 @@ &x_mark_value, &y_mark_value ); if ( error ) return error; + error = Get_Anchor( gpi, base_anchor, in->string[j], &x_base_value, &y_base_value ); if ( error ) @@ -6116,7 +6104,7 @@ TTO_GSUB_String* in, TTO_GPOS_Data* out ) { - FT_Error error = TTO_Err_Not_Covered; + FT_Error error, retError = TTO_Err_Not_Covered; TTO_GPOSHeader* gpos = gpi->gpos; FT_UShort* properties = gpos->LookupList.Properties; @@ -6158,9 +6146,11 @@ if ( error == TTO_Err_Not_Covered ) (in->pos)++; + else + retError = error; } - return error; + return retError; } @@ -6253,7 +6243,7 @@ FT_Bool r2l ) { FT_Memory memory = gpos->memory; - FT_Error error = TTO_Err_Not_Covered; + FT_Error error, retError = TTO_Err_Not_Covered; GPOS_Instance gpi; FT_UShort j; @@ -6282,11 +6272,16 @@ if ( !properties || properties[j] ) { error = Do_String_Lookup( &gpi, j, in, *out ); - if ( error && error != TTO_Err_Not_Covered ) - return error; + if ( error ) + { + if ( error != TTO_Err_Not_Covered ) + return error; + } + else + retError = error; } - return error; + return retError; } /* END */ diff --git a/src/pango-ot-ruleset.c b/src/pango-ot-ruleset.c index 666e6d0b0..d392cc847 100644 --- a/src/pango-ot-ruleset.c +++ b/src/pango-ot-ruleset.c @@ -24,6 +24,9 @@ #include #include "pango-ot-private.h" +#define PANGO_SCALE_26_6 (PANGO_SCALE / (1<<6)) +#define PANGO_UNITS_26_6(d) (PANGO_SCALE_26_6 * (d)) + typedef struct _PangoOTRule PangoOTRule; struct _PangoOTRule @@ -233,7 +236,37 @@ pango_ot_ruleset_shape (PangoOTRuleset *ruleset, } else result_string = in_string; - + + if (gpos) + { + TTO_GPOS_Data *outgpos = NULL; + + if (!TT_GPOS_Apply_String (ruleset->info->face, gpos, 0, result_string, &outgpos, + FALSE /* enable device-dependant values */, + FALSE /* Even though this might be r2l text, RTL is handled elsewhere */)) + { + for (i = 0; i < result_string->length; i++) + { + int j; + + glyphs->glyphs[i].geometry.x_offset += PANGO_UNITS_26_6 (outgpos[i].x_pos); + glyphs->glyphs[i].geometry.y_offset += PANGO_UNITS_26_6 (outgpos[i].y_pos); + + for (j = i - outgpos[i].back; j < i; j++) + glyphs->glyphs[i].geometry.x_offset -= glyphs->glyphs[j].geometry.width; + + if (outgpos[i].new_advance) + /* Can't set new x offset for marks, so just make sure not to increase it. + Can do better than this by playing with ->x_offset. */ + glyphs->glyphs[i].geometry.width = 0; + else + glyphs->glyphs[i].geometry.width += PANGO_UNITS_26_6(outgpos[i].x_advance); + } + + FT_Free(gpos->memory, (void *)outgpos); + } + } + pango_glyph_string_set_size (glyphs, result_string->length); last_cluster = -1;