Use implementation specific SID value 0xFFFF to indicate that
a dictionary element is missing. * src/cff/cffload.c (cff_subfont_load): Initialize all fields which hold SIDs to 0xFFFF. (cff_index_get_sid_string): Handle SID value 0xFFFF. Handle case where `psnames' is zero. (cff_font_load): Updated. Don't load encoding for CID-keyed CFFs. * src/cff/cffobjs.c (cff_face_init): Updated. Don't check for PSNames module if font is CID-keyed. Compute style name properly (using the same algorithm as in the CID driver). Fix computation of style flags. * src/cff/cfftoken.h: Comment out handling of base_font_name. Rename `postscript' field to `embedded_postscript' * src/cff/cfftypes.h (CFF_FontRecDictRec): Remove `base_font_name' and `postscript'.
This commit is contained in:
parent
cb3fd79b66
commit
9b067facf1
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
||||||
|
2003-12-10 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
|
Use implementation specific SID value 0xFFFF to indicate that
|
||||||
|
a dictionary element is missing.
|
||||||
|
|
||||||
|
* src/cff/cffload.c (cff_subfont_load): Initialize all fields
|
||||||
|
which hold SIDs to 0xFFFF.
|
||||||
|
(cff_index_get_sid_string): Handle SID value 0xFFFF.
|
||||||
|
Handle case where `psnames' is zero.
|
||||||
|
(cff_font_load): Updated.
|
||||||
|
Don't load encoding for CID-keyed CFFs.
|
||||||
|
|
||||||
|
* src/cff/cffobjs.c (cff_face_init): Updated.
|
||||||
|
Don't check for PSNames module if font is CID-keyed.
|
||||||
|
Compute style name properly (using the same algorithm as in the
|
||||||
|
CID driver).
|
||||||
|
Fix computation of style flags.
|
||||||
|
|
||||||
|
* src/cff/cfftoken.h: Comment out handling of base_font_name.
|
||||||
|
Rename `postscript' field to `embedded_postscript'
|
||||||
|
* src/cff/cfftypes.h (CFF_FontRecDictRec): Remove `base_font_name'
|
||||||
|
and `postscript'.
|
||||||
|
|
||||||
2003-12-10 Detlef Würkner <TetiSoft@apg.lahn.de>
|
2003-12-10 Detlef Würkner <TetiSoft@apg.lahn.de>
|
||||||
|
|
||||||
* src/pcf/pcfdrivr.c (pcf_get_charset_id): New function (a clone
|
* src/pcf/pcfdrivr.c (pcf_get_charset_id): New function (a clone
|
||||||
|
|
|
@ -1211,7 +1211,7 @@
|
||||||
FT_Byte** pbytes,
|
FT_Byte** pbytes,
|
||||||
FT_ULong* pbyte_len )
|
FT_ULong* pbyte_len )
|
||||||
{
|
{
|
||||||
FT_Error error = 0;
|
FT_Error error = CFF_Err_Ok;
|
||||||
|
|
||||||
|
|
||||||
if ( idx && idx->count > element )
|
if ( idx && idx->count > element )
|
||||||
|
@ -1316,10 +1316,18 @@
|
||||||
FT_UInt sid,
|
FT_UInt sid,
|
||||||
FT_Service_PsCMaps psnames )
|
FT_Service_PsCMaps psnames )
|
||||||
{
|
{
|
||||||
|
/* value 0xFFFFU indicates a missing dictionary entry */
|
||||||
|
if ( sid == 0xFFFFU )
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* if it is not a standard string, return it */
|
/* if it is not a standard string, return it */
|
||||||
if ( sid > 390 )
|
if ( sid > 390 )
|
||||||
return cff_index_get_name( idx, sid - 391 );
|
return cff_index_get_name( idx, sid - 391 );
|
||||||
|
|
||||||
|
/* CID-keyed CFF fonts don't have glyph names */
|
||||||
|
if ( !psnames )
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* that's a standard string, fetch a copy from the PSName module */
|
/* that's a standard string, fetch a copy from the PSName module */
|
||||||
{
|
{
|
||||||
FT_String* name = 0;
|
FT_String* name = 0;
|
||||||
|
@ -1967,6 +1975,20 @@
|
||||||
top->font_matrix.yy = 0x10000L;
|
top->font_matrix.yy = 0x10000L;
|
||||||
top->cid_count = 8720;
|
top->cid_count = 8720;
|
||||||
|
|
||||||
|
/* we use the implementation specific SID value 0xFFFF to indicate */
|
||||||
|
/* missing entries */
|
||||||
|
top->version = 0xFFFFU;
|
||||||
|
top->notice = 0xFFFFU;
|
||||||
|
top->copyright = 0xFFFFU;
|
||||||
|
top->full_name = 0xFFFFU;
|
||||||
|
top->family_name = 0xFFFFU;
|
||||||
|
top->weight = 0xFFFFU;
|
||||||
|
top->embedded_postscript = 0xFFFFU;
|
||||||
|
|
||||||
|
top->cid_registry = 0xFFFFU;
|
||||||
|
top->cid_ordering = 0xFFFFU;
|
||||||
|
top->cid_font_name = 0xFFFFU;
|
||||||
|
|
||||||
error = cff_index_access_element( idx, font_index, &dict, &dict_len ) ||
|
error = cff_index_access_element( idx, font_index, &dict, &dict_len ) ||
|
||||||
cff_parser_run( &parser, dict, dict + dict_len );
|
cff_parser_run( &parser, dict, dict + dict_len );
|
||||||
|
|
||||||
|
@ -1976,7 +1998,7 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
/* if it is a CID font, we stop there */
|
/* if it is a CID font, we stop there */
|
||||||
if ( top->cid_registry )
|
if ( top->cid_registry != 0xFFFFU )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
/* parse the private dictionary, if any */
|
/* parse the private dictionary, if any */
|
||||||
|
@ -2118,7 +2140,7 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
/* now, check for a CID font */
|
/* now, check for a CID font */
|
||||||
if ( dict->cid_registry )
|
if ( dict->cid_registry != 0xFFFFU )
|
||||||
{
|
{
|
||||||
CFF_IndexRec fd_index;
|
CFF_IndexRec fd_index;
|
||||||
CFF_SubFont sub;
|
CFF_SubFont sub;
|
||||||
|
@ -2199,7 +2221,7 @@
|
||||||
if ( error )
|
if ( error )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
/* read the Charset and Encoding tables when available */
|
/* read the Charset and Encoding tables if available */
|
||||||
if ( font->num_glyphs > 0 )
|
if ( font->num_glyphs > 0 )
|
||||||
{
|
{
|
||||||
error = cff_charset_load( &font->charset, font->num_glyphs, stream,
|
error = cff_charset_load( &font->charset, font->num_glyphs, stream,
|
||||||
|
@ -2207,6 +2229,9 @@
|
||||||
if ( error )
|
if ( error )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
|
/* CID-keyed CFFs don't have an encoding */
|
||||||
|
if ( dict->cid_registry == 0xFFFFU )
|
||||||
|
{
|
||||||
error = cff_encoding_load( &font->encoding,
|
error = cff_encoding_load( &font->encoding,
|
||||||
&font->charset,
|
&font->charset,
|
||||||
font->num_glyphs,
|
font->num_glyphs,
|
||||||
|
@ -2216,8 +2241,10 @@
|
||||||
if ( error )
|
if ( error )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* get the font name */
|
/* get the font name (/CIDFontName for CID-keyed fonts, */
|
||||||
|
/* /FontName otherwise) */
|
||||||
font->font_name = cff_index_get_name( &font->name_index, face_index );
|
font->font_name = cff_index_get_name( &font->name_index, face_index );
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
|
|
|
@ -244,8 +244,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( FT_Error )
|
FT_LOCAL_DEF( FT_Error )
|
||||||
cff_face_init( FT_Stream stream,
|
cff_face_init( FT_Stream stream,
|
||||||
CFF_Face face,
|
CFF_Face face,
|
||||||
|
@ -300,7 +298,7 @@
|
||||||
sfnt_format = 1;
|
sfnt_format = 1;
|
||||||
|
|
||||||
/* now, the font can be either an OpenType/CFF font, or an SVG CEF */
|
/* now, the font can be either an OpenType/CFF font, or an SVG CEF */
|
||||||
/* font; in the later case it doesn't have a `head' table */
|
/* font; in the latter case it doesn't have a `head' table */
|
||||||
error = face->goto_table( face, TTAG_head, stream, 0 );
|
error = face->goto_table( face, TTAG_head, stream, 0 );
|
||||||
if ( !error )
|
if ( !error )
|
||||||
{
|
{
|
||||||
|
@ -365,10 +363,12 @@
|
||||||
if ( pure_cff )
|
if ( pure_cff )
|
||||||
{
|
{
|
||||||
CFF_FontRecDict dict = &cff->top_font.font_dict;
|
CFF_FontRecDict dict = &cff->top_font.font_dict;
|
||||||
|
char* style_name;
|
||||||
|
|
||||||
|
|
||||||
/* we need the `PSNames' module for pure-CFF and CEF formats */
|
/* we need the `PSNames' module for pure-CFF and CEF formats */
|
||||||
if ( !psnames )
|
/* which aren't CID-keyed */
|
||||||
|
if ( dict->cid_registry == 0xFFFFU && !psnames )
|
||||||
{
|
{
|
||||||
FT_ERROR(( "cff_face_init:" ));
|
FT_ERROR(( "cff_face_init:" ));
|
||||||
FT_ERROR(( " cannot open CFF & CEF fonts\n" ));
|
FT_ERROR(( " cannot open CFF & CEF fonts\n" ));
|
||||||
|
@ -381,7 +381,7 @@
|
||||||
root->num_faces = cff->num_faces;
|
root->num_faces = cff->num_faces;
|
||||||
|
|
||||||
/* compute number of glyphs */
|
/* compute number of glyphs */
|
||||||
if ( dict->cid_registry )
|
if ( dict->cid_registry != 0xFFFFU )
|
||||||
root->num_glyphs = dict->cid_count;
|
root->num_glyphs = dict->cid_count;
|
||||||
else
|
else
|
||||||
root->num_glyphs = cff->charstrings_index.count;
|
root->num_glyphs = cff->charstrings_index.count;
|
||||||
|
@ -392,7 +392,6 @@
|
||||||
root->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
|
root->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
|
||||||
root->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
|
root->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
|
||||||
|
|
||||||
|
|
||||||
root->ascender = (FT_Short)( root->bbox.yMax );
|
root->ascender = (FT_Short)( root->bbox.yMax );
|
||||||
root->descender = (FT_Short)( root->bbox.yMin );
|
root->descender = (FT_Short)( root->bbox.yMin );
|
||||||
root->height = (FT_Short)(
|
root->height = (FT_Short)(
|
||||||
|
@ -409,13 +408,59 @@
|
||||||
(FT_Short)( dict->underline_thickness >> 16 );
|
(FT_Short)( dict->underline_thickness >> 16 );
|
||||||
|
|
||||||
/* retrieve font family & style name */
|
/* retrieve font family & style name */
|
||||||
root->family_name = cff_index_get_name( &cff->name_index, face_index );
|
root->family_name = cff_index_get_name( &cff->name_index,
|
||||||
if ( dict->cid_registry )
|
face_index );
|
||||||
root->style_name = cff_strcpy( memory, "Regular" ); /* XXXX */
|
|
||||||
else
|
/* assume "Regular" style if we don't know better */
|
||||||
root->style_name = cff_index_get_sid_string( &cff->string_index,
|
style_name = (char *)"Regular";
|
||||||
dict->weight,
|
|
||||||
|
if ( root->family_name )
|
||||||
|
{
|
||||||
|
char* full = cff_index_get_sid_string( &cff->string_index,
|
||||||
|
dict->full_name,
|
||||||
psnames );
|
psnames );
|
||||||
|
char* family = root->family_name;
|
||||||
|
|
||||||
|
|
||||||
|
if ( full )
|
||||||
|
{
|
||||||
|
while ( *full )
|
||||||
|
{
|
||||||
|
if ( *full == *family )
|
||||||
|
{
|
||||||
|
family++;
|
||||||
|
full++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( *full == ' ' || *full == '-' )
|
||||||
|
full++;
|
||||||
|
else if ( *family == ' ' || *family == '-' )
|
||||||
|
family++;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( !*family )
|
||||||
|
style_name = full;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *cid_font_name =
|
||||||
|
cff_index_get_sid_string( &cff->string_index,
|
||||||
|
dict->cid_font_name,
|
||||||
|
psnames );
|
||||||
|
|
||||||
|
|
||||||
|
/* do we have a `/FontName' for a CID-keyed font? */
|
||||||
|
if ( cid_font_name )
|
||||||
|
root->family_name = cid_font_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
root->style_name = cff_strcpy( memory, style_name );
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* */
|
/* */
|
||||||
|
@ -453,9 +498,17 @@
|
||||||
if ( dict->italic_angle )
|
if ( dict->italic_angle )
|
||||||
flags |= FT_STYLE_FLAG_ITALIC;
|
flags |= FT_STYLE_FLAG_ITALIC;
|
||||||
|
|
||||||
/* XXX: may not be correct */
|
{
|
||||||
if ( cff->top_font.private_dict.force_bold )
|
char *weight = cff_index_get_sid_string( &cff->string_index,
|
||||||
|
dict->weight,
|
||||||
|
psnames );
|
||||||
|
|
||||||
|
|
||||||
|
if ( weight )
|
||||||
|
if ( !ft_strcmp( weight, "Bold" ) ||
|
||||||
|
!ft_strcmp( weight, "Black" ) )
|
||||||
flags |= FT_STYLE_FLAG_BOLD;
|
flags |= FT_STYLE_FLAG_BOLD;
|
||||||
|
}
|
||||||
|
|
||||||
root->style_flags = flags;
|
root->style_flags = flags;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,10 @@
|
||||||
CFF_FIELD_NUM ( 17, charstrings_offset )
|
CFF_FIELD_NUM ( 17, charstrings_offset )
|
||||||
CFF_FIELD_CALLBACK( 18, private_dict )
|
CFF_FIELD_CALLBACK( 18, private_dict )
|
||||||
CFF_FIELD_NUM ( 0x114, synthetic_base )
|
CFF_FIELD_NUM ( 0x114, synthetic_base )
|
||||||
CFF_FIELD_STRING ( 0x115, postscript )
|
CFF_FIELD_STRING ( 0x115, embedded_postscript )
|
||||||
CFF_FIELD_STRING ( 0x116, base_font_name )
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
CFF_FIELD_STRING ( 0x116, base_font_name )
|
||||||
CFF_FIELD_DELTA ( 0x117, base_font_blend, 16 )
|
CFF_FIELD_DELTA ( 0x117, base_font_blend, 16 )
|
||||||
CFF_FIELD_CALLBACK( 0x118, multiple_master )
|
CFF_FIELD_CALLBACK( 0x118, multiple_master )
|
||||||
CFF_FIELD_CALLBACK( 0x119, blend_axit_types )
|
CFF_FIELD_CALLBACK( 0x119, blend_axit_types )
|
||||||
|
|
|
@ -113,8 +113,6 @@ FT_BEGIN_HEADER
|
||||||
FT_ULong private_size;
|
FT_ULong private_size;
|
||||||
FT_Long synthetic_base;
|
FT_Long synthetic_base;
|
||||||
FT_UInt embedded_postscript;
|
FT_UInt embedded_postscript;
|
||||||
FT_UInt base_font_name;
|
|
||||||
FT_UInt postscript;
|
|
||||||
|
|
||||||
/* these should only be used for the top-level font dictionary */
|
/* these should only be used for the top-level font dictionary */
|
||||||
FT_UInt cid_registry;
|
FT_UInt cid_registry;
|
||||||
|
|
Loading…
Reference in New Issue