shithub: freetype+ttf2subf

Download patch

ref: 3b88576ba0807f5203310c22d5dbfff803c4abd9
parent: c2e2a8e5d9dbc1d06064b93fbdcae6737ddc2f5b
author: Alexei Podtelezhnikov <[email protected]>
date: Sun Apr 22 13:22:35 EDT 2018

[base] Fix bitmap emboldening.

Bug introduced after release 2.8.

* src/base/ftbitmap.c (ft_bitmap_assure_buffer): We use
`FT_QALLOC_MULT', which doesn't zero out the buffer.  Adjust the
bitmap copying code to take care of this fact.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2018-04-22  Alexei Podtelezhnikov  <[email protected]>
+
+	[base] Fix bitmap emboldening.
+
+	Bug introduced after release 2.8.
+
+	* src/base/ftbitmap.c (ft_bitmap_assure_buffer): We use
+	`FT_QALLOC_MULT', which doesn't zero out the buffer.  Adjust the
+	bitmap copying code to take care of this fact.
+
 2018-04-22  Werner Lemberg  <[email protected]>
 
 	Another fix for handling invalid format 2 cmaps.
--- a/src/base/ftbitmap.c
+++ b/src/base/ftbitmap.c
@@ -237,7 +237,7 @@
       unsigned char*  out = buffer;
 
       unsigned char*  limit = bitmap->buffer + pitch * bitmap->rows;
-      unsigned int    delta = new_pitch - pitch;
+      unsigned int    delta = new_pitch - len;
 
 
       FT_MEM_ZERO( out, new_pitch * ypixels );
@@ -247,8 +247,10 @@
       {
         FT_MEM_COPY( out, in, len );
         in  += pitch;
-        out += pitch;
+        out += len;
 
+        /* we use FT_QALLOC_MULT, which doesn't zero out the buffer;      */
+        /* consequently, we have to manually zero out the remaining bytes */
         FT_MEM_ZERO( out, delta );
         out += delta;
       }
@@ -261,7 +263,7 @@
       unsigned char*  out = buffer;
 
       unsigned char*  limit = bitmap->buffer + pitch * bitmap->rows;
-      unsigned int    delta = new_pitch - pitch;
+      unsigned int    delta = new_pitch - len;
 
 
       while ( in < limit )
@@ -268,7 +270,7 @@
       {
         FT_MEM_COPY( out, in, len );
         in  += pitch;
-        out += pitch;
+        out += len;
 
         FT_MEM_ZERO( out, delta );
         out += delta;