From 6f74f18b77402f3adf5bfbae26e8f44de6543b4e Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Sat, 26 Jul 2003 03:03:40 +0000 Subject: [PATCH] Add GPOS_LOOKUP_EXTENSION, GSUB_LOOKUP_EXTENSION, which allow lookup Fri Jul 25 22:59:13 2003 Owen Taylor * pango/opentype/ftx{gpos,gsub}.h pango/opentype/ftxgdef.c: Add GPOS_LOOKUP_EXTENSION, GSUB_LOOKUP_EXTENSION, which allow lookup information to be stored at 32-bit offets via a double indirection. (From FreeType, Werner Lemberg, 2001-08-08) --- src/ftxgpos.h | 17 +++++++++-------- src/ftxgsub.h | 1 + src/ftxopen.c | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/ftxgpos.h b/src/ftxgpos.h index 56ffb7852..408bcb0ae 100644 --- a/src/ftxgpos.h +++ b/src/ftxgpos.h @@ -32,14 +32,15 @@ extern "C" { /* Lookup types for glyph positioning */ -#define GPOS_LOOKUP_SINGLE 1 -#define GPOS_LOOKUP_PAIR 2 -#define GPOS_LOOKUP_CURSIVE 3 -#define GPOS_LOOKUP_MARKBASE 4 -#define GPOS_LOOKUP_MARKLIG 5 -#define GPOS_LOOKUP_MARKMARK 6 -#define GPOS_LOOKUP_CONTEXT 7 -#define GPOS_LOOKUP_CHAIN 8 +#define GPOS_LOOKUP_SINGLE 1 +#define GPOS_LOOKUP_PAIR 2 +#define GPOS_LOOKUP_CURSIVE 3 +#define GPOS_LOOKUP_MARKBASE 4 +#define GPOS_LOOKUP_MARKLIG 5 +#define GPOS_LOOKUP_MARKMARK 6 +#define GPOS_LOOKUP_CONTEXT 7 +#define GPOS_LOOKUP_CHAIN 8 +#define GPOS_LOOKUP_EXTENSION 9 /* A pointer to a function which loads a glyph. Its parameters are diff --git a/src/ftxgsub.h b/src/ftxgsub.h index 3f4f8adac..8951e4413 100644 --- a/src/ftxgsub.h +++ b/src/ftxgsub.h @@ -38,6 +38,7 @@ extern "C" { #define GSUB_LOOKUP_LIGATURE 4 #define GSUB_LOOKUP_CONTEXT 5 #define GSUB_LOOKUP_CHAIN 6 +#define GSUB_LOOKUP_EXTENSION 7 /* Use this if a feature applies to all glyphs */ diff --git a/src/ftxopen.c b/src/ftxopen.c index ba605bd74..5d9cfad31 100644 --- a/src/ftxopen.c +++ b/src/ftxopen.c @@ -584,6 +584,8 @@ TTO_SubTable* st; + Bool is_extension = FALSE; + base_offset = FILE_Pos(); @@ -603,6 +605,10 @@ st = l->SubTable; + if ( ( type == GSUB && l->LookupType == GSUB_LOOKUP_EXTENSION ) || + ( type == GPOS && l->LookupType == GPOS_LOOKUP_EXTENSION ) ) + is_extension = TRUE; + for ( n = 0; n < count; n++ ) { if ( ACCESS_Frame( 2L ) ) @@ -613,6 +619,19 @@ FORGET_Frame(); cur_offset = FILE_Pos(); + + if ( is_extension ) + { + if ( FILE_Seek( new_offset ) || ACCESS_Frame( 8L ) ) + goto Fail; + + (void)GET_UShort(); /* format should be 1 */ + l->LookupType = GET_UShort(); + new_offset = GET_ULong() + base_offset; + + FORGET_Frame(); + } + if ( FILE_Seek( new_offset ) || ( error = Load_SubTable( &st[n], stream, type, l->LookupType ) ) != TT_Err_Ok )