|
|
|
@ -513,10 +513,8 @@ THE SOFTWARE. |
|
|
|
|
goto Bail; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( FT_NEW_ARRAY( properties[i].name, |
|
|
|
|
ft_strlen( strings + name_offset ) + 1 ) ) |
|
|
|
|
if ( FT_STRDUP( properties[i].name, strings + name_offset ) ) |
|
|
|
|
goto Bail; |
|
|
|
|
ft_strcpy( properties[i].name, strings + name_offset ); |
|
|
|
|
|
|
|
|
|
FT_TRACE4(( " %s:", properties[i].name )); |
|
|
|
|
|
|
|
|
@ -534,10 +532,8 @@ THE SOFTWARE. |
|
|
|
|
goto Bail; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( FT_NEW_ARRAY( properties[i].value.atom, |
|
|
|
|
ft_strlen( strings + value_offset ) + 1 ) ) |
|
|
|
|
if ( FT_STRDUP( properties[i].value.atom, strings + value_offset ) ) |
|
|
|
|
goto Bail; |
|
|
|
|
ft_strcpy( properties[i].value.atom, strings + props[i].value ); |
|
|
|
|
|
|
|
|
|
FT_TRACE4(( " `%s'\n", properties[i].value.atom )); |
|
|
|
|
} |
|
|
|
@ -993,10 +989,9 @@ THE SOFTWARE. |
|
|
|
|
|
|
|
|
|
PCF_Property prop; |
|
|
|
|
|
|
|
|
|
char *istr = NULL, *bstr = NULL; |
|
|
|
|
char *sstr = NULL, *astr = NULL; |
|
|
|
|
|
|
|
|
|
int parts = 0, len = 0; |
|
|
|
|
int nn, len; |
|
|
|
|
char* strings[4] = { NULL, NULL, NULL, NULL }; |
|
|
|
|
int lengths[4]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
face->style_flags = 0; |
|
|
|
@ -1007,11 +1002,9 @@ THE SOFTWARE. |
|
|
|
|
*(prop->value.atom) == 'I' || *(prop->value.atom) == 'i' ) ) |
|
|
|
|
{ |
|
|
|
|
face->style_flags |= FT_STYLE_FLAG_ITALIC; |
|
|
|
|
istr = ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' ) |
|
|
|
|
? (char *)"Oblique" |
|
|
|
|
: (char *)"Italic"; |
|
|
|
|
len += ft_strlen( istr ); |
|
|
|
|
parts++; |
|
|
|
|
strings[2] = ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' ) |
|
|
|
|
? (char *)"Oblique" |
|
|
|
|
: (char *)"Italic"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
prop = pcf_find_property( pcf, "WEIGHT_NAME" ); |
|
|
|
@ -1019,9 +1012,7 @@ THE SOFTWARE. |
|
|
|
|
( *(prop->value.atom) == 'B' || *(prop->value.atom) == 'b' ) ) |
|
|
|
|
{ |
|
|
|
|
face->style_flags |= FT_STYLE_FLAG_BOLD; |
|
|
|
|
bstr = (char *)"Bold"; |
|
|
|
|
len += ft_strlen( bstr ); |
|
|
|
|
parts++; |
|
|
|
|
strings[1] = (char *)"Bold"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
prop = pcf_find_property( pcf, "SETWIDTH_NAME" ); |
|
|
|
@ -1029,9 +1020,7 @@ THE SOFTWARE. |
|
|
|
|
*(prop->value.atom) && |
|
|
|
|
!( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) ) |
|
|
|
|
{ |
|
|
|
|
sstr = (char *)(prop->value.atom); |
|
|
|
|
len += ft_strlen( sstr ); |
|
|
|
|
parts++; |
|
|
|
|
strings[3] = (char *)(prop->value.atom); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
prop = pcf_find_property( pcf, "ADD_STYLE_NAME" ); |
|
|
|
@ -1039,60 +1028,62 @@ THE SOFTWARE. |
|
|
|
|
*(prop->value.atom) && |
|
|
|
|
!( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) ) |
|
|
|
|
{ |
|
|
|
|
astr = (char *)(prop->value.atom); |
|
|
|
|
len += ft_strlen( astr ); |
|
|
|
|
parts++; |
|
|
|
|
strings[0] = (char *)(prop->value.atom); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( !parts || !len ) |
|
|
|
|
for (len = 0, nn = 0; nn < 4; nn++) |
|
|
|
|
{ |
|
|
|
|
if ( FT_ALLOC( face->style_name, 8 ) ) |
|
|
|
|
return error; |
|
|
|
|
ft_strcpy( face->style_name, "Regular" ); |
|
|
|
|
face->style_name[7] = '\0'; |
|
|
|
|
lengths[nn] = 0; |
|
|
|
|
if (strings[nn])
|
|
|
|
|
{ |
|
|
|
|
lengths[nn] = ft_strlen(strings[nn]); |
|
|
|
|
len += lengths[nn]+1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
|
|
|
|
|
if ( len == 0 ) |
|
|
|
|
{ |
|
|
|
|
char *style, *s; |
|
|
|
|
unsigned int i; |
|
|
|
|
strings[0] = "Regular"; |
|
|
|
|
lengths[0] = ft_strlen(strings[0]); |
|
|
|
|
len = lengths[0]+1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
char* s; |
|
|
|
|
|
|
|
|
|
if ( FT_ALLOC( style, len + parts ) ) |
|
|
|
|
|
|
|
|
|
if ( FT_ALLOC( face->style_name, len ) ) |
|
|
|
|
return error; |
|
|
|
|
|
|
|
|
|
s = style; |
|
|
|
|
s = face->style_name; |
|
|
|
|
|
|
|
|
|
if ( astr ) |
|
|
|
|
{ |
|
|
|
|
ft_strcpy( s, astr ); |
|
|
|
|
for ( i = 0; i < ft_strlen( astr ); i++, s++ ) |
|
|
|
|
if ( *s == ' ' ) |
|
|
|
|
*s = '-'; /* replace spaces with dashes */ |
|
|
|
|
*(s++) = ' '; |
|
|
|
|
} |
|
|
|
|
if ( bstr ) |
|
|
|
|
{ |
|
|
|
|
ft_strcpy( s, bstr ); |
|
|
|
|
s += ft_strlen( bstr ); |
|
|
|
|
*(s++) = ' '; |
|
|
|
|
} |
|
|
|
|
if ( istr ) |
|
|
|
|
{ |
|
|
|
|
ft_strcpy( s, istr ); |
|
|
|
|
s += ft_strlen( istr ); |
|
|
|
|
*(s++) = ' '; |
|
|
|
|
} |
|
|
|
|
if ( sstr ) |
|
|
|
|
for (nn = 0; nn < 4; nn++) |
|
|
|
|
{ |
|
|
|
|
ft_strcpy( s, sstr ); |
|
|
|
|
for ( i = 0; i < ft_strlen( sstr ); i++, s++ ) |
|
|
|
|
if ( *s == ' ' ) |
|
|
|
|
*s = '-'; /* replace spaces with dashes */ |
|
|
|
|
*(s++) = ' '; |
|
|
|
|
} |
|
|
|
|
*(--s) = '\0'; /* overwrite last ' ', terminate the string */ |
|
|
|
|
char* src = strings[nn]; |
|
|
|
|
int len = lengths[nn]; |
|
|
|
|
|
|
|
|
|
if ( src == NULL ) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
/* separate elements with a space */ |
|
|
|
|
if (s != face->style_name) |
|
|
|
|
*s++ = ' '; |
|
|
|
|
|
|
|
|
|
memcpy( s, src, len ); |
|
|
|
|
|
|
|
|
|
/* need to convert spaces to dashes for add_style_name and setwidth_name */ |
|
|
|
|
if (nn == 0 || nn == 3)
|
|
|
|
|
{ |
|
|
|
|
int mm; |
|
|
|
|
|
|
|
|
|
for (mm = 0; mm < len; mm++) |
|
|
|
|
if (s[mm] == ' ') |
|
|
|
|
s[mm] = '-'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
face->style_name = style; /* allocated string */ |
|
|
|
|
s += len; |
|
|
|
|
} |
|
|
|
|
*s = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return error; |
|
|
|
@ -1173,12 +1164,8 @@ THE SOFTWARE. |
|
|
|
|
prop = pcf_find_property( face, "FAMILY_NAME" ); |
|
|
|
|
if ( prop && prop->isString ) |
|
|
|
|
{ |
|
|
|
|
int l = ft_strlen( prop->value.atom ) + 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( FT_NEW_ARRAY( root->family_name, l ) ) |
|
|
|
|
if ( FT_STRDUP( root->family_name, prop->value.atom ) ) |
|
|
|
|
goto Exit; |
|
|
|
|
ft_strcpy( root->family_name, prop->value.atom ); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
root->family_name = NULL; |
|
|
|
@ -1256,16 +1243,9 @@ THE SOFTWARE. |
|
|
|
|
if ( charset_registry && charset_registry->isString && |
|
|
|
|
charset_encoding && charset_encoding->isString ) |
|
|
|
|
{ |
|
|
|
|
if ( FT_NEW_ARRAY( face->charset_encoding, |
|
|
|
|
ft_strlen( charset_encoding->value.atom ) + 1 ) ) |
|
|
|
|
if ( FT_STRDUP( face->charset_encoding, charset_encoding->value.atom ) || |
|
|
|
|
FT_STRDUP( face->charset_registry, charset_registry->value.atom ) ) |
|
|
|
|
goto Exit; |
|
|
|
|
|
|
|
|
|
if ( FT_NEW_ARRAY( face->charset_registry, |
|
|
|
|
ft_strlen( charset_registry->value.atom ) + 1 ) ) |
|
|
|
|
goto Exit; |
|
|
|
|
|
|
|
|
|
ft_strcpy( face->charset_registry, charset_registry->value.atom ); |
|
|
|
|
ft_strcpy( face->charset_encoding, charset_encoding->value.atom ); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|