freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master f634e5c: * src/ftcommon.c (FTDemo_Display_New):


From: Werner Lemberg
Subject: [freetype2-demos] master f634e5c: * src/ftcommon.c (FTDemo_Display_New): Handle window titles.
Date: Sun, 11 Sep 2022 22:13:20 -0400 (EDT)

branch: master
commit f634e5c4cc32b6c88b22330830397f6c62b37fbc
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    * src/ftcommon.c (FTDemo_Display_New): Handle window titles.
    * src/ftcommon.h: Update its prototype.
    * src/ftgamma.c, src/ftgrid.c, src/ftsdf.c, src/ftstring.c, src/ftview.c
    (main): Updated accordingly.
---
 src/ftcommon.c | 6 +++++-
 src/ftcommon.h | 3 ++-
 src/ftgamma.c  | 5 ++---
 src/ftgrid.c   | 5 ++---
 src/ftsdf.c    | 4 ++--
 src/ftstring.c | 6 ++----
 src/ftview.c   | 5 ++---
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/ftcommon.c b/src/ftcommon.c
index 677048f..2fb872e 100644
--- a/src/ftcommon.c
+++ b/src/ftcommon.c
@@ -98,7 +98,8 @@
 
   FTDemo_Display*
   FTDemo_Display_New( const char*  device,
-                      const char*  dims )
+                      const char*  dims,
+                      const char*  title )
   {
     FTDemo_Display*  display;
     grPixelMode      mode;
@@ -165,6 +166,9 @@
 
     grSetTargetGamma( display->surface, display->gamma );
 
+    if ( title )
+      grSetTitle( display->surface, title );
+
     return display;
   }
 
diff --git a/src/ftcommon.h b/src/ftcommon.h
index 82ff1a2..6e3425a 100644
--- a/src/ftcommon.h
+++ b/src/ftcommon.h
@@ -86,7 +86,8 @@
 
   FTDemo_Display*
   FTDemo_Display_New( const char*  device,
-                      const char*  dims );
+                      const char*  dims,
+                      const char*  title );
 
 
   void
diff --git a/src/ftgamma.c b/src/ftgamma.c
index 42d3622..62b5dcb 100644
--- a/src/ftgamma.c
+++ b/src/ftgamma.c
@@ -372,14 +372,13 @@
     char  buf[4];
     int   i;
 
-    display = FTDemo_Display_New( NULL, DIM "x24" );
+    display = FTDemo_Display_New( NULL, DIM "x24",
+                        "FreeType Gamma Matcher - press ? for help" );
     if ( !display )
     {
       PanicZ( "could not allocate display surface" );
     }
 
-    grSetTitle( display->surface, "FreeType Gamma Matcher - press ? for help" 
);
-
     grNewBitmap( bit1.mode, bit1.grays, bit1.width, bit1.rows, &bit1 );
     GammaGrid( &bit1 );
 
diff --git a/src/ftgrid.c b/src/ftgrid.c
index cb3494b..ff8ac27 100644
--- a/src/ftgrid.c
+++ b/src/ftgrid.c
@@ -1841,12 +1841,11 @@
     if ( handle->num_fonts == 0 )
       Fatal( "could not find/open any font file" );
 
-    display = FTDemo_Display_New( status.device, status.dims );
+    display = FTDemo_Display_New( status.device, status.dims,
+                        "FreeType Glyph Grid Viewer - press ? for help" );
     if ( !display )
       Fatal( "could not allocate display surface" );
 
-    grSetTitle( display->surface,
-                "FreeType Glyph Grid Viewer - press ? for help" );
     FTDemo_Icon( handle, display );
 
     grid_status_display( &status, display );
diff --git a/src/ftsdf.c b/src/ftsdf.c
index 975927d..77e7a29 100644
--- a/src/ftsdf.c
+++ b/src/ftsdf.c
@@ -702,7 +702,8 @@
       goto Exit;
     }
 
-    display = FTDemo_Display_New( NULL, "800x600x24" );
+    display = FTDemo_Display_New( NULL, "800x600x24",
+                                  "Signed Distance Field Viewer" );
     if ( !display )
     {
       printf( "Failed to create FTDemo_Display\n" );
@@ -712,7 +713,6 @@
     FT_CALL( FT_Property_Set( handle->library, "sdf", "flip_y", &flip_y ) );
     FT_CALL( FT_Property_Set( handle->library, "bsdf", "flip_y", &flip_y ) );
 
-    grSetTitle( display->surface, "Signed Distance Field Viewer" );
     event_color_change();
 
     FT_CALL( FT_New_Face( handle->library, argv[2], 0, &status.face ) );
diff --git a/src/ftstring.c b/src/ftstring.c
index bb70d33..e0d04c8 100644
--- a/src/ftstring.c
+++ b/src/ftstring.c
@@ -971,13 +971,11 @@
     if ( handle->num_fonts == 0 )
       PanicZ( "could not open any font file" );
 
-    display = FTDemo_Display_New( status.device, status.dims );
-
+    display = FTDemo_Display_New( status.device, status.dims,
+                        "FreeType String Viewer - press ? for help" );
     if ( !display )
       PanicZ( "could not allocate display surface" );
 
-    grSetTitle( display->surface,
-                "FreeType String Viewer - press ? for help" );
     FTDemo_Icon( handle, display );
 
     status.header = NULL;
diff --git a/src/ftview.c b/src/ftview.c
index 31582a5..fad57dc 100644
--- a/src/ftview.c
+++ b/src/ftview.c
@@ -1842,12 +1842,11 @@
     if ( handle->num_fonts == 0 )
       Fatal( "could not find/open any font file" );
 
-    display = FTDemo_Display_New( status.device, status.dims );
+    display = FTDemo_Display_New( status.device, status.dims,
+                        "FreeType Glyph Viewer - press ? for help" );
     if ( !display )
       Fatal( "could not allocate display surface" );
 
-    grSetTitle( display->surface,
-                "FreeType Glyph Viewer - press ? for help" );
     FTDemo_Icon( handle, display );
 
     status.num_fails = 0;



reply via email to

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