Set `face_index' field in FT_Face for all font formats. * cff/cffobjs.c (cff_face_init), winfonts/winfnt.c (FNT_Face_Init), sfnt/sfobjs.c (sfnt_init_face): Do it. * docs/CHANGES: Document it.
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
diff --git a/ChangeLog b/ChangeLog
index e8591b7..ad844b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-12-26 Werner Lemberg <wl@gnu.org>
+
+ Set `face_index' field in FT_Face for all font formats.
+
+ * cff/cffobjs.c (cff_face_init), winfonts/winfnt.c (FNT_Face_Init),
+ sfnt/sfobjs.c (sfnt_init_face): Do it.
+
+ * docs/CHANGES: Document it.
+
2008-12-22 Steve Grubb
* builds/unix/ftsystem.c (FT_Stream_Open): Reject zero-length files.
diff --git a/docs/CHANGES b/docs/CHANGES
index 5ac53f5..76242cd 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -14,6 +14,11 @@ CHANGES BETWEEN 2.3.8 and 2.3.7
configuration macros TT_CONFIG_OPTION_BYTECODE_INTERPRETER and
TT_CONFIG_OPTION_UNPATENTED_HINTING were defined.
+ - The `face_index' field in the `FT_Face' structure wasn't
+ initialized properly after calling FT_Open_Face and friends with
+ a positive face index for CFFs, WinFNTs, and, most importantly,
+ for TrueType Collections (TTCs).
+
II. IMPORTANT CHANGES
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index c80cb82..3525ea3 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -465,8 +465,7 @@
pure_cff = 0;
/* load font directory */
- error = sfnt->load_face( stream, face,
- face_index, num_params, params );
+ error = sfnt->load_face( stream, face, 0, num_params, params );
if ( error )
goto Exit;
}
@@ -515,6 +514,8 @@
cff->pshinter = pshinter;
cff->psnames = (void*)psnames;
+ cffface->face_index = face_index;
+
/* Complement the root flags with some interesting information. */
/* Note that this is only necessary for pure CFF and CEF fonts; */
/* SFNT based fonts use the `name' table instead. */
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index 5d54591..9647d87 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -324,6 +324,7 @@
goto Exit;
/* check the face index */
+ /* XXX: handle CID fonts with more than a single face */
if ( face_index != 0 )
{
FT_ERROR(( "cid_face_init: invalid face index\n" ));
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 2f9a3b8..021ec5a 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -468,7 +468,8 @@
if ( error )
return error;
- face->root.num_faces = face->ttc_header.count;
+ face->root.num_faces = face->ttc_header.count;
+ face->root.face_index = face_index;
return error;
}
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index ed49d6e..2f90dd6 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -326,7 +326,7 @@
goto Exit;
/* check the face index */
- if ( face_index != 0 )
+ if ( face_index > 0 )
{
FT_ERROR(( "T1_Face_Init: invalid face index\n" ));
error = T1_Err_Invalid_Argument;
@@ -343,7 +343,7 @@
root->num_glyphs = type1->num_glyphs;
- root->face_index = face_index;
+ root->face_index = 0;
root->face_flags = FT_FACE_FLAG_SCALABLE |
FT_FACE_FLAG_HORIZONTAL |
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index ad895aa..16e9809 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -188,7 +188,7 @@
goto Exit;
/* check the face index */
- if ( face_index != 0 )
+ if ( face_index > 0 )
{
FT_ERROR(( "T42_Face_Init: invalid face index\n" ));
error = T42_Err_Invalid_Argument;
@@ -202,7 +202,7 @@
root->num_glyphs = type1->num_glyphs;
root->num_charmaps = 0;
- root->face_index = face_index;
+ root->face_index = 0;
root->face_flags = FT_FACE_FLAG_SCALABLE |
FT_FACE_FLAG_HORIZONTAL |
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index cb6b035..f6e9859 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -736,6 +736,8 @@
FT_PtrDist family_size;
+ root->face_index = face_index;
+
root->face_flags = FT_FACE_FLAG_FIXED_SIZES |
FT_FACE_FLAG_HORIZONTAL;