ref: b826fa7589291a5bb1b725eeec73955e89361e22
parent: 6f99c88801722e79e11aebdccb462c2dbb0c86d8
author: Werner Lemberg <[email protected]>
date: Sat May 19 03:18:48 EDT 2007
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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-05-19 Derek Clegg <[email protected]>
+
+ 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 <[email protected]>
* src/truetype/ttgload.c (load_truetype_glyph): Save graphics state
--- a/include/freetype/internal/services/svttcmap.h
+++ b/include/freetype/internal/services/svttcmap.h
@@ -52,6 +52,7 @@
typedef struct TT_CMapInfo_
{
FT_ULong language;
+ FT_Long format;
} TT_CMapInfo;
--- a/include/freetype/tttables.h
+++ b/include/freetype/tttables.h
@@ -725,6 +725,26 @@
FT_EXPORT( FT_ULong )
FT_Get_CMap_Language_ID( FT_CharMap charmap );
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Get_CMap_Format */
+ /* */
+ /* <Description> */
+ /* Return TrueType/sfnt specific cmap format. */
+ /* */
+ /* <Input> */
+ /* charmap :: */
+ /* The target charmap. */
+ /* */
+ /* <Return> */
+ /* 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 );
+
/* */
--- 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 )
--- 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;