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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
diff --git a/ChangeLog b/ChangeLog
index 45f753e..77d01ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-05-19 Derek Clegg <dclegg@apple.com>
+
+ 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 <wl@gnu.org>
* 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 1ef96b4..1e02d15 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 fd1da05..43eca2e 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 );
+
+ /*************************************************************************/
+ /* */
+ /* <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 );
+
/* */
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 9f4e128..facee47 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 f5dc49f..854d567 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;