freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master 86c711a: * src/ftview.c (Render_{All, Fancy, S


From: Werner Lemberg
Subject: [freetype2-demos] master 86c711a: * src/ftview.c (Render_{All, Fancy, Stroke}): Tweak zero-width glyphs.
Date: Sat, 22 Apr 2023 23:08:08 -0400 (EDT)

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

    * src/ftview.c (Render_{All,Fancy,Stroke}): Tweak zero-width glyphs.
    
    This helps to avoid collisions and unhides zero-width glyphs better.
---
 src/ftview.c | 39 ++++++++++++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 9 deletions(-)

diff --git a/src/ftview.c b/src/ftview.c
index 3b74ba2..756ba85 100644
--- a/src/ftview.c
+++ b/src/ftview.c
@@ -239,17 +239,24 @@
         }
       }
 
-      /* extra space between glyphs */
-      x++;
       if ( slot->advance.x == 0 )
       {
         grFillRect( display->bitmap, x, y - width, width, width,
                     status.green );
-        x += width;
+
+        if ( slot->bitmap_left < -width >> 2 )
+        {
+          x     += width;
+          width  = 0;
+        }
       }
+      else
+        width = 0;
 
       error = FTDemo_Draw_Glyph( handle, display, glyph, &x, &y );
 
+      x += width + 1;  /* with extra space between glyphs */
+
       if ( error )
         goto Next;
       else
@@ -382,17 +389,24 @@
           break;
       }
 
-      /* extra space between glyphs */
-      x++;
       if ( slot->advance.x == 0 )
       {
         grFillRect( display->bitmap, x, y - width, width, width,
                     status.green );
-        x += width;
+
+        if ( slot->bitmap_left < -width >> 2 )
+        {
+          x     += width;
+          width  = 0;
+        }
       }
+      else
+        width = 0;
 
       error = FTDemo_Draw_Slot( handle, display, slot, &x, &y );
 
+      x += width + 1;  /* with extra space between glyphs */
+
       if ( error )
         goto Next;
 
@@ -570,17 +584,24 @@
           break;
       }
 
-      /* extra space between glyphs */
-      x++;
       if ( slot->advance.x == 0 )
       {
         grFillRect( display->bitmap, x, y - width, width, width,
                     status.green );
-        x += width;
+
+        if ( slot->bitmap_left < -width >> 2 )
+        {
+          x     += width;
+          width  = 0;
+        }
       }
+      else
+        width = 0;
 
       error = FTDemo_Draw_Slot( handle, display, slot, &x, &y );
 
+      x += width + 1;  /* with extra space between glyphs */
+
       if ( error )
         goto Next;
 



reply via email to

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