* src/cache/ftcsbits.c (ftc_snode_load): Properly handle short pitch.

This commit is contained in:
Daniel Welty 2021-04-17 09:00:40 -04:00 committed by Alexei Podtelezhnikov
parent 6f6ad87638
commit 2e68785e08
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2021-04-16 Daniel Welty <@danielwelty>
* src/cache/ftcsbits.c (ftc_snode_load): Properly handle short pitch.
2021-04-16 Werner Lemberg <wl@gnu.org>
* builds/unix/freetype2.m4: Fix help string formatting.

View File

@ -143,12 +143,13 @@
goto BadGlyph;
}
/* Check whether our values fit into 8-bit containers! */
/* Check whether our values fit into 8/16-bit containers! */
/* If this is not the case, our bitmap is too large */
/* and we will leave it as `missing' with sbit.buffer = 0 */
#define CHECK_CHAR( d ) ( temp = (FT_Char)d, (FT_Int) temp == (FT_Int) d )
#define CHECK_BYTE( d ) ( temp = (FT_Byte)d, (FT_UInt)temp == (FT_UInt)d )
#define CHECK_SHRT( d ) ( temp = (FT_Short)d, (FT_Int)temp == (FT_Int) d )
/* horizontal advance in pixels */
xadvance = ( slot->advance.x + 32 ) >> 6;
@ -156,7 +157,7 @@
if ( !CHECK_BYTE( bitmap->rows ) ||
!CHECK_BYTE( bitmap->width ) ||
!CHECK_CHAR( bitmap->pitch ) ||
!CHECK_SHRT( bitmap->pitch ) ||
!CHECK_CHAR( slot->bitmap_left ) ||
!CHECK_CHAR( slot->bitmap_top ) ||
!CHECK_CHAR( xadvance ) ||
@ -169,7 +170,7 @@
sbit->width = (FT_Byte)bitmap->width;
sbit->height = (FT_Byte)bitmap->rows;
sbit->pitch = (FT_Char)bitmap->pitch;
sbit->pitch = (FT_Short)bitmap->pitch;
sbit->left = (FT_Char)slot->bitmap_left;
sbit->top = (FT_Char)slot->bitmap_top;
sbit->xadvance = (FT_Char)xadvance;