shithub: freetype+ttf2subf

Download patch

ref: c162eac55c86261dafe11ba2c31c4fab93c0f4b1
parent: e70371c410fc571c7fad78d0f1b9867447a62145
author: Werner Lemberg <[email protected]>
date: Sat May 28 17:52:37 EDT 2005

* src/base/ftbitmap.c (FT_Bitmap_Embolden): Handle negative pitch.
Handle FT_PIXEL_MODE_GRAY with num_gray != 256.
Improve speed for FT_PIXEL_MODE_GRAY.
(ft_bitmap_assure_buffer): Accept FT_PIXEL_MODE_LCD and
FT_PIXEL_MODE_LCD_V.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-05-28  Chia I Wu  <[email protected]>
+
+	* src/base/ftbitmap.c (FT_Bitmap_Embolden): Handle negative pitch.
+	Handle FT_PIXEL_MODE_GRAY with num_gray != 256.
+	Improve speed for FT_PIXEL_MODE_GRAY.
+	(ft_bitmap_assure_buffer): Accept FT_PIXEL_MODE_LCD and
+	FT_PIXEL_MODE_LCD_V.
+
 2005-05-27  Chia I Wu  <[email protected]>
 
 	* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Initialize `error'.
--- a/src/base/ftbitmap.c
+++ b/src/base/ftbitmap.c
@@ -115,6 +115,8 @@
     switch ( bitmap->pixel_mode )
     {
     case FT_PIXEL_MODE_MONO:
+    case FT_PIXEL_MODE_LCD:
+    case FT_PIXEL_MODE_LCD_V:
       ppb = 8;
       break;
     case FT_PIXEL_MODE_GRAY2:
@@ -210,7 +212,7 @@
     else
     {
       pitch = -pitch;
-      p = bitmap->buffer + pitch * ( bitmap->rows - ystr - 1 );
+      p = bitmap->buffer + pitch * ( bitmap->rows - 1 );
     }
 
     /* for each row */
@@ -237,16 +239,30 @@
             /* the maximum value of 8 for `xstr' comes from here */
             if ( x > 0 )
               p[x] |= p[x - 1] << ( 8 - i );
+
+#if 0
+            if ( p[x] == 0xff )
+              break;
+#endif
           }
           else if ( bitmap->pixel_mode == FT_PIXEL_MODE_GRAY )
           {
             if ( x - i >= 0 )
             {
-              if ( p[x] + p[x - i] > 0xff )
-                p[x] = 0xff;
+              if ( p[x] + p[x - i] > bitmap->num_grays )
+              {
+                p[x] = bitmap->num_grays;
+                break;
+              }
               else
+              {
                 p[x] += p[x - i];
+                if ( p[x] == bitmap->num_grays )
+                  break;
+              }
             }
+            else
+              break;
           }
         }
       }