shithub: freetype+ttf2subf

Download patch

ref: e5a7cc239c1db21f2fb6082ca57dbba5a256f275
parent: 14de111f72119fb19de8e88f79116578adb97df0
author: Werner Lemberg <[email protected]>
date: Mon Mar 2 04:09:12 EST 2009

Fix handling of EBDT formats 8 and 9.

The main cycle in `blit_sbit' makes too many iterations: it actually
needs the count of lines in the source bitmap rather than in the
target image.

* src/sfnt/ttsbit.c (blit_sbit) [FT_CONFIG_OPTION_OLD_INTERNALS]:
Add parameter `source_height' and use it for main loop.
(Load_SBit_Single) [FT_CONFIG_OPTION_OLD_INTERNALS]: Updated.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-03-02  Alexey Kryukov  <[email protected]>
+
+	Fix handling of EBDT formats 8 and 9.
+
+	The main cycle in `blit_sbit' makes too many iterations: it actually
+	needs the count of lines in the source bitmap rather than in the
+	target image.
+
+	* src/sfnt/ttsbit.c (blit_sbit) [FT_CONFIG_OPTION_OLD_INTERNALS]:
+	Add parameter `source_height' and use it for main loop.
+	(Load_SBit_Single) [FT_CONFIG_OPTION_OLD_INTERNALS]: Updated.
+
 2009-02-23  Werner Lemberg  <[email protected]>
 
 	Fix Savannah bug #25669.
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType and OpenType embedded bitmap support (body).                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by       */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -83,7 +83,8 @@
              FT_Int      line_bits,
              FT_Bool     byte_padded,
              FT_Int      x_offset,
-             FT_Int      y_offset )
+             FT_Int      y_offset,
+             FT_Int      source_height )
   {
     FT_Byte*   line_buff;
     FT_Int     line_incr;
@@ -116,7 +117,7 @@
     acc    = 0;  /* clear accumulator   */
     loaded = 0;  /* no bits were loaded */
 
-    for ( height = target->rows; height > 0; height-- )
+    for ( height = source_height; height > 0; height-- )
     {
       FT_Byte*  cur   = line_buff;        /* current write cursor          */
       FT_Int    count = line_bits;        /* # of bits to extract per line */
@@ -772,7 +773,7 @@
       Found:
         /* return successfully! */
         *arange  = range;
-        return 0;
+        return SFNT_Err_Ok;
       }
     }
 
@@ -1230,7 +1231,7 @@
       /* the sbit blitter doesn't make a difference between pixmap */
       /* depths.                                                   */
       blit_sbit( map, (FT_Byte*)stream->cursor, line_bits, pad_bytes,
-                 x_offset * pix_bits, y_offset );
+                 x_offset * pix_bits, y_offset, metrics->height );
 
       FT_FRAME_EXIT();
     }