* src/cff/cfftypes.h (CFF_FontRecDictRec): Change type of `cid_count' to `FT_ULong'. * src/cff/cffgload.c (cff_slot_load): Take care of empty `cids' array. * src/cff/cffload.c (cff_charset_done): Free `cids' array. (cff_font_load): Create cids array only for CID-keyed fonts which are subsetted. * src/cff/cffobjs.c (cff_face_init): Check the availability of the PSNames modules for non-pure CFFs also. Set FT_FACE_FLAG_GLYPH_NAMES for a non-pure CFF also if it isn't CID-keyed. * src/cff/rules.mk (CFF_DRV_H): Add cfftypes.h.
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
diff --git a/ChangeLog b/ChangeLog
index 854823f..cc0a0c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2003-12-18 Werner Lemberg <wl@gnu.org>
+
+ * src/cff/cfftypes.h (CFF_FontRecDictRec): Change type of
+ `cid_count' to `FT_ULong'.
+
+ * src/cff/cffgload.c (cff_slot_load): Take care of empty `cids'
+ array.
+
+ * src/cff/cffload.c (cff_charset_done): Free `cids' array.
+ (cff_font_load): Create cids array only for CID-keyed fonts which
+ are subsetted.
+
+ * src/cff/cffobjs.c (cff_face_init): Check the availability of
+ the PSNames modules for non-pure CFFs also.
+ Set FT_FACE_FLAG_GLYPH_NAMES for a non-pure CFF also if it isn't
+ CID-keyed.
+
+ * src/cff/rules.mk (CFF_DRV_H): Add cfftypes.h.
+
2003-12-17 Werner Lemberg <wl@gnu.org>
* src/sfnt/sfobjs.c (sfnt_init_face): Don't set
diff --git a/docs/CHANGES b/docs/CHANGES
index ab9d913..09026b9 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -14,8 +14,8 @@ LATEST CHANGES BETWEEN 2.1.8 and 2.1.7
correctly treated as a CID, similar to FreeType's CID driver
module. Note that CID CMaps support is still missing.
- - SFNT based fonts no longer set the FT_FACE_FLAGS_GLYPH_NAMES
- flag if a version 3.0 `post' table is present.
+ - The FT_FACE_FLAGS_GLYPH_NAMES is now set correctly for all font
+ formats.
II. IMPORTANT CHANGES
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 0388b75..a905b84 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -2316,8 +2316,10 @@
/* in a CID-keyed font, consider `glyph_index' as a CID and map */
- /* it immediately to the real glyph_index */
- if ( cff->top_font.font_dict.cid_registry != 0xFFFFU )
+ /* it immediately to the real glyph_index -- if it isn't a */
+ /* subsetted font, glyph_indices and CIDs are identical, though */
+ if ( cff->top_font.font_dict.cid_registry != 0xFFFFU &&
+ cff->charset.cids )
glyph_index = cff->charset.cids[glyph_index];
cff_decoder_init( &decoder, face, size, glyph, hinting,
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 68bac3e..f63d7fd 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1501,6 +1501,7 @@
FT_FREE( charset->sids );
+ FT_FREE( charset->cids );
charset->format = 0;
charset->offset = 0;
}
@@ -1672,7 +1673,7 @@
}
}
- /* we have to invert the `sids' array for CID-keyed fonts */
+ /* we have to invert the `sids' array for subsetted CID-keyed fonts */
if ( invert )
{
FT_UInt i;
@@ -2244,9 +2245,13 @@
/* read the Charset and Encoding tables if available */
if ( font->num_glyphs > 0 )
{
+ FT_Bool invert;
+
+
+ invert = dict->cid_registry != 0xFFFFU &&
+ font->charstrings_index.count != dict->cid_count;
error = cff_charset_load( &font->charset, font->num_glyphs, stream,
- base_offset, dict->charset_offset,
- dict->cid_registry != 0xFFFFU );
+ base_offset, dict->charset_offset, invert );
if ( error )
goto Exit;
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 15540b7..8d45165 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -337,10 +337,11 @@
/* now load and parse the CFF table in the file */
{
- CFF_Font cff;
- FT_Memory memory = face->root.memory;
- FT_Face root;
- FT_Int32 flags;
+ CFF_Font cff;
+ CFF_FontRecDict dict;
+ FT_Memory memory = face->root.memory;
+ FT_Face root;
+ FT_Int32 flags;
if ( FT_NEW( cff ) )
@@ -360,22 +361,23 @@
root = &face->root;
root->num_glyphs = cff->num_glyphs;
- if ( pure_cff )
+ dict = &cff->top_font.font_dict;
+
+ /* we need the `PSNames' module for CFF and CEF formats */
+ /* which aren't CID-keyed */
+ if ( dict->cid_registry == 0xFFFFU && !psnames )
{
- CFF_FontRecDict dict = &cff->top_font.font_dict;
- char* style_name;
+ FT_ERROR(( "cff_face_init:" ));
+ FT_ERROR(( " cannot open CFF & CEF fonts\n" ));
+ FT_ERROR(( " " ));
+ FT_ERROR(( " without the `PSNames' module\n" ));
+ goto Bad_Format;
+ }
+ if ( pure_cff )
+ {
+ char* style_name;
- /* we need the `PSNames' module for pure-CFF and CEF formats */
- /* which aren't CID-keyed */
- if ( dict->cid_registry == 0xFFFFU && !psnames )
- {
- FT_ERROR(( "cff_face_init:" ));
- FT_ERROR(( " cannot open CFF & CEF fonts\n" ));
- FT_ERROR(( " " ));
- FT_ERROR(( " without the `PSNames' module\n" ));
- goto Bad_Format;
- }
/* Set up num_faces. */
root->num_faces = cff->num_faces;
@@ -483,12 +485,6 @@
flags |= FT_FACE_FLAG_KERNING;
#endif
-#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
- /* CID-keyed CFF fonts don't have glyph names */
- if ( dict->cid_registry == 0xFFFFU )
- flags |= FT_FACE_FLAG_GLYPH_NAMES;
-#endif
-
root->face_flags = flags;
/*******************************************************************/
@@ -515,6 +511,13 @@
root->style_flags = flags;
}
+#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
+ /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */
+ /* has unset this flag because of the 3.0 `post' table */
+ if ( dict->cid_registry == 0xFFFFU )
+ root->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
+#endif
+
/*******************************************************************/
/* */
/* Compute char maps. */
diff --git a/src/cff/cfftypes.h b/src/cff/cfftypes.h
index 83b7d19..4508d98 100644
--- a/src/cff/cfftypes.h
+++ b/src/cff/cfftypes.h
@@ -123,7 +123,7 @@ FT_BEGIN_HEADER
FT_Long cid_font_version;
FT_Long cid_font_revision;
FT_Long cid_font_type;
- FT_Long cid_count;
+ FT_ULong cid_count;
FT_ULong cid_uid_base;
FT_ULong cid_fd_array_offset;
FT_ULong cid_fd_select_offset;
diff --git a/src/cff/rules.mk b/src/cff/rules.mk
index 579f144..4100c80 100644
--- a/src/cff/rules.mk
+++ b/src/cff/rules.mk
@@ -34,6 +34,7 @@ CFF_DRV_SRC := $(CFF_DIR)/cffobjs.c \
#
CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \
$(CFF_DIR)/cfftoken.h \
+ $(CFF_DIR)/cfftypes.h \
$(CFF_DIR)/cfferrs.h