freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master f181ba6: * src/ftcommon.c (FTDemo_Draw_Header):


From: Alexei Podtelezhnikov
Subject: [freetype2-demos] master f181ba6: * src/ftcommon.c (FTDemo_Draw_Header): Simplify.
Date: Tue, 13 Jun 2017 22:54:14 -0400 (EDT)

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

    * src/ftcommon.c (FTDemo_Draw_Header): Simplify.
---
 ChangeLog      |  4 ++++
 src/ftcommon.c | 24 +++++++-----------------
 2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 131555a..5c20201 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-06-13  Alexei Podtelezhnikov  <address@hidden>
+
+       * src/ftcommon.c (FTDemo_Draw_Header): Simplify.
+
 2017-06-10  Werner Lemberg  <address@hidden>
 
        * src/ftcommon.c (FTDemo_Draw_Header): Fix compiler warning.
diff --git a/src/ftcommon.c b/src/ftcommon.c
index bdb3904..4aed753 100644
--- a/src/ftcommon.c
+++ b/src/ftcommon.c
@@ -899,28 +899,18 @@
 
       if ( FT_HAS_GLYPH_NAMES( face ) )
       {
-        char*         p;
-        const char*   format = ", name: ";
-        unsigned int  format_len, glyph_idx;
+        unsigned int  glyph_idx;
 
 
-        p = buf + x;
-        x = 256 - x;
+        x += sprintf( buf + x, ", name: " );
 
-        format_len = strlen( format );
+        glyph_idx = (unsigned int)idx;
+        if ( handle->encoding != FT_ENCODING_ORDER )
+          glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)idx );
 
-        if ( x >= (signed int)format_len + 2 )
-        {
-          glyph_idx = (unsigned int)idx;
-          if ( handle->encoding != FT_ENCODING_ORDER )
-            glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)idx );
-
-          strcpy( p, format );
-          if ( FT_Get_Glyph_Name( face, glyph_idx,
-                                  p + format_len, x - format_len ) )
-            *p = '\0';
-        }
+        FT_Get_Glyph_Name( face, glyph_idx, buf + x, 256 - x );
       }
+
       grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT,
                          buf, display->fore_color );
     }



reply via email to

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