* src/sfnt/sfobjs.c (sfnt_load_face): Support bit 9 and prepare

support for bit 8 in the `OS/2' table.  MS is already using this;
hopefully, this becomes part of OpenType 1.5.
Prepare also support for `name' IDs 21 (WWS_FAMILY) and 22
(WWS_SUBFAMILY).
This commit is contained in:
Werner Lemberg 2007-10-21 08:12:30 +00:00
parent 6684257742
commit 7d9c189ac2
3 changed files with 76 additions and 17 deletions

View File

@ -1,3 +1,11 @@
2006-10-21 Werner Lemberg <wl@gnu.org>
* src/sfnt/sfobjs.c (sfnt_load_face): Support bit 9 and prepare
support for bit 8 in the `OS/2' table. MS is already using this;
hopefully, this becomes part of OpenType 1.5.
Prepare also support for `name' IDs 21 (WWS_FAMILY) and 22
(WWS_SUBFAMILY).
2006-10-20 Werner Lemberg <wl@gnu.org> 2006-10-20 Werner Lemberg <wl@gnu.org>
* src/tools/docmaker/tohtml.py (html_header_2): Fix typo. * src/tools/docmaker/tohtml.py (html_header_2): Fix typo.

View File

@ -1198,11 +1198,17 @@ FT_BEGIN_HEADER
/* */ /* */
/* <Values> */ /* <Values> */
/* FT_STYLE_FLAG_ITALIC :: */ /* FT_STYLE_FLAG_ITALIC :: */
/* Indicates that a given face is italicized. */ /* Indicates that a given face style is italic or oblique. */
/* */ /* */
/* FT_STYLE_FLAG_BOLD :: */ /* FT_STYLE_FLAG_BOLD :: */
/* Indicates that a given face is bold. */ /* Indicates that a given face is bold. */
/* */ /* */
/* <Note> */
/* The style information as provided by FreeType is very basic. More */
/* details are beyond the scope and should be done on a higher level */
/* (for example, by analyzing various fields of the `OS/2' table in */
/* SFNT based fonts). */
/* */
#define FT_STYLE_FLAG_ITALIC ( 1 << 0 ) #define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
#define FT_STYLE_FLAG_BOLD ( 1 << 1 ) #define FT_STYLE_FLAG_BOLD ( 1 << 1 )

View File

@ -696,22 +696,60 @@
face->root.num_glyphs = face->max_profile.numGlyphs; face->root.num_glyphs = face->max_profile.numGlyphs;
face->root.family_name = tt_face_get_name( face, #if 0
TT_NAME_ID_PREFERRED_FAMILY ); /* Bit 8 of the `fsSelection' field in the `OS/2' table denotes */
if ( !face->root.family_name ) /* a WWS-only font face. `WWS' stands for `weight', width', and */
face->root.family_name = tt_face_get_name( face, /* `slope', a term used by Microsoft's Windows Presentation */
TT_NAME_ID_FONT_FAMILY ); /* Foundation (WPF). This flag will be introduced in version */
/* 1.5 of the OpenType specification (but is already in use). */
if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 256 )
#endif
{
face->root.family_name =
tt_face_get_name( face, TT_NAME_ID_PREFERRED_FAMILY );
if ( !face->root.family_name )
face->root.family_name =
tt_face_get_name( face, TT_NAME_ID_FONT_FAMILY );
face->root.style_name =
tt_face_get_name( face, TT_NAME_ID_PREFERRED_SUBFAMILY );
if ( !face->root.style_name )
face->root.style_name =
tt_face_get_name( face, TT_NAME_ID_FONT_SUBFAMILY );
}
#if 0
else
{
/* Support for `name' table ID 21 (WWS family) and 22 (WWS */
/* subfamily) is still under consideration by Microsoft and */
/* not implemented in the current version of WPF. */
face->root.family_name =
tt_face_get_name( face, TT_NAME_ID_WWS_FAMILY );
if ( !face->root.family_name )
face->root.family_name =
tt_face_get_name( face, TT_NAME_ID_PREFERRED_FAMILY );
if ( !face->root.family_name )
face->root.family_name =
tt_face_get_name( face, TT_NAME_ID_FONT_FAMILY );
face->root.style_name =
tt_face_get_name( face, TT_NAME_ID_WWS_SUBFAMILY );
if ( !face->root.style_name )
face->root.style_name =
tt_face_get_name( face, TT_NAME_ID_PREFERRED_SUBFAMILY );
if ( !face->root.style_name )
face->root.style_name =
tt_face_get_name( face, TT_NAME_ID_FONT_SUBFAMILY );
}
#endif
face->root.style_name = tt_face_get_name( face,
TT_NAME_ID_PREFERRED_SUBFAMILY );
if ( !face->root.style_name )
face->root.style_name = tt_face_get_name( face,
TT_NAME_ID_FONT_SUBFAMILY );
/* now set up root fields */ /* now set up root fields */
{ {
FT_Face root = &face->root; FT_Face root = &face->root;
FT_Int32 flags = root->face_flags; FT_Int32 flags = root->face_flags;
/*********************************************************************/ /*********************************************************************/
@ -727,7 +765,7 @@
FT_FACE_FLAG_HORIZONTAL; /* horizontal data */ FT_FACE_FLAG_HORIZONTAL; /* horizontal data */
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
if ( psnames_error == SFNT_Err_Ok && if ( psnames_error == SFNT_Err_Ok &&
face->postscript.FormatType != 0x00030000L ) face->postscript.FormatType != 0x00030000L )
flags |= FT_FACE_FLAG_GLYPH_NAMES; flags |= FT_FACE_FLAG_GLYPH_NAMES;
#endif #endif
@ -759,14 +797,21 @@
/* */ /* */
/* Compute style flags. */ /* Compute style flags. */
/* */ /* */
flags = 0; flags = 0;
if ( has_outline == TRUE && face->os2.version != 0xFFFFU ) if ( has_outline == TRUE && face->os2.version != 0xFFFFU )
{ {
/* we have an OS/2 table; use the `fsSelection' field */ /* We have an OS/2 table; use the `fsSelection' field. Bit 9 */
if ( face->os2.fsSelection & 1 ) /* indicates an oblique font face. This flag will be */
/* introduced in version 1.5 of the OpenType specification (but */
/* is already in use). */
if ( face->os2.fsSelection & 512 ) /* bit 9 */
flags |= FT_STYLE_FLAG_ITALIC;
else if ( face->os2.fsSelection & 1 ) /* bit 0 */
flags |= FT_STYLE_FLAG_ITALIC; flags |= FT_STYLE_FLAG_ITALIC;
if ( face->os2.fsSelection & 32 ) if ( face->os2.fsSelection & 32 ) /* bit 5 */
flags |= FT_STYLE_FLAG_BOLD; flags |= FT_STYLE_FLAG_BOLD;
} }
else else