diff options
author | Owen Taylor <otaylor@redhat.com> | 2005-07-22 17:56:37 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2005-07-22 17:56:37 +0000 |
commit | 254e90a4e6d88a49f652a58608228e8ae9606960 (patch) | |
tree | ae57b515aa8896d4e9af73577ce10105d7aeecc9 | |
parent | 1c0631c8f9d56f4ba146edbe5b908741a5f7fab3 (diff) | |
download | pango-254e90a4e6d88a49f652a58608228e8ae9606960.tar.gz |
Patch from David Turner. Review and testing by Behdad Esfahbod
2005-07-22 Owen Taylor <otaylor@redhat.com>
Patch from David Turner. Review and testing by Behdad Esfahbod
* pango/opentype/ftglue.[ch] Makefile.am: Glue layer that provides
implementation of the internal functions that the opentype code
expects in terms of publically exported FreeType API.
* pango/opentype/ftxgdef.c pango/opentype/ftxgpos.c
pango/opentype/ftxgsub.c pango/opentype/ftxopen.c
pango/opentype/otlbuffer.c pango/opentype/pango-ot-info.c
pango/opentype/pango-ot-ruleset.c: Remove includes of
internal headers. Small changes to work with ftglue.[ch]
* pango/opentype/fterrcompat.h: Remove: no longer needed.
* pango/opentype/ftxgpos.c: Use FT_IS_SFNT(face) rather
than poking at FT_MODULE_CLASS (face->driver)->module_name.
* pango/opentype/ftxopen.c (Free_FeatureList): Free
fl->ApplyOrder. (Found by Behdad)
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | ChangeLog.pre-1-10 | 22 | ||||
-rw-r--r-- | pango/opentype/Makefile.am | 3 | ||||
-rw-r--r-- | pango/opentype/fterrcompat.h | 95 | ||||
-rw-r--r-- | pango/opentype/ftglue.c | 350 | ||||
-rw-r--r-- | pango/opentype/ftglue.h | 156 | ||||
-rw-r--r-- | pango/opentype/ftxgdef.c | 9 | ||||
-rw-r--r-- | pango/opentype/ftxgpos.c | 9 | ||||
-rw-r--r-- | pango/opentype/ftxgsub.c | 10 | ||||
-rw-r--r-- | pango/opentype/ftxopen.c | 8 | ||||
-rw-r--r-- | pango/opentype/otlbuffer.c | 4 | ||||
-rw-r--r-- | pango/opentype/pango-ot-info.c | 6 | ||||
-rw-r--r-- | pango/opentype/pango-ot-ruleset.c | 2 |
13 files changed, 564 insertions, 132 deletions
@@ -1,3 +1,25 @@ +2005-07-22 Owen Taylor <otaylor@redhat.com> + + Patch from David Turner. Review and testing by Behdad Esfahbod + + * pango/opentype/ftglue.[ch] Makefile.am: Glue layer that provides + implementation of the internal functions that the opentype code + expects in terms of publically exported FreeType API. + + * pango/opentype/ftxgdef.c pango/opentype/ftxgpos.c + pango/opentype/ftxgsub.c pango/opentype/ftxopen.c + pango/opentype/otlbuffer.c pango/opentype/pango-ot-info.c + pango/opentype/pango-ot-ruleset.c: Remove includes of + internal headers. Small changes to work with ftglue.[ch] + + * pango/opentype/fterrcompat.h: Remove: no longer needed. + + * pango/opentype/ftxgpos.c: Use FT_IS_SFNT(face) rather + than poking at FT_MODULE_CLASS (face->driver)->module_name. + + * pango/opentype/ftxopen.c (Free_FeatureList): Free + fl->ApplyOrder. (Found by Behdad) + 2005-07-21 Manish Singh <yosh@gimp.org> * pango/pangofc-fontmap.c (fontset_hash_key_hash, font_hash_key_hash): diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index 6924d524..8b1a971d 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,25 @@ +2005-07-22 Owen Taylor <otaylor@redhat.com> + + Patch from David Turner. Review and testing by Behdad Esfahbod + + * pango/opentype/ftglue.[ch] Makefile.am: Glue layer that provides + implementation of the internal functions that the opentype code + expects in terms of publically exported FreeType API. + + * pango/opentype/ftxgdef.c pango/opentype/ftxgpos.c + pango/opentype/ftxgsub.c pango/opentype/ftxopen.c + pango/opentype/otlbuffer.c pango/opentype/pango-ot-info.c + pango/opentype/pango-ot-ruleset.c: Remove includes of + internal headers. Small changes to work with ftglue.[ch] + + * pango/opentype/fterrcompat.h: Remove: no longer needed. + + * pango/opentype/ftxgpos.c: Use FT_IS_SFNT(face) rather + than poking at FT_MODULE_CLASS (face->driver)->module_name. + + * pango/opentype/ftxopen.c (Free_FeatureList): Free + fl->ApplyOrder. (Found by Behdad) + 2005-07-21 Manish Singh <yosh@gimp.org> * pango/pangofc-fontmap.c (fontset_hash_key_hash, font_hash_key_hash): diff --git a/pango/opentype/Makefile.am b/pango/opentype/Makefile.am index 84c03bf5..ca9d294e 100644 --- a/pango/opentype/Makefile.am +++ b/pango/opentype/Makefile.am @@ -15,7 +15,8 @@ INCLUDES = \ noinst_LTLIBRARIES = libpango-ot.la libpango_ot_la_SOURCES = \ - fterrcompat.h \ + ftglue.h \ + ftglue.c \ ftxopen.c \ ftxopen.h \ ftxopenf.h \ diff --git a/pango/opentype/fterrcompat.h b/pango/opentype/fterrcompat.h deleted file mode 100644 index 2c4d2caf..00000000 --- a/pango/opentype/fterrcompat.h +++ /dev/null @@ -1,95 +0,0 @@ -/* Pango - * fterrcompat.h: Compat defines for compiling with newer versions - * of FreeType - * - * Copyright © 2003 Red Hat, Inc - * - * The code is dual-licensed under the GNU Public License and the - * FreeType license. See see FT-license.txt for full details. - */ -#ifndef FTERRCOMPAT_H -#define FTERRCOMPAT_H - -#include <config.h> - -#define TT_Err_Ok FT_Err_Ok -#define TT_Err_Invalid_Argument FT_Err_Invalid_Argument -#define TT_Err_Invalid_Face_Handle FT_Err_Invalid_Face_Handle -#define TT_Err_Table_Missing FT_Err_Table_Missing - -/* Compat macros for name changes in FreeType 2.1.0 - */ -#if (FREETYPE_MAJOR == 2) && (FREETYPE_MINOR >= 1) - -#define FILE_Pos() FT_STREAM_POS() -#define FILE_Seek( position ) FT_STREAM_SEEK( position) - -#define ACCESS_Frame( size ) FT_FRAME_ENTER( size ) -#define FORGET_Frame() FT_FRAME_EXIT() - -#define GET_Char() FT_GET_CHAR() -#define GET_Byte() FT_GET_BYTE() -#define GET_Short() FT_GET_SHORT() -#define GET_UShort() FT_GET_USHORT() -#define GET_Offset() FT_GET_OFF3() -#define GET_UOffset() FT_GET_UOFF3() -#define GET_Long() FT_GET_LONG() -#define GET_ULong() FT_GET_ULONG() -#define GET_Tag4() FT_GET_TAG4() - -/* Macro definitions to avoid bogus warnings about strict - * aliasing. These make code generation worse, so we only - * use them when necessary - */ -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) -#define ALLOC_ARRAY( _pointer_, _count_, _type_ ) ({ \ - int result; \ - void *_tmp_; \ - result = FT_SET_ERROR ( FT_MEM_ALLOC_ARRAY ( _tmp_, \ - _count_, \ - _type_ ) ); \ - _pointer_ = _tmp_; \ - result; \ -}) - -/* FT_MEM_REALLOC macro broken in 2.1.0 */ -#define REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) ({ \ - int result; \ - void *_tmp_ = _pointer_; \ - result = FT_SET_ERROR ( FT_MEM_REALLOC( _tmp_, \ - (_old_) * sizeof ( _type_ ), \ - (_new_) * sizeof ( _type_ ) ) ); \ - _pointer_ = _tmp_; \ - result; \ -}) - -#define FREE( _pointer_ ) ({ \ - void *_tmp_ = _pointer_; \ - FT_FREE ( _tmp_ ); \ - _pointer_ = _tmp_; \ -}) -#define ALLOC( _pointer_, _size_ ) ({ \ - int result; \ - void *_tmp_; \ - result = FT_ALLOC( _tmp_, _size_ ); \ - _pointer_ = _tmp_; \ - result; \ -}) -#else -#define ALLOC_ARRAY( _pointer_, _count_, _type_ ) \ - FT_SET_ERROR (FT_MEM_ALLOC_ARRAY( _pointer_, _count_, _type_)) - -/* FT_MEM_REALLOC macro broken in 2.1.0 */ -#define REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) \ - FT_SET_ERROR ( FT_MEM_REALLOC( _pointer_, (_old_) * sizeof ( _type_ ), \ - (_new_) * sizeof ( _type_ ) ) ) - -#define FREE( _pointer_ ) FT_FREE( _pointer_ ) -#define ALLOC( _pointer_, _size_ ) FT_ALLOC( _pointer_, _size_ ) -#endif /* gcc >= 3.3 */ - -#define MEM_Copy( dest, source, count ) FT_MEM_COPY( dest, source, count ) - -#endif /* freetype >= 2.1.0 */ - -#endif /* FTERRCOMPAT_H */ diff --git a/pango/opentype/ftglue.c b/pango/opentype/ftglue.c new file mode 100644 index 00000000..3ffedeb9 --- /dev/null +++ b/pango/opentype/ftglue.c @@ -0,0 +1,350 @@ +/* ftglue.c: Glue code for compiling the OpenType code from + * FreeType 1 using only the public API of FreeType 2 + * + * By David Turner, The FreeType Project (www.freetype.org) + * + * This code is explicitely put in the public domain + * + * See ftglue.h for more information. + */ + +#include "ftglue.h" + +#if 0 +#include <stdio.h> +#define LOG(x) ftglue_log x + +static void +ftglue_log( const char* format, ... ) +{ + va_list ap; + + va_start( ap, format ); + vfprintf( stderr, format, ap ); + va_end( ap ); +} + +#else +#define LOG(x) do {} while (0) +#endif + +/* only used internally */ +static FT_Pointer +ftglue_qalloc( FT_Memory memory, + FT_ULong size, + FT_Error *perror ) +{ + FT_Error error = 0; + FT_Pointer block = NULL; + + if ( size > 0 ) + { + block = memory->alloc( memory, size ); + if ( !block ) + error = FT_Err_Out_Of_Memory; + } + + *perror = error; + return block; +} + +#undef QALLOC /* just in case */ +#define QALLOC(ptr,size) ( (ptr) = ftglue_qalloc( memory, (size), &error ), error != 0 ) + + +FTGLUE_APIDEF( FT_Pointer ) +ftglue_alloc( FT_Memory memory, + FT_ULong size, + FT_Error *perror ) +{ + FT_Error error = 0; + FT_Pointer block = NULL; + + if ( size > 0 ) + { + block = memory->alloc( memory, size ); + if ( !block ) + error = FT_Err_Out_Of_Memory; + else + memset( (char*)block, 0, (size_t)size ); + } + + *perror = error; + return block; +} + + +FTGLUE_APIDEF( FT_Pointer ) +ftglue_realloc( FT_Memory memory, + FT_Pointer block, + FT_ULong old_size, + FT_ULong new_size, + FT_Error *perror ) +{ + FT_Pointer block2 = NULL; + FT_Error error = 0; + + if ( old_size == 0 || block == NULL ) + { + block2 = ftglue_alloc( memory, new_size, &error ); + } + else if ( new_size == 0 ) + { + ftglue_free( memory, block ); + block2 = NULL; + } + else + { + block2 = memory->realloc( memory, old_size, new_size, block ); + if ( block2 == NULL ) + error = FT_Err_Out_Of_Memory; + else if ( new_size > old_size ) + memset( (char*)block2 + old_size, 0, (size_t)(new_size - old_size) ); + } + + if ( !error ) + block = block2; + + *perror = error; + return block; +} + + +FTGLUE_APIDEF( void ) +ftglue_free( FT_Memory memory, + FT_Pointer block ) +{ + if ( block ) + memory->free( memory, block ); +} + + +FTGLUE_APIDEF( FT_Long ) +ftglue_stream_pos( FT_Stream stream ) +{ + LOG(( "ftglue:stream:pos() -> %ld\n", stream->pos )); + return stream->pos; +} + + +FTGLUE_APIDEF( FT_Error ) +ftglue_stream_seek( FT_Stream stream, + FT_Long pos ) +{ + FT_Error error = 0; + + stream->pos = pos; + if ( stream->read ) + { + if ( stream->read( stream, pos, 0, 0 ) ) + error = FT_Err_Invalid_Stream_Operation; + } + else if ( pos > stream->size ) + error = FT_Err_Invalid_Stream_Operation; + + LOG(( "ftglue:stream:seek(%ld) -> %d\n", pos, error )); + return error; +} + + +FTGLUE_APIDEF( FT_Error ) +ftglue_stream_frame_enter( FT_Stream stream, + FT_ULong count ) +{ + FT_Error error = FT_Err_Ok; + FT_ULong read_bytes; + + if ( stream->read ) + { + /* allocate the frame in memory */ + FT_Memory memory = stream->memory; + + + if ( QALLOC( stream->base, count ) ) + goto Exit; + + /* read it */ + read_bytes = stream->read( stream, stream->pos, + stream->base, count ); + if ( read_bytes < count ) + { + FREE( stream->base ); + error = FT_Err_Invalid_Stream_Operation; + } + stream->cursor = stream->base; + stream->limit = stream->cursor + count; + stream->pos += read_bytes; + } + else + { + /* check current and new position */ + if ( stream->pos >= stream->size || + stream->pos + count > stream->size ) + { + error = FT_Err_Invalid_Stream_Operation; + goto Exit; + } + + /* set cursor */ + stream->cursor = stream->base + stream->pos; + stream->limit = stream->cursor + count; + stream->pos += count; + } + +Exit: + LOG(( "ftglue:stream:frame_enter(%ld) -> %d\n", count, error )); + return error; +} + + +FTGLUE_APIDEF( void ) +ftglue_stream_frame_exit( FT_Stream stream ) +{ + if ( stream->read ) + { + FT_Memory memory = stream->memory; + + FREE( stream->base ); + } + stream->cursor = 0; + stream->limit = 0; + + LOG(( "ftglue:stream:frame_exit()\n" )); +} + + +FTGLUE_APIDEF( FT_Byte ) +ftglue_stream_get_byte( FT_Stream stream ) +{ + FT_Byte result = 0; + + if ( stream->cursor < stream->limit ) + result = *stream->cursor++; + + return result; +} + + +FTGLUE_APIDEF( FT_Short ) +ftglue_stream_get_short( FT_Stream stream ) +{ + FT_Byte* p; + FT_Short result = 0; + + p = stream->cursor; + if ( p + 2 <= stream->limit ) + { + result = (FT_Short)((p[0] << 8) | p[1]); + stream->cursor = p+2; + } + return result; +} + + +FTGLUE_APIDEF( FT_Long ) +ftglue_stream_get_long( FT_Stream stream ) +{ + FT_Byte* p; + FT_Long result = 0; + + p = stream->cursor; + if ( p + 4 <= stream->limit ) + { + result = (FT_Long)(((FT_Long)p[0] << 24) | + ((FT_Long)p[1] << 16) | + ((FT_Long)p[2] << 8) | + p[3] ); + stream->cursor = p+4; + } + return result; +} + + +FTGLUE_APIDEF( FT_Error ) +ftglue_face_goto_table( FT_Face face, + FT_ULong the_tag, + FT_Stream stream ) +{ + FT_Error error; + + LOG(( "ftglue_face_goto_table( %p, %c%c%c%c, %p )\n", + face, + (int)((the_tag >> 24) & 0xFF), + (int)((the_tag >> 16) & 0xFF), + (int)((the_tag >> 8) & 0xFF), + (int)(the_tag & 0xFF), + stream )); + + if ( !FT_IS_SFNT(face) ) + { + LOG(( "not a SFNT face !!\n" )); + error = FT_Err_Invalid_Face_Handle; + } + else + { + /* parse the directory table directly, without using + * FreeType's built-in data structures + */ + FT_ULong offset = 0; + FT_UInt count, nn; + + if ( face->num_faces > 1 ) + { + /* deal with TrueType collections */ + FT_ULong offset; + + LOG(( ">> This is a TrueType Collection\n" )); + + if ( FILE_Seek( 12 + face->face_index*4 ) || + ACCESS_Frame( 4 ) ) + goto Exit; + + offset = GET_ULong(); + + FORGET_Frame(); + } + + LOG(( "TrueType offset = %ld\n", offset )); + + if ( FILE_Seek( offset+4 ) || + ACCESS_Frame( 2 ) ) + goto Exit; + + count = GET_UShort(); + + FORGET_Frame(); + + if ( FILE_Seek( offset+12 ) || + ACCESS_Frame( count*16 ) ) + goto Exit; + + for ( nn = 0; nn < count; nn++ ) + { + FT_ULong tag = GET_ULong(); + FT_ULong checksum = GET_ULong(); + FT_ULong start = GET_ULong(); + FT_ULong size = GET_ULong(); + + FT_UNUSED(checksum); + FT_UNUSED(size); + + if ( tag == the_tag ) + { + LOG(( "TrueType table (start: %ld) (size: %ld)\n", start, size )); + error = ftglue_stream_seek( stream, offset+start ); + goto FoundIt; + } + } + error = TT_Err_Table_Missing; + + FoundIt: + FORGET_Frame(); + } + +Exit: + LOG(( "TrueType error=%d\n", error )); + + return error; +} + +#undef QALLOC diff --git a/pango/opentype/ftglue.h b/pango/opentype/ftglue.h new file mode 100644 index 00000000..cc780fe6 --- /dev/null +++ b/pango/opentype/ftglue.h @@ -0,0 +1,156 @@ +/* ftglue.c: Glue code for compiling the OpenType code from + * FreeType 1 using only the public API of FreeType 2 + * + * By David Turner, The FreeType Project (www.freetype.org) + * + * This code is explicitely put in the public domain + * + * ========================================================================== + * + * the OpenType parser codes was originally written as an extension to + * FreeType 1.x. As such, its source code was embedded within the library, + * and used many internal FreeType functions to deal with memory and + * stream i/o. + * + * When it was 'salvaged' for Pango and Qt, the code was "ported" to FreeType 2, + * which basically means that some macro tricks were performed in order to + * directly access FT2 _internal_ functions. + * + * these functions were never part of FT2 public API, and _did_ change between + * various releases. This created chaos for many users: when they upgraded the + * FreeType library on their system, they couldn't run Gnome anymore since + * Pango refused to link. + * + * Very fortunately, it's possible to completely avoid this problem because + * the FT_StreamRec and FT_MemoryRec structure types, which describe how + * memory and stream implementations interface with the rest of the font + * library, have always been part of the public API, and never changed. + * + * What we do thus is re-implement, within the OpenType parser, the few + * functions that depend on them. This only adds one or two kilobytes of + * code, and ensures that the parser can work with _any_ version + * of FreeType installed on your system. How sweet... ! + * + * Note that we assume that Pango doesn't use any other internal functions + * from FreeType. It used to in old versions, but this should no longer + * be the case. (crossing my fingers). + * + * - David Turner + * - The FreeType Project (www.freetype.org) + * + * PS: This "glue" code is explicitely put in the public domain + */ +#ifndef __OPENTYPE_FTGLUE_H__ +#define __OPENTYPE_FTGLUE_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +FT_BEGIN_HEADER + + +/* utility macros */ +#define TT_Err_Ok FT_Err_Ok +#define TT_Err_Invalid_Argument FT_Err_Invalid_Argument +#define TT_Err_Invalid_Face_Handle FT_Err_Invalid_Face_Handle +#define TT_Err_Table_Missing FT_Err_Table_Missing + +#define SET_ERR(c) ( (error = (c)) != 0 ) + +#ifndef FTGLUE_API +#define FTGLUE_API(x) extern x +#endif + +#ifndef FTGLUE_APIDEF +#define FTGLUE_APIDEF(x) x +#endif + +/* stream macros used by the OpenType parser */ +#define FILE_Pos() ftglue_stream_pos( stream ) +#define FILE_Seek(pos) SET_ERR( ftglue_stream_seek( stream, pos ) ) +#define ACCESS_Frame(size) SET_ERR( ftglue_stream_frame_enter( stream, size ) ) +#define FORGET_Frame() ftglue_stream_frame_exit( stream ) + +#define GET_Byte() ftglue_stream_get_byte( stream ) +#define GET_Short() ftglue_stream_get_short( stream ) +#define GET_Long() ftglue_stream_get_long( stream ) + +#define GET_Char() ((FT_Char)GET_Byte()) +#define GET_UShort() ((FT_UShort)GET_Short()) +#define GET_ULong() ((FT_ULong)GET_Long()) +#define GET_Tag4() GET_ULong() + +FTGLUE_API( FT_Long ) +ftglue_stream_pos( FT_Stream stream ); + +FTGLUE_API( FT_Error ) +ftglue_stream_seek( FT_Stream stream, + FT_Long pos ); + +FTGLUE_API( FT_Error ) +ftglue_stream_frame_enter( FT_Stream stream, + FT_ULong size ); + +FTGLUE_API( void ) +ftglue_stream_frame_exit( FT_Stream stream ); + +FTGLUE_API( FT_Byte ) +ftglue_stream_get_byte( FT_Stream stream ); + +FTGLUE_API( FT_Short ) +ftglue_stream_get_short( FT_Stream stream ); + +FTGLUE_API( FT_Long ) +ftglue_stream_get_long( FT_Stream stream ); + +FTGLUE_API( FT_Error ) +ftglue_face_goto_table( FT_Face face, + FT_ULong tag, + FT_Stream stream ); + +/* memory macros used by the OpenType parser */ +#define ALLOC(_ptr,_size) \ + ( (_ptr) = ftglue_alloc( memory, _size, &error ), error != 0 ) + +#define REALLOC(_ptr,_oldsz,_newsz) \ + ( (_ptr) = ftglue_realloc( memory, (_ptr), (_oldsz), (_newsz), &error ), error != 0 ) + +#define FREE(_ptr) \ + FT_BEGIN_STMNT \ + if ( (_ptr) ) \ + { \ + ftglue_free( memory, _ptr ); \ + _ptr = NULL; \ + } \ + FT_END_STMNT + +#define ALLOC_ARRAY(_ptr,_count,_type) \ + ALLOC(_ptr,(_count)*sizeof(_type)) + +#define REALLOC_ARRAY(_ptr,_oldcnt,_newcnt,_type) \ + REALLOC(_ptr,(_oldcnt)*sizeof(_type),(_newcnt)*sizeof(_type)) + +#define MEM_Copy(dest,source,count) memcpy( (char*)(dest), (const char*)(source), (size_t)(count) ) + + +FTGLUE_API( FT_Pointer ) +ftglue_alloc( FT_Memory memory, + FT_ULong size, + FT_Error *perror ); + +FTGLUE_API( FT_Pointer ) +ftglue_realloc( FT_Memory memory, + FT_Pointer block, + FT_ULong old_size, + FT_ULong new_size, + FT_Error *perror ); + +FTGLUE_API( void ) +ftglue_free( FT_Memory memory, + FT_Pointer block ); + +/* */ + +FT_END_HEADER + +#endif /* __OPENTYPE_FTGLUE_H__ */ diff --git a/pango/opentype/ftxgdef.c b/pango/opentype/ftxgdef.c index 7367be72..702e29b9 100644 --- a/pango/opentype/ftxgdef.c +++ b/pango/opentype/ftxgdef.c @@ -18,14 +18,10 @@ #include "ftxopen.h" #include "ftxopenf.h" -#include "fterrcompat.h" +#include "ftglue.h" #include FT_TRUETYPE_TAGS_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_TRUETYPE_TYPES_H - #define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' ) static FT_Error Load_AttachList( TTO_AttachList* al, @@ -170,7 +166,6 @@ FT_Error error; FT_Memory memory = face->memory; FT_Stream stream = face->stream; - TT_Face tt_face = (TT_Face)face; FT_ULong cur_offset, new_offset, base_offset; TTO_GDEFHeader* gdef; @@ -179,7 +174,7 @@ if ( !retptr ) return TT_Err_Invalid_Argument; - if (( error = tt_face->goto_table( tt_face, TTAG_GDEF, stream, NULL ) )) + if (( error = ftglue_face_goto_table( face, TTAG_GDEF, stream ) )) return error; if (( error = TT_New_GDEF_Table ( face, &gdef ) )) diff --git a/pango/opentype/ftxgpos.c b/pango/opentype/ftxgpos.c index 3ac13482..e2a71ed4 100644 --- a/pango/opentype/ftxgpos.c +++ b/pango/opentype/ftxgpos.c @@ -24,14 +24,10 @@ #include "ftxopen.h" #include "ftxopenf.h" -#include "fterrcompat.h" +#include "ftglue.h" #include FT_TRUETYPE_TAGS_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_TRUETYPE_TYPES_H - #define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' ) struct GPOS_Instance_ @@ -89,7 +85,6 @@ FT_UShort i, num_lookups; TTO_GPOSHeader* gpos; TTO_Lookup* lo; - TT_Face tt_face = (TT_Face)face; FT_Stream stream = face->stream; FT_Error error; @@ -102,7 +97,7 @@ if ( !stream ) return TT_Err_Invalid_Face_Handle; - if (( error = tt_face->goto_table( tt_face, TTAG_GPOS, stream, NULL ) )) + if (( error = ftglue_face_goto_table( face, TTAG_GPOS, stream ) )) return error; base_offset = FILE_Pos(); diff --git a/pango/opentype/ftxgsub.c b/pango/opentype/ftxgsub.c index b7e4c135..50101c58 100644 --- a/pango/opentype/ftxgsub.c +++ b/pango/opentype/ftxgsub.c @@ -26,15 +26,10 @@ #include "ftxopen.h" #include "ftxopenf.h" -#include "fterrcompat.h" +#include "ftglue.h" #include FT_TRUETYPE_TAGS_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_TRUETYPE_TYPES_H - - #define GSUB_ID Build_Extension_ID( 'G', 'S', 'U', 'B' ) @@ -81,7 +76,6 @@ FT_Memory memory = face->memory; FT_Error error; FT_ULong cur_offset, new_offset, base_offset; - TT_Face tt_face = (TT_Face)face; FT_UShort i, num_lookups; TTO_GSUBHeader* gsub; @@ -90,7 +84,7 @@ if ( !retptr ) return TT_Err_Invalid_Argument; - if (( error = tt_face->goto_table( tt_face, TTAG_GSUB, stream, NULL ) )) + if (( error = ftglue_face_goto_table( face, TTAG_GSUB, stream ) )) return error; base_offset = FILE_Pos(); diff --git a/pango/opentype/ftxopen.c b/pango/opentype/ftxopen.c index ea38216d..75f66be5 100644 --- a/pango/opentype/ftxopen.c +++ b/pango/opentype/ftxopen.c @@ -18,11 +18,7 @@ #include "ftxopen.h" #include "ftxopenf.h" -#include "fterrcompat.h" - -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_TRUETYPE_TYPES_H +#include "ftglue.h" /*************************** @@ -430,6 +426,8 @@ FREE( fr ); } + + FREE( fl->ApplyOrder ); } diff --git a/pango/opentype/otlbuffer.c b/pango/opentype/otlbuffer.c index b8595b20..a53fc4b7 100644 --- a/pango/opentype/otlbuffer.c +++ b/pango/opentype/otlbuffer.c @@ -13,13 +13,11 @@ */ #include <otlbuffer.h> -#include FT_INTERNAL_MEMORY_H - /* To get the gcc-3.3 strict-aliasing compatible versions * FREE/REALLOC_ARRAY/etc. rather than the FT_* versions * that */ -#include "fterrcompat.h" +#include "ftglue.h" static FT_Error otl_buffer_ensure( OTL_Buffer buffer, diff --git a/pango/opentype/pango-ot-info.c b/pango/opentype/pango-ot-info.c index 9a0f3f09..1b6a1807 100644 --- a/pango/opentype/pango-ot-info.c +++ b/pango/opentype/pango-ot-info.c @@ -20,8 +20,7 @@ */ #include "pango-ot-private.h" -#include "fterrcompat.h" -#include FT_INTERNAL_OBJECTS_H +#include "ftglue.h" #include FT_MODULE_H static void pango_ot_info_class_init (GObjectClass *object_class); @@ -139,8 +138,7 @@ pango_ot_info_get (FT_Face face) static gboolean is_truetype (FT_Face face) { - return strcmp (FT_MODULE_CLASS (face->driver)->module_name, "truetype") == 0 || - strcmp (FT_MODULE_CLASS (face->driver)->module_name, "cff") == 0; + return FT_IS_SFNT(face); } typedef struct _GlyphInfo GlyphInfo; diff --git a/pango/opentype/pango-ot-ruleset.c b/pango/opentype/pango-ot-ruleset.c index 4c219301..5981ae8a 100644 --- a/pango/opentype/pango-ot-ruleset.c +++ b/pango/opentype/pango-ot-ruleset.c @@ -22,8 +22,6 @@ #include <pango/pango-ot.h> #include "pango-ot-private.h" -#include FT_INTERNAL_MEMORY_H /* For FT_Free() */ - typedef struct _PangoOTRule PangoOTRule; struct _PangoOTRule |