freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master 4ad8617: [ftgrid, ftview, ftstring] Enable batc


From: Alexei Podtelezhnikov
Subject: [freetype2-demos] master 4ad8617: [ftgrid, ftview, ftstring] Enable batch mode.
Date: Thu, 6 Jun 2019 22:44:24 -0400 (EDT)

branch: master
commit 4ad86176123f4397e971a3818cbbeb5547fedd6d
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>

    [ftgrid,ftview,ftstring] Enable batch mode.
    
    * src/ftcommon.[hc] (FTDemo_Display_New): Pass `device' argument.
    * src/{ftview,ftstring,ftgrid}.c (status): New `device' field.
    (parse_cmdline): Enable batch mode if keys end with `q'.
    * src/{ftview,ftstring,ftgrid}.1: Document it.
---
 ChangeLog      | 9 +++++++++
 src/ftcommon.c | 5 +++--
 src/ftcommon.h | 3 ++-
 src/ftgamma.c  | 2 +-
 src/ftgrid.1   | 1 +
 src/ftgrid.c   | 6 +++++-
 src/ftstring.1 | 1 +
 src/ftstring.c | 7 +++++--
 src/ftview.1   | 1 +
 src/ftview.c   | 7 +++++--
 10 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 918eb12..e9d4f60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2019-06-06  Alexei Podtelezhnikov  <address@hidden>
 
+       [ftgrid,ftview,ftstring] Enable batch mode.
+
+       * src/ftcommon.[hc] (FTDemo_Display_New): Pass `device' argument.
+       * src/{ftview,ftstring,ftgrid}.c (status): New `device' field.
+       (parse_cmdline): Enable batch mode if keys end with `q'.
+       * src/{ftview,ftstring,ftgrid}.1: Document it.
+
+2019-06-06  Alexei Podtelezhnikov  <address@hidden>
+
        [graph] New batch device.
 
        This driver maintains the image in memory without displaying it,
diff --git a/src/ftcommon.c b/src/ftcommon.c
index 61e7a59..89c69d0 100644
--- a/src/ftcommon.c
+++ b/src/ftcommon.c
@@ -99,7 +99,8 @@
 
 
   FTDemo_Display*
-  FTDemo_Display_New( const char*  dims )
+  FTDemo_Display_New( const char*  device,
+                      const char*  dims )
   {
     FTDemo_Display*  display;
     grPixelMode      mode;
@@ -141,7 +142,7 @@
     bit.rows  = height;
     bit.grays = 256;
 
-    surface = grNewSurface( 0, &bit );
+    surface = grNewSurface( device, &bit );
 
     if ( !surface )
     {
diff --git a/src/ftcommon.h b/src/ftcommon.h
index af7efe2..67ccff7 100644
--- a/src/ftcommon.h
+++ b/src/ftcommon.h
@@ -87,7 +87,8 @@
 
 
   FTDemo_Display*
-  FTDemo_Display_New( const char*  dims );
+  FTDemo_Display_New( const char*  device,
+                      const char*  dims );
 
 
   void
diff --git a/src/ftgamma.c b/src/ftgamma.c
index 54345ac..660227d 100644
--- a/src/ftgamma.c
+++ b/src/ftgamma.c
@@ -369,7 +369,7 @@
     char  buf[4];
     int   i;
 
-    display = FTDemo_Display_New( DIM );
+    display = FTDemo_Display_New( NULL, DIM );
     if ( !display )
     {
       PanicZ( "could not allocate display surface" );
diff --git a/src/ftgrid.1 b/src/ftgrid.1
index b5def32..65dddf3 100644
--- a/src/ftgrid.1
+++ b/src/ftgrid.1
@@ -89,6 +89,7 @@ Don't display named instances of variation fonts.
 .TP
 .BI \-k \ keys
 Emulate sequence of keystrokes upon start-up.
+If the keystrokes end with 'q', the program operates in batch mode.
 .
 .TP
 .B \-v
diff --git a/src/ftgrid.c b/src/ftgrid.c
index fefe8e8..f443e4a 100644
--- a/src/ftgrid.c
+++ b/src/ftgrid.c
@@ -97,6 +97,7 @@
   {
     const char*  keys;
     const char*  dims;
+    const char*  device;
 
     int          ptsize;
     int          res;
@@ -167,6 +168,7 @@
   {
     st->keys          = "";
     st->dims          = DIM;
+    st->device        = NULL;  /* default */
     st->res           = 72;
 
     st->scale         = 64;
@@ -1816,6 +1818,8 @@
 
       case 'k':
         status.keys = optarg;
+        if ( optarg[ strlen( optarg ) - 1 ] == 'q' )
+          status.device = "batch";
         break;
 
       case 'n':
@@ -1927,7 +1931,7 @@
     if ( handle->num_fonts == 0 )
       Fatal( "could not find/open any font file" );
 
-    display = FTDemo_Display_New( status.dims );
+    display = FTDemo_Display_New( status.device, status.dims );
     if ( !display )
       Fatal( "could not allocate display surface" );
 
diff --git a/src/ftstring.1 b/src/ftstring.1
index 8dc5a33..4e19581 100644
--- a/src/ftstring.1
+++ b/src/ftstring.1
@@ -81,6 +81,7 @@ for rendering.
 .TP
 .BI \-k \ keys
 Emulate sequence of keystrokes upon start-up.
+If the keystrokes end with 'q', the program operates in batch mode.
 .
 .TP
 .B \-v
diff --git a/src/ftstring.c b/src/ftstring.c
index 2635620..87f4d29 100644
--- a/src/ftstring.c
+++ b/src/ftstring.c
@@ -85,6 +85,7 @@
   {
     const char*    keys;
     const char*    dims;
+    const char*    device;
 
     int            render_mode;
     unsigned long  encoding;
@@ -100,7 +101,7 @@
     char*      header;
     char       header_buffer[256];
 
-  } status = { "", DIM, RENDER_MODE_STRING, FT_ENCODING_UNICODE,
+  } status = { "", DIM, NULL, RENDER_MODE_STRING, FT_ENCODING_UNICODE,
                72, 48, 0, NULL,
                { 0, 0, 0x8000, 0, NULL, 0, 0 },
                { 0, 0, 0, 0 }, 0, NULL, { 0 } };
@@ -671,6 +672,8 @@
 
       case 'k':
         status.keys = optarg;
+        if ( optarg[ strlen( optarg ) - 1 ] == 'q' )
+          status.device = "batch";
         break;
 
       case 'm':
@@ -909,7 +912,7 @@
     if ( handle->num_fonts == 0 )
       PanicZ( "could not open any font file" );
 
-    display = FTDemo_Display_New( status.dims );
+    display = FTDemo_Display_New( status.device, status.dims );
 
     if ( !display )
       PanicZ( "could not allocate display surface" );
diff --git a/src/ftview.1 b/src/ftview.1
index 71dbcea..8141d5f 100644
--- a/src/ftview.1
+++ b/src/ftview.1
@@ -101,6 +101,7 @@ Preload file in memory to simulate memory-mapping.
 .TP
 .BI \-k \ keys
 Emulate sequence of keystrokes upon start-up.
+If the keystrokes end with 'q', the program operates in batch mode.
 .
 .TP
 .B \-v
diff --git a/src/ftview.c b/src/ftview.c
index b1d6903..60fc2dc 100644
--- a/src/ftview.c
+++ b/src/ftview.c
@@ -100,6 +100,7 @@
 
     const char*    keys;
     const char*    dims;
+    const char*    device;
     int            render_mode;
 
     int            res;
@@ -129,7 +130,7 @@
     int            fw_idx;
 
   } status = { 1,
-               "", DIM, RENDER_MODE_ALL,
+               "", DIM, NULL, RENDER_MODE_ALL,
                72, 48, 1, 0.04, 0.04, 0.02, 0.22,
                0, 0, 0, { 0 }, 0, 0, 0, /* default values are set at runtime */
                0, 0, 0, 0, 0,
@@ -1848,6 +1849,8 @@
 
       case 'k':
         status.keys = optarg;
+        if ( optarg[ strlen( optarg ) - 1 ] == 'q' )
+          status.device = "batch";
         break;
 
       case 'l':
@@ -2007,7 +2010,7 @@
     if ( handle->num_fonts == 0 )
       Fatal( "could not find/open any font file" );
 
-    display = FTDemo_Display_New( status.dims );
+    display = FTDemo_Display_New( status.device, status.dims );
     if ( !display )
       Fatal( "could not allocate display surface" );
 



reply via email to

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