ref: d57a5e9fff50751aeb7fe545ef66890084bffab2
parent: ca947c2551bc247f8829bbe8d9c4df11387269a2
author: Werner Lemberg <[email protected]>
date: Wed Jun 18 02:16:39 EDT 2008
* src/type/t1objs.c (T1_Face_Init): Fix change from 2008-03-21. Reported by Peter Weilbacher <[email protected]>. * docs/CHANGES: Updated.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-06-18 Werner Lemberg <[email protected]>
+
+ * src/type/t1objs.c (T1_Face_Init): Fix change from 2008-03-21.
+ Reported by Peter Weilbacher <[email protected]>.
+
+ * docs/CHANGES: Updated.
+
2008-06-15 George Williams <[email protected]>
* src/otvalid/otvgpos.c (otv_MarkBasePos_validate): Set
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -8,6 +8,13 @@
`FT_Request_Metrics' and `FT_Select_Metrics', returning an
incorrect descender size.
+ - The `style_name' field in the `FT_FaceRec' structure often
+ contained a wrong value for Type 1 fonts. This misbehaviour
+ has been introduced in version 2.3.6 while trying to fix
+ another problem. [Note, however, that this value is
+ informative only since the used algorithm to extract it is
+ very simplistic.]
+
======================================================================
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -90,7 +90,7 @@
FT_LOCAL_DEF( FT_Error )
T1_Size_Init( T1_Size size )
{
- FT_Error error = 0;
+ FT_Error error = T1_Err_Ok;
PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size );
@@ -254,8 +254,8 @@
face->unicode_map = NULL;
#endif
- face->root.family_name = 0;
- face->root.style_name = 0;
+ face->root.family_name = NULL;
+ face->root.style_name = NULL;
}
}
@@ -355,15 +355,19 @@
/* XXX: TODO -- add kerning with .afm support */
+
+ /* The following code to extract the family and the style is very */
+ /* simplistic and might get some things wrong. For a full-featured */
+ /* algorithm you might have a look at the whitepaper given at */
+ /* */
+ /* http://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-model.aspx */
+
/* get style name -- be careful, some broken fonts only */
/* have a `/FontName' dictionary entry! */
root->family_name = info->family_name;
- /* assume "Regular" style if we don't know better */
- root->style_name = (char *)"Regular";
+ root->style_name = NULL;
- if ( info->weight )
- root->style_name = info->weight;
- else if ( root->family_name )
+ if ( root->family_name )
{
char* full = info->full_name;
char* family = root->family_name;
@@ -401,6 +405,15 @@
root->family_name = type1->font_name;
}
+ if ( !root->style_name )
+ {
+ if ( info->weight )
+ root->style_name = info->weight;
+ else
+ /* assume "Regular" style because we don't know better */
+ root->style_name = (char *)"Regular";
+ }
+
/* compute style flags */
root->style_flags = 0;
if ( info->italic_angle )
@@ -445,7 +458,7 @@
if ( !error )
root->max_advance_width = (FT_Short)max_advance;
else
- error = 0; /* clear error */
+ error = T1_Err_Ok; /* clear error */
}
root->max_advance_height = root->height;