のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

style_flags

呼び出し履歴
sfnt_load_face
tt_face_init
open_face
FT_Open_Face
find_name_and_attributes
NameAndStyle
initSystemFontsLocked()
    834       /*********************************************************************/
    835       /*                                                                   */
    836       /* Compute style flags.                                              */
    837       /*                                                                   */
    838 
    839       flags = 0;
    840       if ( has_outline == TRUE && face->os2.version != 0xFFFFU )
    841       {
    842         /* We have an OS/2 table; use the `fsSelection' field.  Bit 9 */
    843         /* indicates an oblique font face.  This flag has been        */
    844         /* introduced in version 1.5 of the OpenType specification.   */
    845 
    846         if ( face->os2.fsSelection & 512 )       /* bit 9 */
    847           flags |= FT_STYLE_FLAG_ITALIC;
    848         else if ( face->os2.fsSelection & 1 )    /* bit 0 */
    849           flags |= FT_STYLE_FLAG_ITALIC;
    850 
    851         if ( face->os2.fsSelection & 32 )        /* bit 5 */
    852           flags |= FT_STYLE_FLAG_BOLD;
    853       }
    854       else
    855       {
    856         /* this is an old Mac font, use the header field */
    857 
    858         if ( face->header.Mac_Style & 1 )
    859           flags |= FT_STYLE_FLAG_BOLD;
    860 
    861         if ( face->header.Mac_Style & 2 )
    862           flags |= FT_STYLE_FLAG_ITALIC;
    863       }
    864 
    865       root->style_flags = flags;
   Filename:	Roboto-Bold.ttf
   OS2:fsSelection:32 <===== 0x20

   Filename:Roboto-BoldItalic.ttf
   OS2:fsSelection:33 <===== 0x21

   Filename:Roboto-Regular.ttf
   OS2:fsSelection:64 <===== 0x40
Bit # macStyle bit C definition Description
0 bit 1 ITALIC Font contains italic or oblique characters, otherwise they are upright.
1 ? UNDERSCORE Characters are underscored.
2 ? NEGATIVE Characters have their foreground and background reversed.
3 ? OUTLINED Outline (hollow) characters, otherwise they are solid.
4 ? STRIKEOUT Characters are overstruck.
5 bit 0 BOLD Characters are emboldened.
6 ? REGULAR Characters are in the standard weight/style for the font.
7 ? USE_TYPO_METRICS If set, it is strongly recommended to use OS/2.sTypoAscender - OS/2.sTypoDescender+ OS/2.sTypoLineGap as a value for default line spacing for this font.
8 ? WWS The font has ‘name’ table strings consistent with a weight/width/slope family without requiring use of ‘name’ IDs 21 and 22. (Please see more detailed description below.)
9 ? OBLIQUE Font contains oblique characters.