From 1ee02cd0419021c3d4950af2619da39c6e9c47f0 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 21 Dec 2009 15:22:51 +0000 Subject: Updated to freetype-2.3.11 --- freetype/src/pfr/pfrcmap.c | 5 ++--- freetype/src/pfr/pfrdrivr.h | 4 ++++ freetype/src/pfr/pfrload.c | 15 +++++++++------ freetype/src/pfr/pfrsbit.c | 28 +++++++++++++++++++++++----- freetype/src/pfr/pfrtypes.h | 6 +++--- 5 files changed, 41 insertions(+), 17 deletions(-) (limited to 'freetype/src/pfr') diff --git a/freetype/src/pfr/pfrcmap.c b/freetype/src/pfr/pfrcmap.c index d4656d1b5..9c8f9ed8e 100644 --- a/freetype/src/pfr/pfrcmap.c +++ b/freetype/src/pfr/pfrcmap.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR cmap handling (body). */ /* */ -/* Copyright 2002, 2007 by */ +/* Copyright 2002, 2007, 2009 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,7 +18,6 @@ #include "pfrcmap.h" #include "pfrobjs.h" -#include FT_INTERNAL_DEBUG_H #include "pfrerror.h" @@ -89,7 +88,7 @@ } - FT_CALLBACK_DEF( FT_UInt ) + FT_CALLBACK_DEF( FT_UInt32 ) pfr_cmap_char_next( PFR_CMap cmap, FT_UInt32 *pchar_code ) { diff --git a/freetype/src/pfr/pfrdrivr.h b/freetype/src/pfr/pfrdrivr.h index 36f1205b7..da0a1aa63 100644 --- a/freetype/src/pfr/pfrdrivr.h +++ b/freetype/src/pfr/pfrdrivr.h @@ -26,6 +26,10 @@ FT_BEGIN_HEADER +#ifdef FT_CONFIG_OPTION_PIC +#error "this module does not support PIC yet" +#endif + FT_EXPORT_VAR( const FT_Driver_ClassRec ) pfr_driver_class; diff --git a/freetype/src/pfr/pfrload.c b/freetype/src/pfr/pfrload.c index 1ee2c1f8c..bc5c035f3 100644 --- a/freetype/src/pfr/pfrload.c +++ b/freetype/src/pfr/pfrload.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR loader (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2007 by */ +/* Copyright 2002, 2003, 2004, 2005, 2007, 2009 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -428,7 +428,8 @@ Too_Short: error = PFR_Err_Invalid_Table; - FT_ERROR(( "pfr_extra_item_load_bitmap_info: invalid bitmap info table\n" )); + FT_ERROR(( "pfr_extra_item_load_bitmap_info:" + " invalid bitmap info table\n" )); goto Exit; } @@ -506,7 +507,8 @@ Too_Short: error = PFR_Err_Invalid_Table; - FT_ERROR(( "pfr_exta_item_load_stem_snaps: invalid stem snaps table\n" )); + FT_ERROR(( "pfr_exta_item_load_stem_snaps:" + " invalid stem snaps table\n" )); goto Exit; } @@ -603,8 +605,8 @@ FT_FREE( item ); error = PFR_Err_Invalid_Table; - FT_ERROR(( "pfr_extra_item_load_kerning_pairs: " - "invalid kerning pairs table\n" )); + FT_ERROR(( "pfr_extra_item_load_kerning_pairs:" + " invalid kerning pairs table\n" )); goto Exit; } @@ -714,7 +716,8 @@ { FT_Error error; FT_Memory memory = stream->memory; - FT_UInt flags, num_aux; + FT_UInt flags; + FT_ULong num_aux; FT_Byte* p; FT_Byte* limit; diff --git a/freetype/src/pfr/pfrsbit.c b/freetype/src/pfr/pfrsbit.c index 45ff6663b..8a38bec1d 100644 --- a/freetype/src/pfr/pfrsbit.c +++ b/freetype/src/pfr/pfrsbit.c @@ -630,18 +630,35 @@ &xpos, &ypos, &xsize, &ysize, &advance, &format ); + + /* + * XXX: on 16bit system, we return an error for huge bitmap + * which causes a size truncation, because truncated + * size properties makes bitmap glyph broken. + */ + if ( xpos > FT_INT_MAX || ( ypos + ysize ) > FT_INT_MAX ) + { + FT_TRACE1(( "pfr_slot_load_bitmap:" )); + FT_TRACE1(( "huge bitmap glyph %dx%d over FT_GlyphSlot\n", + xpos, ypos )); + error = PFR_Err_Invalid_Pixel_Size; + } + if ( !error ) { glyph->root.format = FT_GLYPH_FORMAT_BITMAP; /* Set up glyph bitmap and metrics */ + + /* XXX: needs casts to fit FT_Bitmap.{width|rows|pitch} */ glyph->root.bitmap.width = (FT_Int)xsize; glyph->root.bitmap.rows = (FT_Int)ysize; - glyph->root.bitmap.pitch = (FT_Long)( xsize + 7 ) >> 3; + glyph->root.bitmap.pitch = (FT_Int)( xsize + 7 ) >> 3; glyph->root.bitmap.pixel_mode = FT_PIXEL_MODE_MONO; - glyph->root.metrics.width = (FT_Long)xsize << 6; - glyph->root.metrics.height = (FT_Long)ysize << 6; + /* XXX: needs casts to fit FT_Glyph_Metrics.{width|height} */ + glyph->root.metrics.width = (FT_Pos)xsize << 6; + glyph->root.metrics.height = (FT_Pos)ysize << 6; glyph->root.metrics.horiBearingX = xpos << 6; glyph->root.metrics.horiBearingY = ypos << 6; glyph->root.metrics.horiAdvance = FT_PIX_ROUND( ( advance >> 2 ) ); @@ -649,8 +666,9 @@ glyph->root.metrics.vertBearingY = 0; glyph->root.metrics.vertAdvance = size->root.metrics.height; - glyph->root.bitmap_left = xpos; - glyph->root.bitmap_top = ypos + ysize; + /* XXX: needs casts fit FT_GlyphSlotRec.bitmap_{left|top} */ + glyph->root.bitmap_left = (FT_Int)xpos; + glyph->root.bitmap_top = (FT_Int)(ypos + ysize); /* Allocate and read bitmap data */ { diff --git a/freetype/src/pfr/pfrtypes.h b/freetype/src/pfr/pfrtypes.h index c0ae04253..918310814 100644 --- a/freetype/src/pfr/pfrtypes.h +++ b/freetype/src/pfr/pfrtypes.h @@ -200,7 +200,7 @@ FT_BEGIN_HEADER FT_Byte flags; FT_Short base_adj; FT_UInt pair_size; - FT_UInt32 offset; + FT_Offset offset; FT_UInt32 pair1; FT_UInt32 pair2; @@ -252,7 +252,7 @@ FT_BEGIN_HEADER FT_UInt blue_scale; FT_UInt num_chars; - FT_UInt32 chars_offset; + FT_Offset chars_offset; PFR_Char chars; FT_UInt num_kern_pairs; @@ -260,7 +260,7 @@ FT_BEGIN_HEADER PFR_KernItem* kern_items_tail; /* not part of the spec, but used during load */ - FT_UInt32 bct_offset; + FT_Long bct_offset; FT_Byte* cursor; } PFR_PhyFontRec, *PFR_PhyFont; -- cgit v1.2.3