freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype-demos][master] [ftdump] Emit PS dictionary info


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype-demos][master] [ftdump] Emit PS dictionary info for option `-n` if available.
Date: Fri, 11 Feb 2022 18:16:49 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType Demo Programs

Commits:

1 changed file:

Changes:

  • src/ftdump.c
    ... ... @@ -13,6 +13,7 @@
    13 13
     #include FT_SFNT_NAMES_H
    
    14 14
     #include FT_TRUETYPE_IDS_H
    
    15 15
     #include FT_TRUETYPE_TABLES_H
    
    16
    +#include FT_TYPE1_TABLES_H
    
    16 17
     #include FT_TRUETYPE_TAGS_H
    
    17 18
     #include FT_MULTIPLE_MASTERS_H
    
    18 19
     #include FT_BDF_H
    
    ... ... @@ -76,6 +77,24 @@
    76 77
       }
    
    77 78
     
    
    78 79
     
    
    80
    +  static void
    
    81
    +  Print_Array( FT_Short*  data,
    
    82
    +               FT_Byte    num_data )
    
    83
    +  {
    
    84
    +    FT_Int  i;
    
    85
    +
    
    86
    +
    
    87
    +    printf( "[" );
    
    88
    +    if ( num_data )
    
    89
    +    {
    
    90
    +      printf( "%d", data[0] );
    
    91
    +      for ( i = 1; i < num_data; i++ )
    
    92
    +        printf( ", %d", data[i] );
    
    93
    +    }
    
    94
    +    printf( "]\n" );
    
    95
    +  }
    
    96
    +
    
    97
    +
    
    79 98
       static void
    
    80 99
       usage( FT_Library  library,
    
    81 100
              char*       execname )
    
    ... ... @@ -93,7 +112,7 @@
    93 112
     
    
    94 113
         fprintf( stderr,
    
    95 114
           "  -c, -C    Print charmap coverage.\n"
    
    96
    -      "  -n        Print SFNT name tables.\n"
    
    115
    +      "  -n        Print SFNT 'name' table or Type1 font info.\n"
    
    97 116
           "  -p        Print TrueType programs.\n"
    
    98 117
           "  -t        Print SFNT table list.\n"
    
    99 118
           "  -u        Emit UTF8.\n"
    
    ... ... @@ -432,6 +451,88 @@
    432 451
       }
    
    433 452
     
    
    434 453
     
    
    454
    +  static void
    
    455
    +  Print_FontInfo_Dictionary( PS_FontInfo  fi )
    
    456
    +  {
    
    457
    +    printf( "/FontInfo dictionary\n" );
    
    458
    +
    
    459
    +    printf( "%s%s\n", Name_Field( "FamilyName" ),
    
    460
    +            fi->family_name );
    
    461
    +    printf( "%s%s\n", Name_Field( "FullName" ),
    
    462
    +            fi->full_name );
    
    463
    +    printf( "%s%d\n", Name_Field( "isFixedPitch" ),
    
    464
    +            fi->is_fixed_pitch );
    
    465
    +    printf( "%s%ld\n", Name_Field( "ItalicAngle" ),
    
    466
    +            fi->italic_angle );
    
    467
    +    printf( "%s%s\n", Name_Field( "Notice" ),
    
    468
    +            fi->notice );
    
    469
    +    printf( "%s%d\n", Name_Field( "UnderlinePosition" ),
    
    470
    +            fi->underline_position );
    
    471
    +    printf( "%s%u\n", Name_Field( "UnderlineThickness" ),
    
    472
    +            fi->underline_thickness );
    
    473
    +    printf( "%s%s\n", Name_Field( "version" ),
    
    474
    +            fi->version );
    
    475
    +    printf( "%s%s\n", Name_Field( "Weight" ),
    
    476
    +            fi->weight );
    
    477
    +  }
    
    478
    +
    
    479
    +
    
    480
    +  static void
    
    481
    +  Print_FontPrivate_Dictionary( PS_Private  fp )
    
    482
    +  {
    
    483
    +    printf( "/Private dictionary\n" );
    
    484
    +
    
    485
    +    printf( "%s%d\n", Name_Field( "BlueFuzz" ),
    
    486
    +            fp->blue_fuzz );
    
    487
    +    printf( "%s%.6f\n", Name_Field( "BlueScale" ),
    
    488
    +            (double)fp->blue_scale / 65536 / 1000 );
    
    489
    +    printf( "%s%d\n", Name_Field( "BlueShift" ),
    
    490
    +            fp->blue_shift );
    
    491
    +    printf( "%s", Name_Field( "BlueValues" ) );
    
    492
    +    Print_Array( fp->blue_values,
    
    493
    +                 fp->num_blue_values );
    
    494
    +    printf( "%s%.4f\n", Name_Field( "ExpansionFactor" ),
    
    495
    +            (double)fp->expansion_factor / 65536 );
    
    496
    +    printf( "%s", Name_Field( "FamilyBlues" ) );
    
    497
    +    Print_Array( fp->family_blues,
    
    498
    +                 fp->num_family_blues );
    
    499
    +    printf( "%s", Name_Field( "FamilyOtherBlues" ) );
    
    500
    +    Print_Array( fp->family_other_blues,
    
    501
    +                 fp->num_family_other_blues );
    
    502
    +    printf( "%s%s\n", Name_Field( "ForceBold" ),
    
    503
    +            fp->force_bold ? "true" : "false" );
    
    504
    +    printf( "%s%ld\n", Name_Field( "LanguageGroup" ),
    
    505
    +            fp->language_group );
    
    506
    +    printf( "%s%d\n", Name_Field( "lenIV" ),
    
    507
    +            fp->lenIV );
    
    508
    +    printf( "%s", Name_Field( "MinFeature" ) );
    
    509
    +    Print_Array( fp->min_feature,
    
    510
    +                 2 );
    
    511
    +    printf( "%s", Name_Field( "OtherBlues" ) );
    
    512
    +    Print_Array( fp->other_blues,
    
    513
    +                 fp->num_other_blues );
    
    514
    +    printf( "%s%ld\n", Name_Field( "password" ),
    
    515
    +            fp->password );
    
    516
    +    printf( "%s%s\n", Name_Field( "RndStemUp" ),
    
    517
    +            fp->round_stem_up ? "true" : "false" );
    
    518
    +    /* casting to `FT_Short` is not really correct, but... */
    
    519
    +    printf( "%s", Name_Field( "StdHW" ) );
    
    520
    +    Print_Array( (FT_Short*)fp->standard_width,
    
    521
    +                 1 );
    
    522
    +    printf( "%s", Name_Field( "StdVW" ) );
    
    523
    +    Print_Array( (FT_Short*)fp->standard_height,
    
    524
    +                 1 );
    
    525
    +    printf( "%s", Name_Field( "StemSnapH" ) );
    
    526
    +    Print_Array( fp->snap_widths,
    
    527
    +                 fp->num_snap_widths );
    
    528
    +    printf( "%s", Name_Field( "StemSnapV" ) );
    
    529
    +    Print_Array( fp->snap_heights,
    
    530
    +                 fp->num_snap_heights );
    
    531
    +    printf( "%s%d\n", Name_Field( "UniqueID" ),
    
    532
    +            fp->unique_id );
    
    533
    +  }
    
    534
    +
    
    535
    +
    
    435 536
       static void
    
    436 537
       Print_Sfnt_Tables( FT_Face  face )
    
    437 538
       {
    
    ... ... @@ -1199,10 +1300,29 @@
    1199 1300
           printf( "\n" );
    
    1200 1301
           Print_Type( face );
    
    1201 1302
     
    
    1202
    -      if ( name_tables && FT_IS_SFNT( face ) )
    
    1303
    +      if ( name_tables )
    
    1203 1304
           {
    
    1204
    -        printf( "\n" );
    
    1205
    -        Print_Sfnt_Names( face );
    
    1305
    +        PS_FontInfoRec  font_info;
    
    1306
    +        PS_PrivateRec   font_private;
    
    1307
    +
    
    1308
    +
    
    1309
    +        if ( FT_IS_SFNT( face ) )
    
    1310
    +        {
    
    1311
    +          printf( "\n" );
    
    1312
    +          Print_Sfnt_Names( face );
    
    1313
    +        }
    
    1314
    +
    
    1315
    +        if ( FT_Get_PS_Font_Info( face, &font_info ) == FT_Err_Ok )
    
    1316
    +        {
    
    1317
    +          printf( "\n" );
    
    1318
    +          Print_FontInfo_Dictionary( &font_info );
    
    1319
    +        }
    
    1320
    +
    
    1321
    +        if ( FT_Get_PS_Font_Private( face, &font_private ) == FT_Err_Ok )
    
    1322
    +        {
    
    1323
    +          printf( "\n" );
    
    1324
    +          Print_FontPrivate_Dictionary( &font_private );
    
    1325
    +        }
    
    1206 1326
           }
    
    1207 1327
     
    
    1208 1328
           if ( tables && FT_IS_SFNT( face ) )
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]