* src/cff/cffobjs.c (cff_face_init): Use symbolic names for Adobe specific encoding IDs (there was a wrong EID value for custom encoding). * src/cff/cffcmap.h (CFF_CMapStdRec): Remove `count'. * src/cff/cffcmap.c (cff_cmap_encoding_init, cff_cmap_encoding_done): Updated. (cff_cmap_encoding_char_index, cff_cmap_encoding_char_next): Use 256 as limit for character code.
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 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
diff --git a/ChangeLog b/ChangeLog
index 6449172..1286716 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2003-06-02 Werner Lemberg <wl@gnu.org>
+
+ * src/cff/cffobjs.c (cff_face_init): Use symbolic names for
+ Adobe specific encoding IDs (there was a wrong EID value for custom
+ encoding).
+
+ * src/cff/cffcmap.h (CFF_CMapStdRec): Remove `count'.
+ * src/cff/cffcmap.c (cff_cmap_encoding_init,
+ cff_cmap_encoding_done): Updated.
+ (cff_cmap_encoding_char_index, cff_cmap_encoding_char_next): Use
+ 256 as limit for character code.
+
2003-06-01 Werner Lemberg <wl@gnu.org>
* src/winfonts/winfnt.c (FNT_Load_Glyph): Revert change from
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 13f7929..fefa9da 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2270,7 +2270,7 @@
return FT_Err_Invalid_Argument;
face = charmap->face;
- memory = FT_FACE_MEMORY(face);
+ memory = FT_FACE_MEMORY( face );
if ( !FT_ALLOC( cmap, clazz->size ) )
{
diff --git a/src/cff/cffcmap.c b/src/cff/cffcmap.c
index 5beb6ae..34af47e 100644
--- a/src/cff/cffcmap.c
+++ b/src/cff/cffcmap.c
@@ -4,7 +4,7 @@
/* */
/* CFF character mapping table (cmap) support (body). */
/* */
-/* Copyright 2002 by */
+/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -36,7 +36,6 @@
CFF_Encoding encoding = &cff->encoding;
- cmap->count = encoding->count;
cmap->gids = encoding->codes;
return 0;
@@ -46,7 +45,6 @@
FT_CALLBACK_DEF( void )
cff_cmap_encoding_done( CFF_CMapStd cmap )
{
- cmap->count = 0;
cmap->gids = NULL;
}
@@ -58,7 +56,7 @@
FT_UInt result = 0;
- if ( char_code < cmap->count )
+ if ( char_code < 256 )
result = cmap->gids[char_code];
return result;
@@ -75,14 +73,14 @@
*pchar_code = 0;
- if ( char_code < cmap->count )
+ if ( char_code < 255 )
{
FT_UInt code = (FT_UInt)(char_code + 1);
for (;;)
{
- if ( code >= cmap->count )
+ if ( code >= 256 )
break;
result = cmap->gids[code];
@@ -164,7 +162,7 @@
pair = cmap->pairs;
for ( n = 0; n < count; n++ )
{
- FT_UInt sid = charset->sids[n];
+ FT_UInt sid = charset->sids[n];
const char* gname;
diff --git a/src/cff/cffcmap.h b/src/cff/cffcmap.h
index e136d29..ceb32cd 100644
--- a/src/cff/cffcmap.h
+++ b/src/cff/cffcmap.h
@@ -4,7 +4,7 @@
/* */
/* CFF character mapping table (cmap) support (specification). */
/* */
-/* Copyright 2002 by */
+/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -38,7 +38,6 @@ FT_BEGIN_HEADER
typedef struct CFF_CMapStdRec_
{
FT_CMapRec cmap;
- FT_UInt count;
FT_UShort* gids; /* up to 256 elements */
} CFF_CMapStdRec;
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 0a0fcb7..1882a8a 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1505,8 +1505,8 @@
FT_ULong base_offset,
FT_ULong offset )
{
- FT_Memory memory = stream->memory;
- FT_Error error = 0;
+ FT_Memory memory = stream->memory;
+ FT_Error error = 0;
FT_UShort glyph_sid;
@@ -1557,7 +1557,6 @@
while ( j < num_glyphs )
{
-
/* Read the first glyph sid of the range. */
if ( FT_READ_USHORT( glyph_sid ) )
goto Exit;
@@ -1699,11 +1698,11 @@
FT_ULong base_offset,
FT_ULong offset )
{
- FT_Error error = 0;
- FT_UInt count;
- FT_UInt j;
- FT_UShort glyph_sid;
- FT_UInt glyph_code;
+ FT_Error error = 0;
+ FT_UInt count;
+ FT_UInt j;
+ FT_UShort glyph_sid;
+ FT_UInt glyph_code;
/* Check for charset->sids. If we do not have this, we fail. */
@@ -1720,8 +1719,8 @@
encoding->codes[j] = 0;
}
- /* Note: The encoding table in a CFF font is indexed by glyph index, */
- /* where the first encoded glyph index is 1. Hence, we read the char */
+ /* Note: The encoding table in a CFF font is indexed by glyph index; */
+ /* the first encoded glyph index is 1. Hence, we read the character */
/* code (`glyph_code') at index j and make the assignment: */
/* */
/* encoding->codes[glyph_code] = j + 1 */
@@ -1734,7 +1733,6 @@
if ( offset > 1 )
{
-
encoding->offset = base_offset + offset;
/* we need to parse the table to determine its size */
@@ -1857,13 +1855,13 @@
/* Assign code to SID mapping. */
encoding->sids[glyph_code] = glyph_sid;
- /* First, lookup GID which has been assigned to */
- /* SID glyph_sid. */
+ /* First, look up GID which has been assigned to */
+ /* SID glyph_sid. */
for ( gindex = 0; gindex < num_glyphs; gindex++ )
{
if ( charset->sids[gindex] == glyph_sid )
{
- encoding->codes[glyph_code] = (FT_UShort) gindex;
+ encoding->codes[glyph_code] = (FT_UShort)gindex;
break;
}
}
@@ -1875,10 +1873,10 @@
FT_UInt i;
- /* We take into account the fact a CFF font can use a predefined */
- /* encoding without containing all of the glyphs encoded by this */
- /* encoding (see the note at the end of section 12 in the CFF */
- /* specification). */
+ /* We take into account the fact a CFF font can use a predefined */
+ /* encoding without containing all of the glyphs encoded by this */
+ /* encoding (see the note at the end of section 12 in the CFF */
+ /* specification). */
switch ( (FT_UInt)offset )
{
@@ -1900,7 +1898,6 @@
encoding->count = 0;
-
for ( j = 0; j < 256; j++ )
{
/* If j is encoded, find the GID for it. */
@@ -2208,7 +2205,7 @@
if ( font->num_glyphs > 0 )
{
error = cff_charset_load( &font->charset, font->num_glyphs, stream,
- base_offset, dict->charset_offset );
+ base_offset, dict->charset_offset );
if ( error )
goto Exit;
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 758ccef..a39015e 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -466,7 +466,7 @@
CFF_Encoding encoding = &cff->encoding;
- for ( nn = 0; nn < (FT_UInt) root->num_charmaps; nn++ )
+ for ( nn = 0; nn < (FT_UInt)root->num_charmaps; nn++ )
{
cmap = root->charmaps[nn];
@@ -485,12 +485,12 @@
cmaprec.encoding_id = 1;
cmaprec.encoding = FT_ENCODING_UNICODE;
- nn = (FT_UInt) root->num_charmaps;
+ nn = (FT_UInt)root->num_charmaps;
FT_CMap_New( &cff_cmap_unicode_class_rec, NULL, &cmaprec, NULL );
/* if no Unicode charmap was previously selected, select this one */
- if ( root->charmap == NULL && nn != (FT_UInt) root->num_charmaps )
+ if ( root->charmap == NULL && nn != (FT_UInt)root->num_charmaps )
root->charmap = root->charmaps[nn];
Skip_Unicode:
@@ -504,19 +504,19 @@
if ( encoding->offset == 0 )
{
- cmaprec.encoding_id = 0;
+ cmaprec.encoding_id = TT_ADOBE_ID_STANDARD;
cmaprec.encoding = FT_ENCODING_ADOBE_STANDARD;
clazz = &cff_cmap_encoding_class_rec;
}
else if ( encoding->offset == 1 )
{
- cmaprec.encoding_id = 1;
+ cmaprec.encoding_id = TT_ADOBE_ID_EXPERT;
cmaprec.encoding = FT_ENCODING_ADOBE_EXPERT;
clazz = &cff_cmap_encoding_class_rec;
}
else
{
- cmaprec.encoding_id = 3;
+ cmaprec.encoding_id = TT_ADOBE_ID_CUSTOM;
cmaprec.encoding = FT_ENCODING_ADOBE_CUSTOM;
clazz = &cff_cmap_encoding_class_rec;
}