aboutsummaryrefslogtreecommitdiff
path: root/freetype/src/type1
diff options
context:
space:
mode:
Diffstat (limited to 'freetype/src/type1')
-rw-r--r--freetype/src/type1/t1afm.c6
-rw-r--r--freetype/src/type1/t1driver.h4
-rw-r--r--freetype/src/type1/t1gload.c58
-rw-r--r--freetype/src/type1/t1load.c58
-rw-r--r--freetype/src/type1/t1objs.c5
-rw-r--r--freetype/src/type1/t1parse.c15
6 files changed, 74 insertions, 72 deletions
diff --git a/freetype/src/type1/t1afm.c b/freetype/src/type1/t1afm.c
index 5aea58820..16dc471c5 100644
--- a/freetype/src/type1/t1afm.c
+++ b/freetype/src/type1/t1afm.c
@@ -50,13 +50,17 @@
/* read a glyph name and return the equivalent glyph index */
static FT_Int
t1_get_index( const char* name,
- FT_UInt len,
+ FT_Offset len,
void* user_data )
{
T1_Font type1 = (T1_Font)user_data;
FT_Int n;
+ /* PS string/name length must be < 16-bit */
+ if ( ( len - 0xFFFFU ) > 0 )
+ return 0;
+
for ( n = 0; n < type1->num_glyphs; n++ )
{
char* gname = (char*)type1->glyph_names[n];
diff --git a/freetype/src/type1/t1driver.h b/freetype/src/type1/t1driver.h
index ad429440d..9fecbeb0f 100644
--- a/freetype/src/type1/t1driver.h
+++ b/freetype/src/type1/t1driver.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 ) t1_driver_class;
diff --git a/freetype/src/type1/t1gload.c b/freetype/src/type1/t1gload.c
index c3ac13f59..16586153f 100644
--- a/freetype/src/type1/t1gload.c
+++ b/freetype/src/type1/t1gload.c
@@ -18,6 +18,7 @@
#include <ft2build.h>
#include "t1gload.h"
+#include FT_INTERNAL_CALC_H
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
#include FT_OUTLINE_H
@@ -62,6 +63,11 @@
T1_Font type1 = &face->type1;
FT_Error error = T1_Err_Ok;
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ FT_Incremental_InterfaceRec *inc =
+ face->root.internal->incremental_interface;
+#endif
+
decoder->font_matrix = type1->font_matrix;
decoder->font_offset = type1->font_offset;
@@ -70,10 +76,9 @@
/* For incremental fonts get the character data using the */
/* callback function. */
- if ( face->root.internal->incremental_interface )
- error = face->root.internal->incremental_interface->funcs->get_glyph_data(
- face->root.internal->incremental_interface->object,
- glyph_index, char_string );
+ if ( inc )
+ error = inc->funcs->get_glyph_data( inc->object,
+ glyph_index, char_string );
else
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
@@ -92,21 +97,21 @@
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Incremental fonts can optionally override the metrics. */
- if ( !error && face->root.internal->incremental_interface &&
- face->root.internal->incremental_interface->funcs->get_glyph_metrics )
+ if ( !error && inc && inc->funcs->get_glyph_metrics )
{
FT_Incremental_MetricsRec metrics;
- metrics.bearing_x = decoder->builder.left_bearing.x;
- metrics.bearing_y = decoder->builder.left_bearing.y;
- metrics.advance = decoder->builder.advance.x;
- error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
- face->root.internal->incremental_interface->object,
- glyph_index, FALSE, &metrics );
- decoder->builder.left_bearing.x = metrics.bearing_x;
- decoder->builder.left_bearing.y = metrics.bearing_y;
- decoder->builder.advance.x = metrics.advance;
+ metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x );
+ metrics.bearing_y = FIXED_TO_INT( decoder->builder.left_bearing.y );
+ metrics.advance = FIXED_TO_INT( decoder->builder.advance.x );
+
+ error = inc->funcs->get_glyph_metrics( inc->object,
+ glyph_index, FALSE, &metrics );
+
+ decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x );
+ decoder->builder.left_bearing.y = INT_TO_FIXED( metrics.bearing_y );
+ decoder->builder.advance.x = INT_TO_FIXED( metrics.advance );
decoder->builder.advance.y = 0;
}
@@ -215,8 +220,6 @@
FT_UInt nn;
FT_Error error;
- FT_UNUSED( load_flags );
-
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
{
@@ -252,7 +255,7 @@
{
error = T1_Parse_Glyph( &decoder, first + nn );
if ( !error )
- advances[nn] = decoder.builder.advance.x;
+ advances[nn] = FIXED_TO_INT( decoder.builder.advance.x );
else
advances[nn] = 0;
}
@@ -370,11 +373,14 @@
FT_Slot_Internal internal = glyph->root.internal;
- glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x;
- glyph->root.metrics.horiAdvance = decoder.builder.advance.x;
- internal->glyph_matrix = font_matrix;
- internal->glyph_delta = font_offset;
- internal->glyph_transformed = 1;
+ glyph->root.metrics.horiBearingX =
+ FIXED_TO_INT( decoder.builder.left_bearing.x );
+ glyph->root.metrics.horiAdvance =
+ FIXED_TO_INT( decoder.builder.advance.x );
+
+ internal->glyph_matrix = font_matrix;
+ internal->glyph_delta = font_offset;
+ internal->glyph_transformed = 1;
}
else
{
@@ -384,8 +390,10 @@
/* copy the _unscaled_ advance width */
- metrics->horiAdvance = decoder.builder.advance.x;
- glyph->root.linearHoriAdvance = decoder.builder.advance.x;
+ metrics->horiAdvance =
+ FIXED_TO_INT( decoder.builder.advance.x );
+ glyph->root.linearHoriAdvance =
+ FIXED_TO_INT( decoder.builder.advance.x );
glyph->root.internal->glyph_transformed = 0;
/* make up vertical ones */
diff --git a/freetype/src/type1/t1load.c b/freetype/src/type1/t1load.c
index 06e72cca6..d867e942c 100644
--- a/freetype/src/type1/t1load.c
+++ b/freetype/src/type1/t1load.c
@@ -65,6 +65,7 @@
#include FT_CONFIG_CONFIG_H
#include FT_MULTIPLE_MASTERS_H
#include FT_INTERNAL_TYPE1_TYPES_H
+#include FT_INTERNAL_CALC_H
#include "t1load.h"
#include "t1errors.h"
@@ -213,10 +214,6 @@
}
-#define FT_INT_TO_FIXED( a ) ( (a) << 16 )
-#define FT_FIXED_TO_INT( a ) ( FT_RoundFix( a ) >> 16 )
-
-
/*************************************************************************/
/* */
/* Given a normalized (blend) coordinate, figure out the design */
@@ -230,7 +227,7 @@
if ( ncv <= axismap->blend_points[0] )
- return FT_INT_TO_FIXED( axismap->design_points[0] );
+ return INT_TO_FIXED( axismap->design_points[0] );
for ( j = 1; j < axismap->num_points; ++j )
{
@@ -241,7 +238,7 @@
axismap->blend_points[j] -
axismap->blend_points[j - 1] );
- return FT_INT_TO_FIXED( axismap->design_points[j - 1] ) +
+ return INT_TO_FIXED( axismap->design_points[j - 1] ) +
FT_MulDiv( t,
axismap->design_points[j] -
axismap->design_points[j - 1],
@@ -249,7 +246,7 @@
}
}
- return FT_INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] );
+ return INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] );
}
@@ -331,8 +328,8 @@
for ( i = 0 ; i < mmaster.num_axis; ++i )
{
mmvar->axis[i].name = mmaster.axis[i].name;
- mmvar->axis[i].minimum = FT_INT_TO_FIXED( mmaster.axis[i].minimum);
- mmvar->axis[i].maximum = FT_INT_TO_FIXED( mmaster.axis[i].maximum);
+ mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum);
+ mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum);
mmvar->axis[i].def = ( mmvar->axis[i].minimum +
mmvar->axis[i].maximum ) / 2;
/* Does not apply. But this value is in range */
@@ -502,7 +499,7 @@
if ( num_coords <= 4 && num_coords > 0 )
{
for ( i = 0; i < num_coords; ++i )
- lcoords[i] = FT_FIXED_TO_INT( coords[i] );
+ lcoords[i] = FIXED_TO_INT( coords[i] );
error = T1_Set_MM_Design( face, num_coords, lcoords );
}
@@ -654,8 +651,8 @@
}
if ( num_designs == 0 || num_designs > T1_MAX_MM_DESIGNS )
{
- FT_ERROR(( "parse_blend_design_positions:" ));
- FT_ERROR(( " incorrect number of designs: %d\n",
+ FT_ERROR(( "parse_blend_design_positions:"
+ " incorrect number of designs: %d\n",
num_designs ));
error = T1_Err_Invalid_File_Format;
goto Exit;
@@ -687,8 +684,8 @@
{
if ( n_axis <= 0 || n_axis > T1_MAX_MM_AXIS )
{
- FT_ERROR(( "parse_blend_design_positions:" ));
- FT_ERROR(( " invalid number of axes: %d\n",
+ FT_ERROR(( "parse_blend_design_positions:"
+ " invalid number of axes: %d\n",
n_axis ));
error = T1_Err_Invalid_File_Format;
goto Exit;
@@ -842,8 +839,8 @@
}
if ( num_designs == 0 || num_designs > T1_MAX_MM_DESIGNS )
{
- FT_ERROR(( "parse_weight_vector:" ));
- FT_ERROR(( " incorrect number of designs: %d\n",
+ FT_ERROR(( "parse_weight_vector:"
+ " incorrect number of designs: %d\n",
num_designs ));
error = T1_Err_Invalid_File_Format;
goto Exit;
@@ -859,9 +856,9 @@
else if ( blend->num_designs != (FT_UInt)num_designs )
{
FT_ERROR(( "parse_weight_vector:"
- " /BlendDesignPosition and /WeightVector have\n" ));
- FT_ERROR(( " "
- " different number of elements!\n" ));
+ " /BlendDesignPosition and /WeightVector have\n"
+ " "
+ " different number of elements\n" ));
error = T1_Err_Invalid_File_Format;
goto Exit;
}
@@ -1143,7 +1140,7 @@
cur = parser->root.cursor;
if ( cur >= limit )
{
- FT_ERROR(( "parse_encoding: out of bounds!\n" ));
+ FT_ERROR(( "parse_encoding: out of bounds\n" ));
parser->root.error = T1_Err_Invalid_File_Format;
return;
}
@@ -2156,7 +2153,7 @@
#endif
if ( !loader.charstrings.init )
{
- FT_ERROR(( "T1_Open_Face: no `/CharStrings' array in face!\n" ));
+ FT_ERROR(( "T1_Open_Face: no `/CharStrings' array in face\n" ));
error = T1_Err_Invalid_File_Format;
}
@@ -2185,8 +2182,8 @@
/* the index is then stored in type1.encoding.char_index, and */
/* a the name to type1.encoding.char_name */
- min_char = +32000;
- max_char = -32000;
+ min_char = 0;
+ max_char = 0;
charcode = 0;
for ( ; charcode < loader.encoding_table.max_elems; charcode++ )
@@ -2212,25 +2209,14 @@
{
if ( charcode < min_char )
min_char = charcode;
- if ( charcode > max_char )
- max_char = charcode;
+ if ( charcode >= max_char )
+ max_char = charcode + 1;
}
break;
}
}
}
- /*
- * Yes, this happens: Certain PDF-embedded fonts have only a
- * `.notdef' glyph defined!
- */
-
- if ( min_char > max_char )
- {
- min_char = 0;
- max_char = loader.encoding_table.max_elems;
- }
-
type1->encoding.code_first = min_char;
type1->encoding.code_last = max_char;
type1->encoding.num_chars = loader.num_chars;
diff --git a/freetype/src/type1/t1objs.c b/freetype/src/type1/t1objs.c
index 2f90dd62f..e9357e6c5 100644
--- a/freetype/src/type1/t1objs.c
+++ b/freetype/src/type1/t1objs.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 objects manager (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, */
@@ -17,6 +17,7 @@
#include <ft2build.h>
+#include FT_INTERNAL_CALC_H
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
#include FT_TRUETYPE_IDS_H
@@ -467,7 +468,7 @@
/* in case of error, keep the standard width */
if ( !error )
- root->max_advance_width = (FT_Short)max_advance;
+ root->max_advance_width = (FT_Short)FIXED_TO_INT( max_advance );
else
error = T1_Err_Ok; /* clear error */
}
diff --git a/freetype/src/type1/t1parse.c b/freetype/src/type1/t1parse.c
index 36f5c82c8..1bef56bcf 100644
--- a/freetype/src/type1/t1parse.c
+++ b/freetype/src/type1/t1parse.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 parser (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -35,7 +35,6 @@
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_POSTSCRIPT_AUX_H
@@ -298,8 +297,8 @@
/* and allocate private dictionary buffer */
if ( parser->private_len == 0 )
{
- FT_ERROR(( "T1_Get_Private_Dict:" ));
- FT_ERROR(( " invalid private dictionary section\n" ));
+ FT_ERROR(( "T1_Get_Private_Dict:"
+ " invalid private dictionary section\n" ));
error = T1_Err_Invalid_File_Format;
goto Fail;
}
@@ -354,8 +353,8 @@
cur++;
if ( cur >= limit )
{
- FT_ERROR(( "T1_Get_Private_Dict:" ));
- FT_ERROR(( " could not find `eexec' keyword\n" ));
+ FT_ERROR(( "T1_Get_Private_Dict:"
+ " could not find `eexec' keyword\n" ));
error = T1_Err_Invalid_File_Format;
goto Exit;
}
@@ -408,8 +407,8 @@
cur++;
else
{
- FT_ERROR(( "T1_Get_Private_Dict:" ));
- FT_ERROR(( " `eexec' not properly terminated\n" ));
+ FT_ERROR(( "T1_Get_Private_Dict:"
+ " `eexec' not properly terminated\n" ));
error = T1_Err_Invalid_File_Format;
goto Exit;
}