From a33de30073bfa0ee1abba186dba9fa52cf0aa23a Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 15 Jun 2012 14:04:46 +0200 Subject: Updated to following packages: freetype-2.4.10 libXaw-1.0.11 openssl-1.0.1c --- freetype/src/autofit/afdummy.c | 2 +- freetype/src/autofit/afglobal.c | 2 +- freetype/src/autofit/afindic.c | 8 +- freetype/src/autofit/aflatin.c | 7 +- freetype/src/autofit/aflatin2.c | 13 +-- freetype/src/autofit/afloader.c | 8 +- freetype/src/autofit/aftypes.h | 2 +- freetype/src/autofit/afwarp.c | 2 +- freetype/src/base/ftbitmap.c | 2 +- freetype/src/base/ftoutln.c | 224 +++++++++++---------------------------- freetype/src/base/ftpic.c | 12 +-- freetype/src/base/ftsynth.c | 23 ++-- freetype/src/bdf/bdfdrivr.h | 2 +- freetype/src/bdf/bdflib.c | 14 ++- freetype/src/cache/ftcbasic.c | 4 +- freetype/src/cache/ftccmap.c | 2 +- freetype/src/cache/ftcmanag.c | 2 +- freetype/src/cff/cffload.h | 2 +- freetype/src/cff/cfftypes.h | 2 +- freetype/src/cid/cidgload.c | 2 +- freetype/src/cid/cidriver.c | 12 +-- freetype/src/cid/cidriver.h | 2 +- freetype/src/gxvalid/gxvmod.c | 2 +- freetype/src/gxvalid/gxvmod.h | 2 +- freetype/src/gxvalid/gxvprop.c | 2 +- freetype/src/otvalid/otvmod.c | 2 +- freetype/src/otvalid/otvmod.h | 2 +- freetype/src/pcf/pcfdrivr.h | 2 +- freetype/src/pfr/pfrdrivr.h | 2 +- freetype/src/psaux/psauxmod.c | 2 +- freetype/src/psaux/psauxmod.h | 2 +- freetype/src/psaux/t1decode.c | 8 +- freetype/src/pshinter/pshalgo.c | 5 +- freetype/src/raster/ftmisc.h | 21 ++++ freetype/src/raster/ftraster.c | 11 +- freetype/src/raster/ftrend1.c | 13 ++- freetype/src/sfnt/sfobjs.c | 14 ++- freetype/src/sfnt/ttcmap.c | 2 +- freetype/src/sfnt/ttcmap.h | 6 +- freetype/src/sfnt/ttload.c | 15 ++- freetype/src/sfnt/ttmtx.c | 4 +- freetype/src/smooth/ftgrays.c | 2 +- freetype/src/truetype/ttgload.c | 9 +- freetype/src/truetype/ttinterp.c | 19 ++-- freetype/src/truetype/ttobjs.c | 22 +++- freetype/src/type1/t1driver.h | 2 +- freetype/src/type1/t1load.c | 64 +++++++---- freetype/src/type1/t1tokens.h | 2 +- freetype/src/type42/t42drivr.h | 2 +- freetype/src/winfonts/winfnt.h | 2 +- 50 files changed, 272 insertions(+), 318 deletions(-) (limited to 'freetype/src') diff --git a/freetype/src/autofit/afdummy.c b/freetype/src/autofit/afdummy.c index c71265131..4bf278ce2 100644 --- a/freetype/src/autofit/afdummy.c +++ b/freetype/src/autofit/afdummy.c @@ -47,7 +47,7 @@ AF_SCRIPT_NONE, NULL, - sizeof( AF_ScriptMetricsRec ), + sizeof ( AF_ScriptMetricsRec ), (AF_Script_InitMetricsFunc) NULL, (AF_Script_ScaleMetricsFunc)NULL, diff --git a/freetype/src/autofit/afglobal.c b/freetype/src/autofit/afglobal.c index 3c5f02ec6..3e0c02d3f 100644 --- a/freetype/src/autofit/afglobal.c +++ b/freetype/src/autofit/afglobal.c @@ -43,7 +43,7 @@ #endif &af_latin_script_class, &af_cjk_script_class, - &af_indic_script_class, + &af_indic_script_class, NULL /* do not remove */ }; diff --git a/freetype/src/autofit/afindic.c b/freetype/src/autofit/afindic.c index c232cff78..9c74838fe 100644 --- a/freetype/src/autofit/afindic.c +++ b/freetype/src/autofit/afindic.c @@ -113,11 +113,11 @@ }; - AF_DEFINE_SCRIPT_CLASS(af_indic_script_class, + AF_DEFINE_SCRIPT_CLASS( af_indic_script_class, AF_SCRIPT_INDIC, af_indic_uniranges, - sizeof( AF_CJKMetricsRec ), + sizeof ( AF_CJKMetricsRec ), (AF_Script_InitMetricsFunc) af_indic_metrics_init, (AF_Script_ScaleMetricsFunc)af_indic_metrics_scale, @@ -135,11 +135,11 @@ }; - AF_DEFINE_SCRIPT_CLASS(af_indic_script_class, + AF_DEFINE_SCRIPT_CLASS( af_indic_script_class, AF_SCRIPT_INDIC, af_indic_uniranges, - sizeof( AF_CJKMetricsRec ), + sizeof ( AF_CJKMetricsRec ), (AF_Script_InitMetricsFunc) NULL, (AF_Script_ScaleMetricsFunc)NULL, diff --git a/freetype/src/autofit/aflatin.c b/freetype/src/autofit/aflatin.c index 54fcf7f0a..0fd304532 100644 --- a/freetype/src/autofit/aflatin.c +++ b/freetype/src/autofit/aflatin.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin script (body). */ /* */ -/* Copyright 2003-2011 by */ +/* Copyright 2003-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -705,6 +705,7 @@ { metrics->root.scaler.render_mode = scaler->render_mode; metrics->root.scaler.face = scaler->face; + metrics->root.scaler.flags = scaler->flags; af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ ); af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT ); @@ -2341,11 +2342,11 @@ }; - AF_DEFINE_SCRIPT_CLASS(af_latin_script_class, + AF_DEFINE_SCRIPT_CLASS( af_latin_script_class, AF_SCRIPT_LATIN, af_latin_uniranges, - sizeof( AF_LatinMetricsRec ), + sizeof ( AF_LatinMetricsRec ), (AF_Script_InitMetricsFunc) af_latin_metrics_init, (AF_Script_ScaleMetricsFunc)af_latin_metrics_scale, diff --git a/freetype/src/autofit/aflatin2.c b/freetype/src/autofit/aflatin2.c index 23558b879..927cce7b4 100644 --- a/freetype/src/autofit/aflatin2.c +++ b/freetype/src/autofit/aflatin2.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin script (body). */ /* */ -/* Copyright 2003-2011 by */ +/* Copyright 2003-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -133,7 +133,7 @@ dist = -dist; if ( num_widths < AF_LATIN_MAX_WIDTHS ) - axis->widths[ num_widths++ ].org = dist; + axis->widths[num_widths++].org = dist; } } @@ -658,6 +658,7 @@ { metrics->root.scaler.render_mode = scaler->render_mode; metrics->root.scaler.face = scaler->face; + metrics->root.scaler.flags = scaler->flags; af_latin2_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ ); af_latin2_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT ); @@ -1359,10 +1360,10 @@ af_latin2_hints_compute_blue_edges( AF_GlyphHints hints, AF_LatinMetrics metrics ) { - AF_AxisHints axis = &hints->axis[ AF_DIMENSION_VERT ]; + AF_AxisHints axis = &hints->axis[AF_DIMENSION_VERT]; AF_Edge edge = axis->edges; AF_Edge edge_limit = edge + axis->num_edges; - AF_LatinAxis latin = &metrics->axis[ AF_DIMENSION_VERT ]; + AF_LatinAxis latin = &metrics->axis[AF_DIMENSION_VERT]; FT_Fixed scale = latin->scale; FT_Pos best_dist0; /* initial threshold */ @@ -2356,11 +2357,11 @@ }; - AF_DEFINE_SCRIPT_CLASS(af_latin2_script_class, + AF_DEFINE_SCRIPT_CLASS( af_latin2_script_class, AF_SCRIPT_LATIN2, af_latin2_uniranges, - sizeof( AF_LatinMetricsRec ), + sizeof ( AF_LatinMetricsRec ), (AF_Script_InitMetricsFunc) af_latin2_metrics_init, (AF_Script_ScaleMetricsFunc)af_latin2_metrics_scale, diff --git a/freetype/src/autofit/afloader.c b/freetype/src/autofit/afloader.c index 34ef9d809..dabd6193d 100644 --- a/freetype/src/autofit/afloader.c +++ b/freetype/src/autofit/afloader.c @@ -104,9 +104,11 @@ AF_GlyphHints hints = &loader->hints; FT_GlyphSlot slot = face->glyph; FT_Slot_Internal internal = slot->internal; + FT_Int32 flags; - error = FT_Load_Glyph( face, glyph_index, load_flags ); + flags = load_flags | FT_LOAD_LINEAR_DESIGN; + error = FT_Load_Glyph( face, glyph_index, flags ); if ( error ) goto Exit; @@ -124,10 +126,6 @@ FT_Vector_Transform( &loader->trans_delta, &inverse ); } - /* set linear metrics */ - slot->linearHoriAdvance = slot->metrics.horiAdvance; - slot->linearVertAdvance = slot->metrics.vertAdvance; - switch ( slot->format ) { case FT_GLYPH_FORMAT_OUTLINE: diff --git a/freetype/src/autofit/aftypes.h b/freetype/src/autofit/aftypes.h index 44997d1e2..21e442c23 100644 --- a/freetype/src/autofit/aftypes.h +++ b/freetype/src/autofit/aftypes.h @@ -231,7 +231,7 @@ extern void* _af_debug_hints; AF_SCRIPT_NONE = 0, AF_SCRIPT_LATIN = 1, AF_SCRIPT_CJK = 2, - AF_SCRIPT_INDIC = 3, + AF_SCRIPT_INDIC = 3, #ifdef FT_OPTION_AUTOFIT2 AF_SCRIPT_LATIN2, #endif diff --git a/freetype/src/autofit/afwarp.c b/freetype/src/autofit/afwarp.c index d0d4850bd..34a97ffc5 100644 --- a/freetype/src/autofit/afwarp.c +++ b/freetype/src/autofit/afwarp.c @@ -352,7 +352,7 @@ { FT_Fixed best_scale = warper->best_scale; FT_Pos best_delta = warper->best_delta; - + hints->xmin_delta = FT_MulFix( X1, best_scale - org_scale ) + best_delta; diff --git a/freetype/src/base/ftbitmap.c b/freetype/src/base/ftbitmap.c index 15c9d6559..84fa32275 100644 --- a/freetype/src/base/ftbitmap.c +++ b/freetype/src/base/ftbitmap.c @@ -231,7 +231,7 @@ if ( ( ( FT_PIX_ROUND( xStrength ) >> 6 ) > FT_INT_MAX ) || ( ( FT_PIX_ROUND( yStrength ) >> 6 ) > FT_INT_MAX ) ) return FT_Err_Invalid_Argument; - + xstr = (FT_Int)FT_PIX_ROUND( xStrength ) >> 6; ystr = (FT_Int)FT_PIX_ROUND( yStrength ) >> 6; diff --git a/freetype/src/base/ftoutln.c b/freetype/src/base/ftoutln.c index 9ae276d08..76e2b04a1 100644 --- a/freetype/src/base/ftoutln.c +++ b/freetype/src/base/ftoutln.c @@ -881,10 +881,20 @@ FT_EXPORT_DEF( FT_Error ) FT_Outline_Embolden( FT_Outline* outline, FT_Pos strength ) + { + return FT_Outline_EmboldenXY( outline, strength, strength ); + } + + + /* documentation is in ftoutln.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Outline_EmboldenXY( FT_Outline* outline, + FT_Pos xstrength, + FT_Pos ystrength ) { FT_Vector* points; FT_Vector v_prev, v_first, v_next, v_cur; - FT_Angle rotate, angle_in, angle_out; FT_Int c, n, first; FT_Int orientation; @@ -892,8 +902,9 @@ if ( !outline ) return FT_Err_Invalid_Argument; - strength /= 2; - if ( strength == 0 ) + xstrength /= 2; + ystrength /= 2; + if ( xstrength == 0 && ystrength == 0 ) return FT_Err_Ok; orientation = FT_Outline_Get_Orientation( outline ); @@ -905,62 +916,63 @@ return FT_Err_Ok; } - if ( orientation == FT_ORIENTATION_TRUETYPE ) - rotate = -FT_ANGLE_PI2; - else - rotate = FT_ANGLE_PI2; - points = outline->points; first = 0; for ( c = 0; c < outline->n_contours; c++ ) { - int last = outline->contours[c]; + FT_Vector in, out, shift; + FT_Fixed l_in, l_out, d; + int last = outline->contours[c]; v_first = points[first]; v_prev = points[last]; v_cur = v_first; + /* compute the incoming vector and its length */ + in.x = v_cur.x - v_prev.x; + in.y = v_cur.y - v_prev.y; + l_in = FT_Vector_Length( &in ); + for ( n = first; n <= last; n++ ) { - FT_Vector in, out; - FT_Angle angle_diff; - FT_Pos d; - FT_Fixed scale; - - if ( n < last ) v_next = points[n + 1]; else v_next = v_first; - /* compute the in and out vectors */ - in.x = v_cur.x - v_prev.x; - in.y = v_cur.y - v_prev.y; - + /* compute the outgoing vector and its length */ out.x = v_next.x - v_cur.x; out.y = v_next.y - v_cur.y; + l_out = FT_Vector_Length( &out ); - angle_in = FT_Atan2( in.x, in.y ); - angle_out = FT_Atan2( out.x, out.y ); - angle_diff = FT_Angle_Diff( angle_in, angle_out ); - scale = FT_Cos( angle_diff / 2 ); + d = l_in * l_out + in.x * out.x + in.y * out.y; - if ( scale < 0x4000L && scale > -0x4000L ) - in.x = in.y = 0; - else + /* shift only if turn is less then ~160 degrees */ + if ( 16 * d > l_in * l_out ) { - d = FT_DivFix( strength, scale ); + /* shift components are rotated */ + shift.x = FT_DivFix( l_out * in.y + l_in * out.y, d ); + shift.y = FT_DivFix( l_out * in.x + l_in * out.x, d ); - FT_Vector_From_Polar( &in, d, angle_in + angle_diff / 2 - rotate ); + if ( orientation == FT_ORIENTATION_TRUETYPE ) + shift.x = -shift.x; + else + shift.y = -shift.y; + + shift.x = FT_MulFix( xstrength, shift.x ); + shift.y = FT_MulFix( ystrength, shift.y ); } + else + shift.x = shift.y = 0; - outline->points[n].x = v_cur.x + strength + in.x; - outline->points[n].y = v_cur.y + strength + in.y; + outline->points[n].x = v_cur.x + xstrength + shift.x; + outline->points[n].y = v_cur.y + ystrength + shift.y; - v_prev = v_cur; - v_cur = v_next; + in = out; + l_in = l_out; + v_cur = v_next; } first = last + 1; @@ -975,23 +987,10 @@ FT_EXPORT_DEF( FT_Orientation ) FT_Outline_Get_Orientation( FT_Outline* outline ) { - FT_Pos xmin = 32768L; - FT_Pos xmin_ymin = 32768L; - FT_Pos xmin_ymax = -32768L; - FT_Vector* xmin_first = NULL; - FT_Vector* xmin_last = NULL; - - short* contour; - - FT_Vector* first; - FT_Vector* last; - FT_Vector* prev; - FT_Vector* point; - - int i; - FT_Pos ray_y[3]; - FT_Orientation result[3] = - { FT_ORIENTATION_NONE, FT_ORIENTATION_NONE, FT_ORIENTATION_NONE }; + FT_Vector* points; + FT_Vector v_prev, v_cur; + FT_Int c, n, first; + FT_Pos area = 0; if ( !outline || outline->n_points <= 0 ) @@ -1002,127 +1001,32 @@ /* cubic or quadratic curves, this test deals with the polygon */ /* only which is spanned up by the control points. */ - first = outline->points; - for ( contour = outline->contours; - contour < outline->contours + outline->n_contours; - contour++, first = last + 1 ) - { - FT_Pos contour_xmin = 32768L; - FT_Pos contour_xmax = -32768L; - FT_Pos contour_ymin = 32768L; - FT_Pos contour_ymax = -32768L; - - - last = outline->points + *contour; - - /* skip degenerate contours */ - if ( last < first + 2 ) - continue; - - for ( point = first; point <= last; ++point ) - { - if ( point->x < contour_xmin ) - contour_xmin = point->x; - - if ( point->x > contour_xmax ) - contour_xmax = point->x; - - if ( point->y < contour_ymin ) - contour_ymin = point->y; - - if ( point->y > contour_ymax ) - contour_ymax = point->y; - } - - if ( contour_xmin < xmin && - contour_xmin != contour_xmax && - contour_ymin != contour_ymax ) - { - xmin = contour_xmin; - xmin_ymin = contour_ymin; - xmin_ymax = contour_ymax; - xmin_first = first; - xmin_last = last; - } - } - - if ( xmin == 32768L ) - return FT_ORIENTATION_TRUETYPE; - - ray_y[0] = ( xmin_ymin * 3 + xmin_ymax ) >> 2; - ray_y[1] = ( xmin_ymin + xmin_ymax ) >> 1; - ray_y[2] = ( xmin_ymin + xmin_ymax * 3 ) >> 2; + points = outline->points; - for ( i = 0; i < 3; i++ ) + first = 0; + for ( c = 0; c < outline->n_contours; c++ ) { - FT_Pos left_x; - FT_Pos right_x; - FT_Vector* left1; - FT_Vector* left2; - FT_Vector* right1; - FT_Vector* right2; - + FT_Int last = outline->contours[c]; - RedoRay: - left_x = 32768L; - right_x = -32768L; - left1 = left2 = right1 = right2 = NULL; + v_prev = points[last]; - prev = xmin_last; - for ( point = xmin_first; point <= xmin_last; prev = point, ++point ) + for ( n = first; n <= last; n++ ) { - FT_Pos tmp_x; - - - if ( point->y == ray_y[i] || prev->y == ray_y[i] ) - { - ray_y[i]++; - goto RedoRay; - } - - if ( ( point->y < ray_y[i] && prev->y < ray_y[i] ) || - ( point->y > ray_y[i] && prev->y > ray_y[i] ) ) - continue; - - tmp_x = FT_MulDiv( point->x - prev->x, - ray_y[i] - prev->y, - point->y - prev->y ) + prev->x; - - if ( tmp_x < left_x ) - { - left_x = tmp_x; - left1 = prev; - left2 = point; - } - - if ( tmp_x > right_x ) - { - right_x = tmp_x; - right1 = prev; - right2 = point; - } + v_cur = points[n]; + area += ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ); + v_prev = v_cur; } - if ( left1 && right1 ) - { - if ( left1->y < left2->y && right1->y > right2->y ) - result[i] = FT_ORIENTATION_TRUETYPE; - else if ( left1->y > left2->y && right1->y < right2->y ) - result[i] = FT_ORIENTATION_POSTSCRIPT; - else - result[i] = FT_ORIENTATION_NONE; - } + first = last + 1; } - if ( result[0] != FT_ORIENTATION_NONE && - ( result[0] == result[1] || result[0] == result[2] ) ) - return result[0]; - - if ( result[1] != FT_ORIENTATION_NONE && result[1] == result[2] ) - return result[1]; - - return FT_ORIENTATION_TRUETYPE; + if ( area > 0 ) + return FT_ORIENTATION_POSTSCRIPT; + else if ( area < 0 ) + return FT_ORIENTATION_TRUETYPE; + else + return FT_ORIENTATION_NONE; } diff --git a/freetype/src/base/ftpic.c b/freetype/src/base/ftpic.c index d5271a972..b74e90dad 100644 --- a/freetype/src/base/ftpic.c +++ b/freetype/src/base/ftpic.c @@ -26,15 +26,15 @@ /* documentation is in ftpic.h */ FT_BASE_DEF( FT_Error ) - ft_pic_container_init( FT_Library library ) + ft_pic_container_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Error error = FT_Err_Ok; - FT_MEM_SET( pic_container, 0, sizeof(*pic_container) ); + FT_MEM_SET( pic_container, 0, sizeof ( *pic_container ) ); error = ft_base_pic_init( library ); - if(error) + if ( error ) return error; return FT_Err_Ok; @@ -43,7 +43,7 @@ /* Destroy the contents of the container. */ FT_BASE_DEF( void ) - ft_pic_container_destroy( FT_Library library ) + ft_pic_container_destroy( FT_Library library ) { ft_base_pic_free( library ); } diff --git a/freetype/src/base/ftsynth.c b/freetype/src/base/ftsynth.c index d4ec0da57..81e2ed246 100644 --- a/freetype/src/base/ftsynth.c +++ b/freetype/src/base/ftsynth.c @@ -4,7 +4,7 @@ /* */ /* FreeType synthesizing code for emboldening and slanting (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2010 by */ +/* Copyright 2000-2006, 2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -33,6 +33,7 @@ #undef FT_COMPONENT #define FT_COMPONENT trace_synth + /*************************************************************************/ /*************************************************************************/ /**** ****/ @@ -72,7 +73,7 @@ /*************************************************************************/ /*************************************************************************/ /**** ****/ - /**** EXPERIMENTAL EMBOLDENING/OUTLINING SUPPORT ****/ + /**** EXPERIMENTAL EMBOLDENING SUPPORT ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ @@ -101,12 +102,7 @@ if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) { /* ignore error */ - (void)FT_Outline_Embolden( &slot->outline, xstr ); - - /* this is more than enough for most glyphs; if you need accurate */ - /* values, you have to call FT_Outline_Get_CBox */ - xstr = xstr * 2; - ystr = xstr; + (void)FT_Outline_EmboldenXY( &slot->outline, xstr, ystr ); } else /* slot->format == FT_GLYPH_FORMAT_BITMAP */ { @@ -143,13 +139,10 @@ if ( slot->advance.y ) slot->advance.y += ystr; - slot->metrics.width += xstr; - slot->metrics.height += ystr; - slot->metrics.horiBearingY += ystr; - slot->metrics.horiAdvance += xstr; - slot->metrics.vertBearingX -= xstr / 2; - slot->metrics.vertBearingY += ystr; - slot->metrics.vertAdvance += ystr; + slot->metrics.width += xstr; + slot->metrics.height += ystr; + slot->metrics.horiAdvance += xstr; + slot->metrics.vertAdvance += ystr; /* XXX: 16-bit overflow case must be excluded before here */ if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) diff --git a/freetype/src/bdf/bdfdrivr.h b/freetype/src/bdf/bdfdrivr.h index db7093bb4..ca0dae50d 100644 --- a/freetype/src/bdf/bdfdrivr.h +++ b/freetype/src/bdf/bdfdrivr.h @@ -38,7 +38,7 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif typedef struct BDF_encoding_el_ diff --git a/freetype/src/bdf/bdflib.c b/freetype/src/bdf/bdflib.c index b7b685754..ed08a6e01 100644 --- a/freetype/src/bdf/bdflib.c +++ b/freetype/src/bdf/bdflib.c @@ -569,6 +569,7 @@ list->field[1] = (char*)empty; list->field[2] = (char*)empty; list->field[3] = (char*)empty; + list->field[4] = (char*)empty; } /* If the line is empty, then simply return. */ @@ -841,9 +842,6 @@ }; -#define isdigok( m, d ) (m[(d) >> 3] & ( 1 << ( (d) & 7 ) ) ) - - /* Routine to convert an ASCII string into an unsigned long integer. */ static unsigned long _bdf_atoul( char* s, @@ -881,7 +879,7 @@ s += 2; } - for ( v = 0; isdigok( dmap, *s ); s++ ) + for ( v = 0; sbitset( dmap, *s ); s++ ) v = v * base + a2i[(int)*s]; if ( end != 0 ) @@ -936,7 +934,7 @@ s += 2; } - for ( v = 0; isdigok( dmap, *s ); s++ ) + for ( v = 0; sbitset( dmap, *s ); s++ ) v = v * base + a2i[(int)*s]; if ( end != 0 ) @@ -991,7 +989,7 @@ s += 2; } - for ( v = 0; isdigok( dmap, *s ); s++ ) + for ( v = 0; sbitset( dmap, *s ); s++ ) v = (short)( v * base + a2i[(int)*s] ); if ( end != 0 ) @@ -1746,7 +1744,7 @@ for ( i = 0; i < nibbles; i++ ) { c = line[i]; - if ( !isdigok( hdigits, c ) ) + if ( !sbitset( hdigits, c ) ) break; *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] ); if ( i + 1 < nibbles && ( i & 1 ) ) @@ -1770,7 +1768,7 @@ /* If any line has extra columns, indicate they have been removed. */ if ( i == nibbles && - isdigok( hdigits, line[nibbles] ) && + sbitset( hdigits, line[nibbles] ) && !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) ) { FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding )); diff --git a/freetype/src/cache/ftcbasic.c b/freetype/src/cache/ftcbasic.c index 09d793ecf..d4fc353c4 100644 --- a/freetype/src/cache/ftcbasic.c +++ b/freetype/src/cache/ftcbasic.c @@ -467,7 +467,7 @@ } - + #ifdef FT_CONFIG_OPTION_OLD_INTERNALS /* yet another backwards-legacy structure */ @@ -608,7 +608,7 @@ const FTC_SFamilyClassRec ftc_basic_sbit_family_class = { { - sizeof( FTC_BasicFamilyRec ), + sizeof ( FTC_BasicFamilyRec ), ftc_basic_family_compare, ftc_basic_family_init, 0, /* FTC_MruNode_ResetFunc */ diff --git a/freetype/src/cache/ftccmap.c b/freetype/src/cache/ftccmap.c index b7bd2919d..ad436ef0c 100644 --- a/freetype/src/cache/ftccmap.c +++ b/freetype/src/cache/ftccmap.c @@ -320,7 +320,7 @@ /* * If cmap_index is greater than the maximum number of cachable - * charmaps, we assume the request is from a legacy rogue client + * charmaps, we assume the request is from a legacy rogue client * using old internal header. See include/config/ftoption.h. */ if ( cmap_index > FT_MAX_CHARMAP_CACHEABLE && !no_cmap_change ) diff --git a/freetype/src/cache/ftcmanag.c b/freetype/src/cache/ftcmanag.c index 548ebe951..76a510d04 100644 --- a/freetype/src/cache/ftcmanag.c +++ b/freetype/src/cache/ftcmanag.c @@ -28,7 +28,7 @@ #ifdef FT_CONFIG_OPTION_PIC #error "cache system does not support PIC yet" -#endif +#endif #undef FT_COMPONENT diff --git a/freetype/src/cff/cffload.h b/freetype/src/cff/cffload.h index c755de9a2..804961964 100644 --- a/freetype/src/cff/cffload.h +++ b/freetype/src/cff/cffload.h @@ -60,7 +60,7 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) - cff_font_load( FT_Library library, + cff_font_load( FT_Library library, FT_Stream stream, FT_Int face_index, CFF_Font font, diff --git a/freetype/src/cff/cfftypes.h b/freetype/src/cff/cfftypes.h index cae368956..7c99036b5 100644 --- a/freetype/src/cff/cfftypes.h +++ b/freetype/src/cff/cfftypes.h @@ -269,7 +269,7 @@ FT_BEGIN_HEADER /* since version 2.3.6 */ FT_String* registry; FT_String* ordering; - + } CFF_FontRec, *CFF_Font; diff --git a/freetype/src/cid/cidgload.c b/freetype/src/cid/cidgload.c index 81742d167..bd8402340 100644 --- a/freetype/src/cid/cidgload.c +++ b/freetype/src/cid/cidgload.c @@ -426,7 +426,7 @@ metrics->horiBearingX = cbox.xMin; metrics->horiBearingY = cbox.yMax; - if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) + if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) { /* make up vertical ones */ ft_synthesize_vertical_metrics( metrics, diff --git a/freetype/src/cid/cidriver.c b/freetype/src/cid/cidriver.c index 86ee3bba3..694070aab 100644 --- a/freetype/src/cid/cidriver.c +++ b/freetype/src/cid/cidriver.c @@ -111,13 +111,13 @@ if ( registry ) *registry = cid->registry; - + if ( ordering ) *ordering = cid->ordering; if ( supplement ) *supplement = cid->supplement; - + return CID_Err_Ok; } @@ -196,7 +196,7 @@ FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_HAS_HINTER, - sizeof( FT_DriverRec ), + sizeof ( FT_DriverRec ), "t1cid", /* module name */ 0x10000L, /* version 1.0 of driver */ 0x20000L, /* requires FreeType 2.0 */ @@ -209,9 +209,9 @@ }, /* then the other font drivers fields */ - sizeof( CID_FaceRec ), - sizeof( CID_SizeRec ), - sizeof( CID_GlyphSlotRec ), + sizeof ( CID_FaceRec ), + sizeof ( CID_SizeRec ), + sizeof ( CID_GlyphSlotRec ), cid_face_init, cid_face_done, diff --git a/freetype/src/cid/cidriver.h b/freetype/src/cid/cidriver.h index c7f424bb3..3c45e0688 100644 --- a/freetype/src/cid/cidriver.h +++ b/freetype/src/cid/cidriver.h @@ -28,7 +28,7 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_CALLBACK_TABLE diff --git a/freetype/src/gxvalid/gxvmod.c b/freetype/src/gxvalid/gxvmod.c index b2b16b1ff..502fe5dca 100644 --- a/freetype/src/gxvalid/gxvmod.c +++ b/freetype/src/gxvalid/gxvmod.c @@ -269,7 +269,7 @@ const FT_Module_Class gxv_module_class = { 0, - sizeof( FT_ModuleRec ), + sizeof ( FT_ModuleRec ), "gxvalid", 0x10000L, 0x20000L, diff --git a/freetype/src/gxvalid/gxvmod.h b/freetype/src/gxvalid/gxvmod.h index d912a8f83..22732ba99 100644 --- a/freetype/src/gxvalid/gxvmod.h +++ b/freetype/src/gxvalid/gxvmod.h @@ -36,7 +36,7 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_EXPORT_VAR( const FT_Module_Class ) gxv_module_class; diff --git a/freetype/src/gxvalid/gxvprop.c b/freetype/src/gxvalid/gxvprop.c index 54777271a..0be21336f 100644 --- a/freetype/src/gxvalid/gxvprop.c +++ b/freetype/src/gxvalid/gxvprop.c @@ -233,7 +233,7 @@ /* XXX: check range? */ offset = (FT_UShort)( base_value_p->u + - relative_gindex * sizeof( FT_UShort ) ); + relative_gindex * sizeof ( FT_UShort ) ); p = valid->lookuptbl_head + offset; limit = lookuptbl_limit; diff --git a/freetype/src/otvalid/otvmod.c b/freetype/src/otvalid/otvmod.c index 620e45233..acf213f23 100644 --- a/freetype/src/otvalid/otvmod.c +++ b/freetype/src/otvalid/otvmod.c @@ -266,7 +266,7 @@ const FT_Module_Class otv_module_class = { 0, - sizeof( FT_ModuleRec ), + sizeof ( FT_ModuleRec ), "otvalid", 0x10000L, 0x20000L, diff --git a/freetype/src/otvalid/otvmod.h b/freetype/src/otvalid/otvmod.h index 573b2a0c4..f7e155078 100644 --- a/freetype/src/otvalid/otvmod.h +++ b/freetype/src/otvalid/otvmod.h @@ -29,7 +29,7 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_EXPORT_VAR( const FT_Module_Class ) otv_module_class; diff --git a/freetype/src/pcf/pcfdrivr.h b/freetype/src/pcf/pcfdrivr.h index a81d7309e..54614951b 100644 --- a/freetype/src/pcf/pcfdrivr.h +++ b/freetype/src/pcf/pcfdrivr.h @@ -35,7 +35,7 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_EXPORT_VAR( const FT_Driver_ClassRec ) pcf_driver_class; diff --git a/freetype/src/pfr/pfrdrivr.h b/freetype/src/pfr/pfrdrivr.h index da0a1aa63..75f86c5cd 100644 --- a/freetype/src/pfr/pfrdrivr.h +++ b/freetype/src/pfr/pfrdrivr.h @@ -28,7 +28,7 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_EXPORT_VAR( const FT_Driver_ClassRec ) pfr_driver_class; diff --git a/freetype/src/psaux/psauxmod.c b/freetype/src/psaux/psauxmod.c index 4c3579f7b..4b1249d49 100644 --- a/freetype/src/psaux/psauxmod.c +++ b/freetype/src/psaux/psauxmod.c @@ -123,7 +123,7 @@ const FT_Module_Class psaux_module_class = { 0, - sizeof( FT_ModuleRec ), + sizeof ( FT_ModuleRec ), "psaux", 0x20000L, 0x20000L, diff --git a/freetype/src/psaux/psauxmod.h b/freetype/src/psaux/psauxmod.h index 35e042dbc..121723692 100644 --- a/freetype/src/psaux/psauxmod.h +++ b/freetype/src/psaux/psauxmod.h @@ -28,7 +28,7 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_EXPORT_VAR( const FT_Module_Class ) psaux_driver_class; diff --git a/freetype/src/psaux/t1decode.c b/freetype/src/psaux/t1decode.c index b3ccbdde0..ea6784122 100644 --- a/freetype/src/psaux/t1decode.c +++ b/freetype/src/psaux/t1decode.c @@ -199,7 +199,7 @@ #ifdef FT_CONFIG_OPTION_INCREMENTAL T1_Face face = (T1_Face)decoder->builder.face; -#endif +#endif if ( decoder->seac ) @@ -400,7 +400,7 @@ if ( decoder->buildchar && decoder->len_buildchar > 0 ) ft_memset( &decoder->buildchar[0], 0, - sizeof( decoder->buildchar[0] ) * decoder->len_buildchar ); + sizeof ( decoder->buildchar[0] ) * decoder->len_buildchar ); FT_TRACE4(( "\n" "Start charstring\n" )); @@ -880,7 +880,7 @@ ft_memcpy( &decoder->buildchar[idx], blend->weight_vector, blend->num_designs * - sizeof( blend->weight_vector[0] ) ); + sizeof ( blend->weight_vector[0] ) ); } break; @@ -1113,7 +1113,7 @@ FT_TRACE4(( "BuildCharArray = [ " )); for ( i = 0; i < decoder->len_buildchar; ++i ) - FT_TRACE4(( "%d ", decoder->buildchar[ i ] )); + FT_TRACE4(( "%d ", decoder->buildchar[i] )); FT_TRACE4(( "]\n" )); } diff --git a/freetype/src/pshinter/pshalgo.c b/freetype/src/pshinter/pshalgo.c index d79897891..f4fbb4d35 100644 --- a/freetype/src/pshinter/pshalgo.c +++ b/freetype/src/pshinter/pshalgo.c @@ -4,8 +4,7 @@ /* */ /* PostScript hinting algorithm (body). */ /* */ -/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 */ -/* by */ +/* Copyright 2001-2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -563,7 +562,7 @@ else if ( len > 0 ) { /* This is a very small stem; we simply align it to the - * pixel grid, trying to find the minimal displacement. + * pixel grid, trying to find the minimum displacement. * * left = pos * right = pos + len diff --git a/freetype/src/raster/ftmisc.h b/freetype/src/raster/ftmisc.h index 7773924fe..703155a42 100644 --- a/freetype/src/raster/ftmisc.h +++ b/freetype/src/raster/ftmisc.h @@ -115,6 +115,27 @@ return ( s > 0 ) ? d : -d; } + + static FT_Long + FT_MulDiv_No_Round( FT_Long a, + FT_Long b, + FT_Long c ) + { + FT_Int s; + FT_Long d; + + + s = 1; + if ( a < 0 ) { a = -a; s = -1; } + if ( b < 0 ) { b = -b; s = -s; } + if ( c < 0 ) { c = -c; s = -s; } + + d = (FT_Long)( c > 0 ? (FT_Int64)a * b / c + : 0x7FFFFFFFL ); + + return ( s > 0 ) ? d : -d; + } + #endif /* __FTMISC_H__ */ diff --git a/freetype/src/raster/ftraster.c b/freetype/src/raster/ftraster.c index f85845ec6..7d5bcaef5 100644 --- a/freetype/src/raster/ftraster.c +++ b/freetype/src/raster/ftraster.c @@ -60,7 +60,7 @@ #include #include "ftraster.h" -#include FT_INTERNAL_CALC_H /* for FT_MulDiv only */ +#include FT_INTERNAL_CALC_H /* for FT_MulDiv and FT_MulDiv_No_Round */ #include "rastpic.h" @@ -255,7 +255,8 @@ /* On the other hand, SMulDiv means `Slow MulDiv', and is used typically */ /* for clipping computations. It simply uses the FT_MulDiv() function */ /* defined in `ftcalc.h'. */ -#define SMulDiv FT_MulDiv +#define SMulDiv FT_MulDiv +#define SMulDiv_No_Round FT_MulDiv_No_Round /* The rasterizer is a very general purpose component; please leave */ /* the following redefinitions there (you never know your target */ @@ -1150,14 +1151,14 @@ if ( Dx > 0 ) { - Ix = SMulDiv( ras.precision, Dx, Dy); + Ix = SMulDiv_No_Round( ras.precision, Dx, Dy ); Rx = ( ras.precision * Dx ) % Dy; Dx = 1; } else { - Ix = SMulDiv( ras.precision, -Dx, Dy) * -1; - Rx = ( ras.precision * -Dx ) % Dy; + Ix = -SMulDiv_No_Round( ras.precision, -Dx, Dy ); + Rx = ( ras.precision * -Dx ) % Dy; Dx = -1; } diff --git a/freetype/src/raster/ftrend1.c b/freetype/src/raster/ftrend1.c index 28b1b5897..859cb7d86 100644 --- a/freetype/src/raster/ftrend1.c +++ b/freetype/src/raster/ftrend1.c @@ -244,10 +244,10 @@ } - FT_DEFINE_RENDERER(ft_raster1_renderer_class, - + FT_DEFINE_RENDERER( ft_raster1_renderer_class, + FT_MODULE_RENDERER, - sizeof( FT_RendererRec ), + sizeof ( FT_RendererRec ), "raster1", 0x10000L, @@ -275,11 +275,10 @@ /* to register it by hand in your application. It should only be */ /* used for backwards-compatibility with FT 1.x anyway. */ /* */ - FT_DEFINE_RENDERER(ft_raster5_renderer_class, - - + FT_DEFINE_RENDERER( ft_raster5_renderer_class, + FT_MODULE_RENDERER, - sizeof( FT_RendererRec ), + sizeof ( FT_RendererRec ), "raster5", 0x10000L, diff --git a/freetype/src/sfnt/sfobjs.c b/freetype/src/sfnt/sfobjs.c index d7be631af..2bc4bd930 100644 --- a/freetype/src/sfnt/sfobjs.c +++ b/freetype/src/sfnt/sfobjs.c @@ -4,7 +4,7 @@ /* */ /* SFNT object management (base). */ /* */ -/* Copyright 1996-2008, 2010-2011 by */ +/* Copyright 1996-2008, 2010-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -64,13 +64,17 @@ for ( n = 0; n < len; n++ ) { code = FT_NEXT_USHORT( read ); + + if ( code == 0 ) + break; + if ( code < 32 || code > 127 ) code = '?'; string[n] = (char)code; } - string[len] = 0; + string[n] = 0; return string; } @@ -95,13 +99,17 @@ for ( n = 0; n < len; n++ ) { code = *read++; + + if ( code == 0 ) + break; + if ( code < 32 || code > 127 ) code = '?'; string[n] = (char)code; } - string[len] = 0; + string[n] = 0; return string; } diff --git a/freetype/src/sfnt/ttcmap.c b/freetype/src/sfnt/ttcmap.c index 544750ab1..1dfd9876f 100644 --- a/freetype/src/sfnt/ttcmap.c +++ b/freetype/src/sfnt/ttcmap.c @@ -3363,7 +3363,7 @@ return error; /* the location of the class instances follows the array of pointers */ - recs = (TT_CMap_ClassRec*) (((char*)clazz)+(sizeof(*clazz)*(i+1))); + recs = (TT_CMap_ClassRec*) (((char*)clazz)+(sizeof(*clazz)*(i+1))); i=0; #undef TTCMAPCITEM diff --git a/freetype/src/sfnt/ttcmap.h b/freetype/src/sfnt/ttcmap.h index 15a4a21e5..94f797897 100644 --- a/freetype/src/sfnt/ttcmap.h +++ b/freetype/src/sfnt/ttcmap.h @@ -70,7 +70,7 @@ FT_BEGIN_HEADER format_, validate_, get_cmap_info_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ #define FT_DEFINE_TT_CMAP(class_, size_, init_, done_, char_index_, \ char_next_, char_var_index_, char_var_default_, variant_list_, \ @@ -92,9 +92,9 @@ FT_BEGIN_HEADER clazz->format = format_; \ clazz->validate = validate_; \ clazz->get_cmap_info = get_cmap_info_; \ - } + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ typedef struct TT_ValidatorRec_ { diff --git a/freetype/src/sfnt/ttload.c b/freetype/src/sfnt/ttload.c index 5fb9aea4e..2beb57b67 100644 --- a/freetype/src/sfnt/ttload.c +++ b/freetype/src/sfnt/ttload.c @@ -5,8 +5,7 @@ /* Load the basic TrueType tables, i.e., tables that can be either in */ /* TTF or OTF fonts (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -624,7 +623,7 @@ FT_Error error; TT_MaxProfile* maxProfile = &face->max_profile; - const FT_Frame_Field maxp_fields[] = + static const FT_Frame_Field maxp_fields[] = { #undef FT_STRUCTURE #define FT_STRUCTURE TT_MaxProfile @@ -635,7 +634,7 @@ FT_FRAME_END }; - const FT_Frame_Field maxp_fields_extra[] = + static const FT_Frame_Field maxp_fields_extra[] = { FT_FRAME_START( 26 ), FT_FRAME_USHORT( maxPoints ), @@ -721,7 +720,7 @@ /*************************************************************************/ /* */ /* */ - /* tt_face_load_names */ + /* tt_face_load_name */ /* */ /* */ /* Loads the name records. */ @@ -952,7 +951,7 @@ FT_Error error; TT_OS2* os2; - const FT_Frame_Field os2_fields[] = + static const FT_Frame_Field os2_fields[] = { #undef FT_STRUCTURE #define FT_STRUCTURE TT_OS2 @@ -1004,7 +1003,7 @@ FT_FRAME_END }; - const FT_Frame_Field os2_fields_extra[] = + static const FT_Frame_Field os2_fields_extra[] = { FT_FRAME_START( 8 ), FT_FRAME_ULONG( ulCodePageRange1 ), @@ -1012,7 +1011,7 @@ FT_FRAME_END }; - const FT_Frame_Field os2_fields_extra2[] = + static const FT_Frame_Field os2_fields_extra2[] = { FT_FRAME_START( 10 ), FT_FRAME_SHORT ( sxHeight ), diff --git a/freetype/src/sfnt/ttmtx.c b/freetype/src/sfnt/ttmtx.c index 73ac8b2d5..8f7b2a93b 100644 --- a/freetype/src/sfnt/ttmtx.c +++ b/freetype/src/sfnt/ttmtx.c @@ -4,7 +4,7 @@ /* */ /* Load the metrics tables common to TTF and OTF fonts (body). */ /* */ -/* Copyright 2006-2009, 2011 by */ +/* Copyright 2006-2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -260,7 +260,7 @@ FT_Error error; TT_HoriHeader* header; - const FT_Frame_Field metrics_header_fields[] = + static const FT_Frame_Field metrics_header_fields[] = { #undef FT_STRUCTURE #define FT_STRUCTURE TT_HoriHeader diff --git a/freetype/src/smooth/ftgrays.c b/freetype/src/smooth/ftgrays.c index 4c0eea596..926020a2c 100644 --- a/freetype/src/smooth/ftgrays.c +++ b/freetype/src/smooth/ftgrays.c @@ -312,7 +312,7 @@ typedef ptrdiff_t FT_PtrDist; #endif /* PIXEL_BITS >= 8 */ - /* maximal number of gray spans in a call to the span callback */ + /* maximum number of gray spans in a call to the span callback */ #define FT_MAX_GRAY_SPANS 32 diff --git a/freetype/src/truetype/ttgload.c b/freetype/src/truetype/ttgload.c index ce8c8887b..22cbc09e2 100644 --- a/freetype/src/truetype/ttgload.c +++ b/freetype/src/truetype/ttgload.c @@ -1983,13 +1983,11 @@ FT_UInt glyph_index, FT_Int32 load_flags ) { - TT_Face face; FT_Error error; TT_LoaderRec loader; - face = (TT_Face)glyph->face; - error = TT_Err_Ok; + error = TT_Err_Ok; #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS @@ -2003,10 +2001,7 @@ error = load_sbit_image( size, glyph, glyph_index, load_flags ); if ( !error ) { - FT_Face root = &face->root; - - - if ( FT_IS_SCALABLE( root ) ) + if ( FT_IS_SCALABLE( glyph->face ) ) { /* for the bbox we need the header only */ (void)tt_loader_init( &loader, size, glyph, load_flags, TRUE ); diff --git a/freetype/src/truetype/ttinterp.c b/freetype/src/truetype/ttinterp.c index 3acb24a2f..3a8680f83 100644 --- a/freetype/src/truetype/ttinterp.c +++ b/freetype/src/truetype/ttinterp.c @@ -52,7 +52,7 @@ /* */ /* In order to detect infinite loops in the code, we set up a counter */ /* within the run loop. A single stroke of interpretation is now */ - /* limited to a maximal number of opcodes defined below. */ + /* limited to a maximum number of opcodes defined below. */ /* */ #define MAX_RUNNABLE_OPCODES 1000000L @@ -1463,7 +1463,7 @@ #else - /* compute (a*b)/2^14 with maximal accuracy and rounding */ + /* compute (a*b)/2^14 with maximum accuracy and rounding */ static FT_Int32 TT_MulFix14( FT_Int32 a, FT_Int b ) @@ -1493,7 +1493,7 @@ #endif - /* compute (ax*bx+ay*by)/2^14 with maximal accuracy and rounding */ + /* compute (ax*bx+ay*by)/2^14 with maximum accuracy and rounding */ static FT_Int32 TT_DotFix14( FT_Int32 ax, FT_Int32 ay, @@ -3110,14 +3110,9 @@ CUR.GS.single_width_cutin = (FT_F26Dot6)args[0]; - /* XXX: UNDOCUMENTED! or bug in the Windows engine? */ - /* */ - /* It seems that the value that is read here is */ - /* expressed in 16.16 format rather than in font */ - /* units. */ - /* */ -#define DO_SSW \ - CUR.GS.single_width_value = (FT_F26Dot6)( args[0] >> 10 ); +#define DO_SSW \ + CUR.GS.single_width_value = TT_MULFIX( args[0], \ + CUR.tt_metrics.scale ); #define DO_FLIPON \ @@ -5772,7 +5767,7 @@ /* */ /* UNDOCUMENTED: According to Greg Hitchcock, there is one (virtual) */ /* contour in the twilight zone, namely contour number */ - /* zero. */ + /* zero which includes all points of it. */ /* */ static void Ins_SHC( INS_ARG ) diff --git a/freetype/src/truetype/ttobjs.c b/freetype/src/truetype/ttobjs.c index 814c713aa..1f8a76891 100644 --- a/freetype/src/truetype/ttobjs.c +++ b/freetype/src/truetype/ttobjs.c @@ -244,7 +244,7 @@ tt_check_trickyness_sfnt_ids( TT_Face face ) { #define TRICK_SFNT_IDS_PER_FACE 3 -#define TRICK_SFNT_IDS_NUM_FACES 13 +#define TRICK_SFNT_IDS_NUM_FACES 17 static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES] [TRICK_SFNT_IDS_PER_FACE] = { @@ -317,6 +317,26 @@ { 0x00000000, 0x00000000 }, /* cvt */ { 0x0d3de9cb, 0x00000141 }, /* fpgm */ { 0xd4127766, 0x00002280 } /* prep */ + }, + { /* NEC FA-Gothic, 1996 */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0x4a692698, 0x000001f0 }, /* fpgm */ + { 0x340d4346, 0x00001fca } /* prep */ + }, + { /* NEC FA-Minchou, 1996 */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0xcd34c604, 0x00000166 }, /* fpgm */ + { 0x6cf31046, 0x000022b0 } /* prep */ + }, + { /* NEC FA-RoundGothicB, 1996 */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0x5da75315, 0x0000019d }, /* fpgm */ + { 0x40745a5f, 0x000022e0 } /* prep */ + }, + { /* NEC FA-RoundGothicM, 1996 */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0xf055fc48, 0x000001c2 }, /* fpgm */ + { 0x3900ded3, 0x00001e18 } /* prep */ } }; diff --git a/freetype/src/type1/t1driver.h b/freetype/src/type1/t1driver.h index 9fecbeb0f..639cd4a7a 100644 --- a/freetype/src/type1/t1driver.h +++ b/freetype/src/type1/t1driver.h @@ -28,7 +28,7 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_EXPORT_VAR( const FT_Driver_ClassRec ) t1_driver_class; diff --git a/freetype/src/type1/t1load.c b/freetype/src/type1/t1load.c index a0adfd490..7313fef16 100644 --- a/freetype/src/type1/t1load.c +++ b/freetype/src/type1/t1load.c @@ -71,6 +71,13 @@ #include "t1errors.h" +#ifdef FT_CONFIG_OPTION_INCREMENTAL +#define IS_INCREMENTAL ( face->root.internal->incremental_interface != 0 ) +#else +#define IS_INCREMENTAL 0 +#endif + + /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ @@ -1004,13 +1011,24 @@ max_objects = 0; } - if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY || - field->type == T1_FIELD_TYPE_FIXED_ARRAY ) - error = T1_Load_Field_Table( &loader->parser, field, - objects, max_objects, 0 ); + if ( *objects ) + { + if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY || + field->type == T1_FIELD_TYPE_FIXED_ARRAY ) + error = T1_Load_Field_Table( &loader->parser, field, + objects, max_objects, 0 ); + else + error = T1_Load_Field( &loader->parser, field, + objects, max_objects, 0 ); + } else - error = T1_Load_Field( &loader->parser, field, - objects, max_objects, 0 ); + { + FT_TRACE1(( "t1_load_keyword: ignoring keyword `%s'" + " which is not valid at this point\n" + " (probably due to missing keywords)\n", + field->ident )); + error = T1_Err_Ok; + } Exit: return error; @@ -1030,7 +1048,8 @@ static int read_binary_data( T1_Parser parser, FT_Long* size, - FT_Byte** base ) + FT_Byte** base, + FT_Bool incremental ) { FT_Byte* cur; FT_Byte* limit = parser->root.limit; @@ -1065,8 +1084,12 @@ } } - FT_ERROR(( "read_binary_data: invalid size field\n" )); - parser->root.error = T1_Err_Invalid_File_Format; + if( !incremental ) + { + FT_ERROR(( "read_binary_data: invalid size field\n" )); + parser->root.error = T1_Err_Invalid_File_Format; + } + return 0; } @@ -1387,16 +1410,17 @@ FT_Byte* base; - /* If the next token isn't `dup' we are done. */ - if ( parser->root.cursor + 4 < parser->root.limit && - ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 ) + /* If we are out of data, or if the next token isn't `dup', */ + /* we are done. */ + if ( parser->root.cursor + 4 >= parser->root.limit || + ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 ) break; T1_Skip_PS_Token( parser ); /* `dup' */ idx = T1_ToInt( parser ); - if ( !read_binary_data( parser, &size, &base ) ) + if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) ) return; /* The binary string is followed by one token, e.g. `NP' */ @@ -1582,7 +1606,7 @@ cur++; /* skip `/' */ len = parser->root.cursor - cur; - if ( !read_binary_data( parser, &size, &base ) ) + if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) ) return; /* for some non-standard fonts like `Optima' which provides */ @@ -1871,7 +1895,7 @@ parser->root.cursor = start_binary; - if ( !read_binary_data( parser, &s, &b ) ) + if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) ) return T1_Err_Invalid_File_Format; have_integer = 0; } @@ -1884,7 +1908,7 @@ parser->root.cursor = start_binary; - if ( !read_binary_data( parser, &s, &b ) ) + if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) ) return T1_Err_Invalid_File_Format; have_integer = 0; } @@ -1957,8 +1981,8 @@ if ( !( dict & keyword->dict ) ) { - FT_TRACE1(( "parse_dict: found %s but ignoring it " - "since it is in the wrong dictionary\n", + FT_TRACE1(( "parse_dict: found `%s' but ignoring it" + " since it is in the wrong dictionary\n", keyword->ident )); break; } @@ -2160,9 +2184,7 @@ type1->subrs_len = loader.subrs.lengths; } -#ifdef FT_CONFIG_OPTION_INCREMENTAL - if ( !face->root.internal->incremental_interface ) -#endif + if ( !IS_INCREMENTAL ) if ( !loader.charstrings.init ) { FT_ERROR(( "T1_Open_Face: no `/CharStrings' array in face\n" )); diff --git a/freetype/src/type1/t1tokens.h b/freetype/src/type1/t1tokens.h index 2d692f0e6..e37276b90 100644 --- a/freetype/src/type1/t1tokens.h +++ b/freetype/src/type1/t1tokens.h @@ -96,7 +96,7 @@ T1_FIELD_DICT_PRIVATE ) T1_FIELD_BOOL ( "ForceBold", force_bold, T1_FIELD_DICT_PRIVATE ) - + #undef FT_STRUCTURE #define FT_STRUCTURE T1_FontRec diff --git a/freetype/src/type42/t42drivr.h b/freetype/src/type42/t42drivr.h index 4717e4613..9a1e97e30 100644 --- a/freetype/src/type42/t42drivr.h +++ b/freetype/src/type42/t42drivr.h @@ -27,7 +27,7 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_EXPORT_VAR( const FT_Driver_ClassRec ) t42_driver_class; diff --git a/freetype/src/winfonts/winfnt.h b/freetype/src/winfonts/winfnt.h index 70a90861a..b7a80736d 100644 --- a/freetype/src/winfonts/winfnt.h +++ b/freetype/src/winfonts/winfnt.h @@ -30,7 +30,7 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif typedef struct WinMZ_HeaderRec_ { -- cgit v1.2.3