diff --git a/ChangeLog b/ChangeLog index 45f753e8e..77d01acc7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-05-19 Derek Clegg + + Savannah patch #5929. + + * include/freetype/tttables.h, src/base/ftobjcs.c + (FT_Get_CMap_Format): New function. + + * include/freetype/internal/services/svttcmap.c (TT_CMapInfo): Add + `format' member. + * src/sfnt/ttcmap.c (tt_cmap{0,2,4,6,8,10,12}_get_info): Set + cmap_info->format. + 2007-05-19 Werner Lemberg * src/truetype/ttgload.c (load_truetype_glyph): Save graphics state diff --git a/include/freetype/internal/services/svttcmap.h b/include/freetype/internal/services/svttcmap.h index 1ef96b4fc..1e02d1550 100644 --- a/include/freetype/internal/services/svttcmap.h +++ b/include/freetype/internal/services/svttcmap.h @@ -52,6 +52,7 @@ FT_BEGIN_HEADER typedef struct TT_CMapInfo_ { FT_ULong language; + FT_Long format; } TT_CMapInfo; diff --git a/include/freetype/tttables.h b/include/freetype/tttables.h index fd1da05b3..43eca2e25 100644 --- a/include/freetype/tttables.h +++ b/include/freetype/tttables.h @@ -725,6 +725,26 @@ FT_BEGIN_HEADER FT_EXPORT( FT_ULong ) FT_Get_CMap_Language_ID( FT_CharMap charmap ); + + /*************************************************************************/ + /* */ + /* */ + /* FT_Get_CMap_Format */ + /* */ + /* */ + /* Return TrueType/sfnt specific cmap format. */ + /* */ + /* */ + /* charmap :: */ + /* The target charmap. */ + /* */ + /* */ + /* The format of `charmap'. If `charmap' doesn't belong to a */ + /* TrueType/sfnt face, return -1. */ + /* */ + FT_EXPORT( FT_Long ) + FT_Get_CMap_Format( FT_CharMap charmap ); + /* */ diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 9f4e128d0..facee4788 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -3026,6 +3026,30 @@ } + /* documentation is in tttables.h */ + + FT_EXPORT_DEF( FT_Long ) + FT_Get_CMap_Format( FT_CharMap charmap ) + { + FT_Service_TTCMaps service; + FT_Face face; + TT_CMapInfo cmap_info; + + + if ( !charmap || !charmap->face ) + return -1; + + face = charmap->face; + FT_FACE_FIND_SERVICE( face, service, TT_CMAP ); + if ( service == NULL ) + return -1; + if ( service->get_cmap_info( charmap, &cmap_info )) + return -1; + + return cmap_info.format; + } + + /* documentation is in ftsizes.h */ FT_EXPORT_DEF( FT_Error ) diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index f5dc49ffa..854d567d1 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -155,6 +155,7 @@ FT_Byte* p = cmap->data + 4; + cmap_info->format = 0; cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); return SFNT_Err_Ok; @@ -527,6 +528,7 @@ FT_Byte* p = cmap->data + 4; + cmap_info->format = 2; cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); return SFNT_Err_Ok; @@ -1303,6 +1305,7 @@ FT_Byte* p = cmap->data + 4; + cmap_info->format = 4; cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); return SFNT_Err_Ok; @@ -1462,6 +1465,7 @@ FT_Byte* p = cmap->data + 4; + cmap_info->format = 6; cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); return SFNT_Err_Ok; @@ -1715,6 +1719,7 @@ FT_Byte* p = cmap->data + 8; + cmap_info->format = 8; cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p ); return SFNT_Err_Ok; @@ -1863,6 +1868,7 @@ FT_Byte* p = cmap->data + 8; + cmap_info->format = 10; cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p ); return SFNT_Err_Ok; @@ -2179,6 +2185,7 @@ FT_Byte* p = cmap->data + 8; + cmap_info->format = 12; cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p ); return SFNT_Err_Ok;