ecere/gfx/LFBDisplayDriver: Fixed extent of italic fonts
authorJerome St-Louis <jerome@ecere.com>
Sat, 23 May 2015 06:49:37 +0000 (02:49 -0400)
committerJerome St-Louis <jerome@ecere.com>
Thu, 15 Oct 2015 00:19:46 +0000 (20:19 -0400)
ecere/src/gfx/drivers/LFBDisplayDriver.ec

index c1e8762..9d7baaa 100644 (file)
@@ -3454,6 +3454,8 @@ public class LFBDisplayDriver : DisplayDriver
          int fontEntryNum = 0;
          int glyphScript = 0;
          FontEntry curFontEntry;
+         GlyphInfo * lastGlyph = null;
+         int lastAX = 0;
 
          pack.bitmap.alphaBlend = true;
 
@@ -3811,10 +3813,20 @@ public class LFBDisplayDriver : DisplayDriver
                if(callback)
                   callback(surface, display, ((*x) >> 6), y + (oy >> 6), glyph, (outline ? outline : pack).bitmap);
                *x += ax;
+
+               lastGlyph = glyph;
+               lastAX = ax;
             }
             if(numGlyphs && (rightToLeft ? (glyphIndex < 0) : (glyphIndex == numGlyphs)))
                numGlyphs = 0;
          }
+         if(lastGlyph)
+         {
+            int w = (lastGlyph->w * lastGlyph->left) * (1 << 6);
+            // Fix for advance != width + left (e.g. italic fonts)
+            if(w > lastAX)
+               *x += w - lastAX;
+         }
       }
       if(surface)
       {