summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Tassyns <bramt@enfocus.be>2011-03-07 09:33:53 +0100
committerWerner Lemberg <wl@gnu.org>2011-03-07 09:33:53 +0100
commit3fd158d0ce3662f370b49b3a84ad59a1e09b4340 (patch)
tree323ed5dfa62e7073972cb2b99ac8d817f6e26f8e
parent9c111b01798ac8c3f39c1a2fdd3ab960effc2077 (diff)
Fix Savannah bug #27988.
* src/cff/cffobjs.c (remove_style): New function. (cff_face_init): Use it to strip off the style part of the family name.
-rw-r--r--ChangeLog10
-rw-r--r--src/cff/cffobjs.c48
2 files changed, 57 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8fa46717..d55640dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-03-27 Bram Tassyns <bramt@enfocus.be>
+
+ Fix Savannah bug #27988.
+
+ * src/cff/cffobjs.c (remove_style): New function.
+ (cff_face_init): Use it to strip off the style part of the family
+ name.
+
2011-03-07 Werner Lemberg <wl@gnu.org>
* docs/CHANGES: Updated.
@@ -145,7 +153,7 @@
[truetype] Improve handling of stack underflow.
* src/truetype/ttinterp.c (TT_RunIns, Ins_FLIPPT, Ins_DELTAP,
- Ins_DELTAC): Exit with error only if `pedantic_hinting' is set.
+ Ins_DELTAC): Exit with error only if `pedantic_hinting' is set.
Otherwise, try to do something sane.
2011-01-30 Werner Lemberg <wl@gnu.org>
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index d8913c28..fdb58a49 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -429,6 +429,51 @@
}
+ /* Remove the style part from the family name (if present). */
+
+ static void
+ remove_style( FT_String* family_name,
+ const FT_String* style_name )
+ {
+ FT_Int32 family_name_length, style_name_length;
+
+
+ family_name_length = strlen( family_name );
+ style_name_length = strlen( style_name );
+
+ if ( family_name_length > style_name_length )
+ {
+ FT_Int idx;
+
+
+ for ( idx = 1; idx <= style_name_length; ++idx )
+ {
+ if ( family_name[family_name_length - idx] !=
+ style_name[style_name_length - idx] )
+ break;
+ }
+
+ if ( idx > style_name_length )
+ {
+ /* family_name ends with style_name; remove it */
+ idx = family_name_length - style_name_length - 1;
+
+ /* also remove special characters */
+ /* between real family name and style */
+ while ( idx > 0 &&
+ ( family_name[idx] == '-' ||
+ family_name[idx] == ' ' ||
+ family_name[idx] == '_' ||
+ family_name[idx] == '+' ) )
+ --idx;
+
+ if ( idx > 0 )
+ family_name[idx + 1] = '\0';
+ }
+ }
+ }
+
+
FT_LOCAL_DEF( FT_Error )
cff_face_init( FT_Stream stream,
FT_Face cffface, /* CFF_Face */
@@ -758,6 +803,9 @@
/* case, the remaining string in `fullp' will be used as */
/* the style name. */
style_name = cff_strcpy( memory, fullp );
+
+ /* remove the style part from the family name (if present) */
+ remove_style( cffface->family_name, style_name );
}
break;
}