freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype-demos][master] [ftgrid,ftmulti,ftstring,ftview]


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype-demos][master] [ftgrid,ftmulti,ftstring,ftview] Make the size optional.
Date: Fri, 05 Aug 2022 02:43:17 +0000

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

Commits:

  • 8b42378c
    by Alexei Podtelezhnikov at 2022-08-04T22:34:47-04:00
    [ftgrid,ftmulti,ftstring,ftview] Make the size optional.
    
    * src/ftgrid.c (parse_cmdline), src/ftview.c (parse_cmdline),
    src/ftstring.c (parse_cmdline), src/ftmulti.c (main): Fallback on
    a default size if it is missing on the command line.
    

4 changed files:

Changes:

  • src/ftgrid.c
    ... ... @@ -1797,18 +1797,20 @@
    1797 1797
         *argc -= optind;
    
    1798 1798
         *argv += optind;
    
    1799 1799
     
    
    1800
    -    if ( *argc <= 1 )
    
    1800
    +    if ( *argc == 0 )
    
    1801 1801
           usage( execname );
    
    1802 1802
     
    
    1803
    +    if ( *argc > 1                                                 &&
    
    1804
    +         ( status.ptsize = (int)( atof( *argv[0] ) * 64.0 ) ) != 0 )
    
    1805
    +    {
    
    1806
    +      (*argc)--;
    
    1807
    +      (*argv)++;
    
    1808
    +    }
    
    1809
    +    else
    
    1810
    +      status.ptsize = 32 * 64 ;
    
    1811
    +
    
    1803 1812
         if ( have_encoding && !have_index )
    
    1804 1813
           status.Num = 0x20;
    
    1805
    -
    
    1806
    -    status.ptsize = (int)( atof( *argv[0] ) * 64.0 );
    
    1807
    -    if ( status.ptsize == 0 )
    
    1808
    -      status.ptsize = 64 * 10;
    
    1809
    -
    
    1810
    -    (*argc)--;
    
    1811
    -    (*argv)++;
    
    1812 1814
       }
    
    1813 1815
     
    
    1814 1816
     
    

  • src/ftmulti.c
    ... ... @@ -1048,13 +1048,18 @@
    1048 1048
         argc -= optind;
    
    1049 1049
         argv += optind;
    
    1050 1050
     
    
    1051
    -    if ( argc <= 1 )
    
    1051
    +    if ( argc == 0 )
    
    1052 1052
           usage( execname );
    
    1053 1053
     
    
    1054
    -    if ( sscanf( argv[0], "%d", &orig_ptsize ) != 1 )
    
    1054
    +    if ( argc > 1 && sscanf( argv[0], "%d", &orig_ptsize ) == 1 )
    
    1055
    +    {
    
    1056
    +      argc--;
    
    1057
    +      argv++;
    
    1058
    +    }
    
    1059
    +    else
    
    1055 1060
           orig_ptsize = 64;
    
    1056 1061
     
    
    1057
    -    file = 1;
    
    1062
    +    file = 0;
    
    1058 1063
     
    
    1059 1064
       NewFile:
    
    1060 1065
         ptsize      = orig_ptsize;
    
    ... ... @@ -1307,7 +1312,7 @@
    1307 1312
             if ( file_loaded >= 1 )
    
    1308 1313
               FT_Done_Face( face );
    
    1309 1314
     
    
    1310
    -        if ( file > 1 )
    
    1315
    +        if ( file > 0 )
    
    1311 1316
               file--;
    
    1312 1317
     
    
    1313 1318
             goto NewFile;
    

  • src/ftstring.c
    ... ... @@ -763,15 +763,17 @@
    763 763
         *argc -= optind;
    
    764 764
         *argv += optind;
    
    765 765
     
    
    766
    -    if ( *argc <= 1 )
    
    766
    +    if ( *argc == 0 )
    
    767 767
           usage( execname );
    
    768 768
     
    
    769
    -    status.ptsize = (int)( atof( *argv[0] ) * 64.0 );
    
    770
    -    if ( status.ptsize == 0 )
    
    771
    -      status.ptsize = 64;
    
    772
    -
    
    773
    -    (*argc)--;
    
    774
    -    (*argv)++;
    
    769
    +    if ( *argc > 1                                                 &&
    
    770
    +         ( status.ptsize = (int)( atof( *argv[0] ) * 64.0 ) ) != 0 )
    
    771
    +    {
    
    772
    +      (*argc)--;
    
    773
    +      (*argv)++;
    
    774
    +    }
    
    775
    +    else
    
    776
    +      status.ptsize = 32 * 64 ;
    
    775 777
       }
    
    776 778
     
    
    777 779
     
    

  • src/ftview.c
    ... ... @@ -1805,15 +1805,17 @@
    1805 1805
         *argc -= optind;
    
    1806 1806
         *argv += optind;
    
    1807 1807
     
    
    1808
    -    if ( *argc <= 1 )
    
    1808
    +    if ( *argc == 0 )
    
    1809 1809
           usage( execname );
    
    1810 1810
     
    
    1811
    -    status.ptsize = (int)( atof( *argv[0] ) * 64.0 );
    
    1812
    -    if ( status.ptsize == 0 )
    
    1813
    -      status.ptsize = 64 * 10;
    
    1814
    -
    
    1815
    -    (*argc)--;
    
    1816
    -    (*argv)++;
    
    1811
    +    if ( *argc > 1                                                 &&
    
    1812
    +         ( status.ptsize = (int)( atof( *argv[0] ) * 64.0 ) ) != 0 )
    
    1813
    +    {
    
    1814
    +      (*argc)--;
    
    1815
    +      (*argv)++;
    
    1816
    +    }
    
    1817
    +    else
    
    1818
    +      status.ptsize = 32 * 64 ;
    
    1817 1819
       }
    
    1818 1820
     
    
    1819 1821
     
    


  • reply via email to

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