freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype-demos][master] * bin/ftlint.c (main): Implement


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype-demos][master] * bin/ftlint.c (main): Implement limited indexing.
Date: Mon, 14 Jun 2021 03:38:41 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType Demo Programs

Commits:

2 changed files:

Changes:

  • ChangeLog
    1
    +2021-06-14  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2
    +
    
    3
    +	* bin/ftlint.c (main): Implement limited indexing.
    
    4
    +	(Usage): Document it.
    
    5
    +
    
    1 6
     2021-06-13  Sarthak Bhardwaj  <1sarthakbhardwaj@gmail.com>
    
    2 7
                 Anurag Thakur  <devanuragthakur@gmail.com>
    
    3 8
     
    

  • src/ftlint.c
    ... ... @@ -39,7 +39,6 @@
    39 39
       static FT_Render_Mode  render_mode = FT_RENDER_MODE_NORMAL;
    
    40 40
       static FT_Int32        load_flags  = FT_LOAD_DEFAULT;
    
    41 41
     
    
    42
    -  static unsigned int  num_glyphs;
    
    43 42
       static int           ptsize;
    
    44 43
     
    
    45 44
       static int  Fail;
    
    ... ... @@ -54,8 +53,9 @@
    54 53
         printf( "Usage: %s [options] ppem fontname[.ttf|.ttc] [fontname2..]\n",
    
    55 54
                 name );
    
    56 55
         printf( "\n" );
    
    57
    -    printf( "  -f L   Use hex number L as load flags (see `FT_LOAD_XXX').\n" );
    
    58
    -    printf( "  -r N   Set render mode to N\n" );
    
    56
    +    printf( "  -f L    Use hex number L as load flags (see `FT_LOAD_XXX')\n" );
    
    57
    +    printf( "  -r N    Set render mode to N\n" );
    
    58
    +    printf( "  -i I-J  Range of glyph indices to use (default: all)\n" );
    
    59 59
     
    
    60 60
         exit( 1 );
    
    61 61
       }
    
    ... ... @@ -116,6 +116,8 @@
    116 116
         char*         execname;
    
    117 117
         char*         fname;
    
    118 118
         int           opt;
    
    119
    +    int           first_index = 0;
    
    120
    +    int           last_index = ~0;
    
    119 121
     
    
    120 122
     
    
    121 123
         execname = argv[0];
    
    ... ... @@ -123,7 +125,7 @@
    123 125
         if ( argc < 3 )
    
    124 126
           Usage( execname );
    
    125 127
     
    
    126
    -    while ( ( opt =  getopt( argc, argv, "f:r:") ) != -1)
    
    128
    +    while ( ( opt =  getopt( argc, argv, "f:r:i:") ) != -1)
    
    127 129
         {
    
    128 130
     
    
    129 131
           switch ( opt )
    
    ... ... @@ -145,6 +147,23 @@
    145 147
             }
    
    146 148
             break;
    
    147 149
     
    
    150
    +      case 'i':
    
    151
    +        {
    
    152
    +          int           j;
    
    153
    +          unsigned int  fi, li;
    
    154
    +
    
    155
    +          j = sscanf( optarg, "%u%*[,:-]%u", &fi, &li );
    
    156
    +
    
    157
    +          if ( j == 2 )
    
    158
    +          {
    
    159
    +            first_index = fi;
    
    160
    +            last_index  = li >= fi ? li : ~0;
    
    161
    +          }
    
    162
    +          else if ( j == 1 )
    
    163
    +            first_index = last_index = fi;
    
    164
    +        }
    
    165
    +        break;
    
    166
    +
    
    148 167
           default:
    
    149 168
             Usage( execname );
    
    150 169
             break;
    
    ... ... @@ -232,7 +251,11 @@
    232 251
           if (error) Panic( "Could not open file" );
    
    233 252
     
    
    234 253
       Success:
    
    235
    -      num_glyphs = (unsigned int)face->num_glyphs;
    
    254
    +      if ( first_index > (unsigned int)face->num_glyphs )
    
    255
    +        first_index = 0;
    
    256
    +      if ( last_index > (unsigned int)face->num_glyphs )
    
    257
    +        last_index = (unsigned int)face->num_glyphs - 1;
    
    258
    +
    
    236 259
     
    
    237 260
     #ifdef  TEST_PSNAMES
    
    238 261
           {
    
    ... ... @@ -248,7 +271,7 @@
    248 271
     
    
    249 272
           Fail = 0;
    
    250 273
           {
    
    251
    -        for ( id = 0; id < num_glyphs; id++ )
    
    274
    +        for ( id = first_index; id <= last_index; id++ )
    
    252 275
             {
    
    253 276
               error = FT_Load_Glyph( face, id, load_flags );
    
    254 277
               if ( error )
    


  • reply via email to

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