[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master 8b42378: [ftgrid, ftmulti, ftstring, ftview] Ma
From: |
Werner Lemberg |
Subject: |
[freetype2-demos] master 8b42378: [ftgrid, ftmulti, ftstring, ftview] Make the size optional. |
Date: |
Thu, 4 Aug 2022 22:43:26 -0400 (EDT) |
branch: master
commit 8b42378c3f41a4bef902c7c215c15bcc432c82a5
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
[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.
---
src/ftgrid.c | 18 ++++++++++--------
src/ftmulti.c | 13 +++++++++----
src/ftstring.c | 16 +++++++++-------
src/ftview.c | 16 +++++++++-------
4 files changed, 37 insertions(+), 26 deletions(-)
diff --git a/src/ftgrid.c b/src/ftgrid.c
index 080060b..df3701e 100644
--- a/src/ftgrid.c
+++ b/src/ftgrid.c
@@ -1797,18 +1797,20 @@
*argc -= optind;
*argv += optind;
- if ( *argc <= 1 )
+ if ( *argc == 0 )
usage( execname );
+ if ( *argc > 1 &&
+ ( status.ptsize = (int)( atof( *argv[0] ) * 64.0 ) ) != 0 )
+ {
+ (*argc)--;
+ (*argv)++;
+ }
+ else
+ status.ptsize = 32 * 64 ;
+
if ( have_encoding && !have_index )
status.Num = 0x20;
-
- status.ptsize = (int)( atof( *argv[0] ) * 64.0 );
- if ( status.ptsize == 0 )
- status.ptsize = 64 * 10;
-
- (*argc)--;
- (*argv)++;
}
diff --git a/src/ftmulti.c b/src/ftmulti.c
index 81b6f30..4c4508c 100644
--- a/src/ftmulti.c
+++ b/src/ftmulti.c
@@ -1048,13 +1048,18 @@
argc -= optind;
argv += optind;
- if ( argc <= 1 )
+ if ( argc == 0 )
usage( execname );
- if ( sscanf( argv[0], "%d", &orig_ptsize ) != 1 )
+ if ( argc > 1 && sscanf( argv[0], "%d", &orig_ptsize ) == 1 )
+ {
+ argc--;
+ argv++;
+ }
+ else
orig_ptsize = 64;
- file = 1;
+ file = 0;
NewFile:
ptsize = orig_ptsize;
@@ -1307,7 +1312,7 @@
if ( file_loaded >= 1 )
FT_Done_Face( face );
- if ( file > 1 )
+ if ( file > 0 )
file--;
goto NewFile;
diff --git a/src/ftstring.c b/src/ftstring.c
index 4699865..423abd3 100644
--- a/src/ftstring.c
+++ b/src/ftstring.c
@@ -763,15 +763,17 @@
*argc -= optind;
*argv += optind;
- if ( *argc <= 1 )
+ if ( *argc == 0 )
usage( execname );
- status.ptsize = (int)( atof( *argv[0] ) * 64.0 );
- if ( status.ptsize == 0 )
- status.ptsize = 64;
-
- (*argc)--;
- (*argv)++;
+ if ( *argc > 1 &&
+ ( status.ptsize = (int)( atof( *argv[0] ) * 64.0 ) ) != 0 )
+ {
+ (*argc)--;
+ (*argv)++;
+ }
+ else
+ status.ptsize = 32 * 64 ;
}
diff --git a/src/ftview.c b/src/ftview.c
index 0eeee8e..f3a2845 100644
--- a/src/ftview.c
+++ b/src/ftview.c
@@ -1805,15 +1805,17 @@
*argc -= optind;
*argv += optind;
- if ( *argc <= 1 )
+ if ( *argc == 0 )
usage( execname );
- status.ptsize = (int)( atof( *argv[0] ) * 64.0 );
- if ( status.ptsize == 0 )
- status.ptsize = 64 * 10;
-
- (*argc)--;
- (*argv)++;
+ if ( *argc > 1 &&
+ ( status.ptsize = (int)( atof( *argv[0] ) * 64.0 ) ) != 0 )
+ {
+ (*argc)--;
+ (*argv)++;
+ }
+ else
+ status.ptsize = 32 * 64 ;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master 8b42378: [ftgrid, ftmulti, ftstring, ftview] Make the size optional.,
Werner Lemberg <=