Yamano-uchi added support for SFNT-wrapped CID bitmap font files (with
minor modifications from WL).
This commit is contained in:
parent
29a90e2610
commit
9a814fabbf
|
@ -254,6 +254,7 @@
|
|||
FT_Parameter* params )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Bool missing_outline = 0;
|
||||
SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt;
|
||||
|
||||
FT_UNUSED( face_index );
|
||||
|
@ -262,27 +263,54 @@
|
|||
|
||||
|
||||
/* Load tables */
|
||||
if ( LOAD_( header ) ||
|
||||
LOAD_( max_profile ) ||
|
||||
|
||||
/* load the `hhea' & `hmtx' tables at once */
|
||||
( error = sfnt->load_metrics( face, stream, 0 ) ) != TT_Err_Ok ||
|
||||
/* If you load SFNT wrapped sbit font files, it will fail if you */
|
||||
/* want to read the `head', `hhea', and `vhea' tables. */
|
||||
/* */
|
||||
if ( LOAD_( header ) )
|
||||
{
|
||||
|
||||
/* try to load the `vhea' & `vmtx' at once if present */
|
||||
( error = sfnt->load_metrics( face, stream, 1 ) ) != TT_Err_Ok ||
|
||||
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||
missing_outline = 1;
|
||||
#else
|
||||
goto Exit;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
if ( LOAD_( max_profile ) ||
|
||||
LOAD_( charmaps ) ||
|
||||
LOAD_( names ) ||
|
||||
LOAD_( os2 ) ||
|
||||
LOAD_( psnames ) )
|
||||
goto Exit;
|
||||
|
||||
if ( /* load the `hhea' & `hmtx' tables at once */
|
||||
( ( error = sfnt->load_metrics( face, stream, 0 ) ) != TT_Err_Ok ) ||
|
||||
/* try to load the `vhea' & `vmtx' at once if present */
|
||||
( ( error = sfnt->load_metrics( face, stream, 1 ) ) != TT_Err_Ok ) ||
|
||||
LOAD_( os2 ) )
|
||||
{
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||
missing_outline = 1;
|
||||
#else
|
||||
goto Exit;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/* the optional tables */
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||
|
||||
/* embedded bitmap support. */
|
||||
if ( sfnt->load_sbits && LOAD_( sbits ) )
|
||||
{
|
||||
if ( !( ( error == TT_Err_Table_Missing ) && /* missing SBit */
|
||||
( missing_outline == 0 ) ) ) /* find outline */
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
||||
|
||||
if ( LOAD_( hdmx ) ||
|
||||
|
@ -302,7 +330,7 @@
|
|||
/* now set up root fields */
|
||||
{
|
||||
FT_Face root = &face->root;
|
||||
FT_Int flags;
|
||||
FT_Int flags = 0;
|
||||
TT_CharMap charmap;
|
||||
FT_Int n;
|
||||
FT_Memory memory;
|
||||
|
@ -314,8 +342,10 @@
|
|||
/* */
|
||||
/* Compute face flags. */
|
||||
/* */
|
||||
flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */
|
||||
FT_FACE_FLAG_SFNT | /* SFNT file format */
|
||||
if ( missing_outline == 0 )
|
||||
flags = FT_FACE_FLAG_SCALABLE; /* scalable outlines */
|
||||
|
||||
flags |= FT_FACE_FLAG_SFNT | /* SFNT file format */
|
||||
FT_FACE_FLAG_HORIZONTAL; /* horizontal data */
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
|
@ -343,7 +373,8 @@
|
|||
/* Compute style flags. */
|
||||
/* */
|
||||
flags = 0;
|
||||
|
||||
if ( missing_outline == 0 )
|
||||
{
|
||||
if ( face->os2.version != 0xFFFF )
|
||||
{
|
||||
/* we have an OS/2 table; use the `fsSelection' field */
|
||||
|
@ -362,6 +393,7 @@
|
|||
if ( face->header.Mac_Style & 2 )
|
||||
flags |= FT_STYLE_FLAG_ITALIC;
|
||||
}
|
||||
}
|
||||
|
||||
root->style_flags = flags;
|
||||
|
||||
|
@ -403,6 +435,15 @@
|
|||
|
||||
if ( face->num_sbit_strikes )
|
||||
{
|
||||
root->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
|
||||
#if 0
|
||||
/* I don't know criteria whether layout is horizontal or vertical */
|
||||
if ( missing_outline )
|
||||
{
|
||||
...
|
||||
root->face_flags |= FT_FACE_FLAG_VERTICAL;
|
||||
}
|
||||
#endif
|
||||
root->num_fixed_sizes = face->num_sbit_strikes;
|
||||
if ( ALLOC_ARRAY( root->available_sizes,
|
||||
face->num_sbit_strikes,
|
||||
|
@ -419,19 +460,21 @@
|
|||
}
|
||||
else
|
||||
|
||||
#else /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
||||
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
||||
|
||||
{
|
||||
root->num_fixed_sizes = 0;
|
||||
root->available_sizes = 0;
|
||||
}
|
||||
|
||||
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
||||
|
||||
/*********************************************************************/
|
||||
/* */
|
||||
/* Set up metrics. */
|
||||
/* */
|
||||
if ( missing_outline == 0 )
|
||||
{
|
||||
/* XXX What about if outline header is missing */
|
||||
/* (e.g. sfnt wrapped outline)? */
|
||||
root->bbox.xMin = face->header.xMin;
|
||||
root->bbox.yMin = face->header.yMin;
|
||||
root->bbox.xMax = face->header.xMax;
|
||||
|
@ -439,7 +482,9 @@
|
|||
root->units_per_EM = face->header.Units_Per_EM;
|
||||
|
||||
/* The ascender/descender/height are computed from the OS/2 table */
|
||||
/* when found. Otherwise, they're taken from the horizontal header. */
|
||||
/* when found. Otherwise, they're taken from the horizontal */
|
||||
/* header. */
|
||||
/* */
|
||||
if ( face->os2.version != 0xFFFF )
|
||||
{
|
||||
root->ascender = face->os2.sTypoAscender;
|
||||
|
@ -467,6 +512,7 @@
|
|||
/* root->max_points -- already set up */
|
||||
/* root->max_contours -- already set up */
|
||||
}
|
||||
}
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
|
|
|
@ -462,10 +462,7 @@
|
|||
if ( error )
|
||||
error = face->goto_table( face, TTAG_bloc, stream, 0 );
|
||||
if ( error )
|
||||
{
|
||||
error = 0;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
table_base = FILE_Pos();
|
||||
if ( ACCESS_Frame( 8L ) )
|
||||
|
|
|
@ -212,6 +212,7 @@
|
|||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
if ( face->root.face_flags & FT_FACE_FLAG_SCALABLE )
|
||||
error = TT_Load_Locations( face, stream ) ||
|
||||
TT_Load_CVT ( face, stream ) ||
|
||||
TT_Load_Programs ( face, stream );
|
||||
|
|
Loading…
Reference in New Issue