freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master 201a6bc 1/2: * src/ftview.c (Render_Stroke): Re


From: Werner Lemberg
Subject: [freetype2-demos] master 201a6bc 1/2: * src/ftview.c (Render_Stroke): Render bitmaps without stroking.
Date: Tue, 25 Oct 2022 00:20:45 -0400 (EDT)

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

    * src/ftview.c (Render_Stroke): Render bitmaps without stroking.
---
 src/ftview.c | 80 +++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 41 insertions(+), 39 deletions(-)

diff --git a/src/ftview.c b/src/ftview.c
index fad57dc..6de31a3 100644
--- a/src/ftview.c
+++ b/src/ftview.c
@@ -191,68 +191,70 @@
 
     for ( i = offset; i < num_indices; i++ )
     {
-      FT_UInt  glyph_idx;
+      FT_UInt   glyph_idx;
+      FT_Glyph  glyph;
 
 
       glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)i );
 
       error = FT_Load_Glyph( face, glyph_idx,
                              handle->load_flags | FT_LOAD_NO_BITMAP );
+      if ( error )
+        goto Next;
 
-      if ( !error && slot->format == FT_GLYPH_FORMAT_OUTLINE )
-      {
-        FT_Glyph  glyph;
-
-
-        error = FT_Get_Glyph( slot, &glyph );
-        if ( error )
-          goto Next;
+      error = FT_Get_Glyph( slot, &glyph );
+      if ( error )
+        goto Next;
 
+      if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
+      {
         error = FT_Glyph_Stroke( &glyph, handle->stroker, 1 );
         if ( error )
         {
           FT_Done_Glyph( glyph );
           goto Next;
         }
+      }
 
-        width = slot->advance.x ? slot->advance.x >> 6
-                                : size->metrics.y_ppem / 2;
-
-        if ( X_TOO_LONG( x + width, display ) )
-        {
-          x  = start_x;
-          y += step_y;
+      width = slot->advance.x ? slot->advance.x >> 6
+                              : size->metrics.y_ppem / 2;
 
-          if ( Y_TOO_LONG( y, display ) )
-          {
-            FT_Done_Glyph( glyph );
-            break;
-          }
-        }
+      if ( X_TOO_LONG( x + width, display ) )
+      {
+        x  = start_x;
+        y += step_y;
 
-        /* extra space between glyphs */
-        x++;
-        if ( slot->advance.x == 0 )
+        if ( Y_TOO_LONG( y, display ) )
         {
-          grFillRect( display->bitmap, x, y - width, width, width,
-                      display->warn_color );
-          x += width;
+          FT_Done_Glyph( glyph );
+          break;
         }
+      }
 
-        error = FTDemo_Draw_Glyph( handle, display, glyph, &x, &y );
+      /* extra space between glyphs */
+      x++;
+      if ( slot->advance.x == 0 )
+      {
+        grFillRect( display->bitmap, x, y - width, width, width,
+                    display->warn_color );
+        x += width;
+      }
 
-        if ( error )
-          goto Next;
-        else
-          FT_Done_Glyph( glyph );
+      error = FTDemo_Draw_Glyph( handle, display, glyph, &x, &y );
 
-        if ( !have_topleft )
-        {
-          have_topleft   = 1;
-          status.topleft = i;
-        }
-      }
+      if ( error )
+        goto Next;
       else
+        FT_Done_Glyph( glyph );
+
+      if ( !have_topleft )
+      {
+        have_topleft   = 1;
+        status.topleft = i;
+      }
+
+      continue;
+
     Next:
       status.num_fails++;
     }



reply via email to

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