forked from minhngoc25a/freetype2
* src/sfnt/ttload.c (TT_LookUp_Table): Protect against tables
with a zero length value. * builds/beos/beos.mk: Include `link-std.mk'. * src/type1/t1load.h (T1_Loader): Renamed to... (T1_LoaderRec): This. (T1_Loader): Now pointer to T1_LoaderRec. * src/type1/t1load.c: Updated. * include/freetype/internal/t1types.h, src/type1/t1load.c, src/type1/t1objs.c: s/T1_ENCODING_TYPE_EXPORT/T1_ENCODING_TYPE_EXPERT/.
This commit is contained in:
parent
95fcaf8df7
commit
bd889e5de9
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
|||
2002-05-12 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* src/sfnt/ttload.c (TT_LookUp_Table): Protect against tables
|
||||
with a zero length value.
|
||||
|
||||
2002-05-12 Michael Pfeiffer <michael.pfeiffer@utanet.at>
|
||||
|
||||
* builds/beos/beos.mk: Include `link-std.mk'.
|
||||
|
||||
2002-05-12 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* src/type1/t1load.h (T1_Loader): Renamed to...
|
||||
(T1_LoaderRec): This.
|
||||
(T1_Loader): Now pointer to T1_LoaderRec.
|
||||
* src/type1/t1load.c: Updated.
|
||||
|
||||
* include/freetype/internal/t1types.h, src/type1/t1load.c,
|
||||
src/type1/t1objs.c:
|
||||
s/T1_ENCODING_TYPE_EXPORT/T1_ENCODING_TYPE_EXPERT/.
|
||||
|
||||
2002-05-06 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* README: Add a note regarding libttf vs. libfreetype.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# FreeType 2 configuration rules for a BeOS system
|
||||
#
|
||||
|
||||
# Copyright 1996-2000 by
|
||||
# Copyright 1996-2000, 2002 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -13,6 +13,7 @@
|
|||
|
||||
include $(TOP)/builds/compiler/ansi-cc.mk
|
||||
include $(TOP)/builds/beos/beos-def.mk
|
||||
include $(TOP)/builds/link_std.mk
|
||||
|
||||
# EOF
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ FT_BEGIN_HEADER
|
|||
T1_ENCODING_TYPE_ARRAY,
|
||||
T1_ENCODING_TYPE_STANDARD,
|
||||
T1_ENCODING_TYPE_ISOLATIN1,
|
||||
T1_ENCODING_TYPE_EXPORT
|
||||
T1_ENCODING_TYPE_EXPERT
|
||||
|
||||
} T1_EncodingType;
|
||||
|
||||
|
|
|
@ -73,7 +73,9 @@
|
|||
|
||||
for ( ; entry < limit; entry++ )
|
||||
{
|
||||
if ( entry->Tag == tag )
|
||||
/* For compatibility with Windows, we consider 0-length */
|
||||
/* tables the same as missing tables. */
|
||||
if ( entry->Tag == tag && entry->Length != 0 )
|
||||
{
|
||||
FT_TRACE3(( "found table.\n" ));
|
||||
return entry;
|
||||
|
|
|
@ -445,8 +445,8 @@
|
|||
const char* gname = face->type1.glyph_names[n];
|
||||
|
||||
|
||||
if ( gname && gname[0] == glyph_name[0] &&
|
||||
ft_strcmp( gname, glyph_name ) == 0 )
|
||||
if ( gname && gname[0] == glyph_name[0] &&
|
||||
ft_strcmp( gname, glyph_name ) == 0 )
|
||||
return charcode;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -378,8 +378,8 @@
|
|||
|
||||
|
||||
static void
|
||||
parse_blend_axis_types( T1_Face face,
|
||||
T1_Loader* loader )
|
||||
parse_blend_axis_types( T1_Face face,
|
||||
T1_Loader loader )
|
||||
{
|
||||
T1_TokenRec axis_tokens[ T1_MAX_MM_AXIS ];
|
||||
FT_Int n, num_axis;
|
||||
|
@ -440,8 +440,8 @@
|
|||
|
||||
|
||||
static void
|
||||
parse_blend_design_positions( T1_Face face,
|
||||
T1_Loader* loader )
|
||||
parse_blend_design_positions( T1_Face face,
|
||||
T1_Loader loader )
|
||||
{
|
||||
T1_TokenRec design_tokens[ T1_MAX_MM_DESIGNS ];
|
||||
FT_Int num_designs;
|
||||
|
@ -522,8 +522,8 @@
|
|||
|
||||
|
||||
static void
|
||||
parse_blend_design_map( T1_Face face,
|
||||
T1_Loader* loader )
|
||||
parse_blend_design_map( T1_Face face,
|
||||
T1_Loader loader )
|
||||
{
|
||||
FT_Error error = 0;
|
||||
T1_Parser parser = &loader->parser;
|
||||
|
@ -603,8 +603,8 @@
|
|||
|
||||
|
||||
static void
|
||||
parse_weight_vector( T1_Face face,
|
||||
T1_Loader* loader )
|
||||
parse_weight_vector( T1_Face face,
|
||||
T1_Loader loader )
|
||||
{
|
||||
FT_Error error = 0;
|
||||
T1_Parser parser = &loader->parser;
|
||||
|
@ -655,8 +655,8 @@
|
|||
/* of spec!); we detect it and terminate the parsing */
|
||||
/* */
|
||||
static void
|
||||
parse_shared_dict( T1_Face face,
|
||||
T1_Loader* loader )
|
||||
parse_shared_dict( T1_Face face,
|
||||
T1_Loader loader )
|
||||
{
|
||||
T1_Parser parser = &loader->parser;
|
||||
|
||||
|
@ -688,15 +688,15 @@
|
|||
|
||||
|
||||
static FT_Error
|
||||
t1_load_keyword( T1_Face face,
|
||||
T1_Loader* loader,
|
||||
T1_Field field )
|
||||
t1_load_keyword( T1_Face face,
|
||||
T1_Loader loader,
|
||||
T1_Field field )
|
||||
{
|
||||
FT_Error error;
|
||||
void* dummy_object;
|
||||
void** objects;
|
||||
FT_UInt max_objects;
|
||||
PS_Blend blend = face->blend;
|
||||
FT_Error error;
|
||||
void* dummy_object;
|
||||
void** objects;
|
||||
FT_UInt max_objects;
|
||||
PS_Blend blend = face->blend;
|
||||
|
||||
|
||||
/* if the keyword has a dedicated callback, call it */
|
||||
|
@ -767,7 +767,11 @@
|
|||
/* Note: we must accept "+" as a valid character, as it is used in */
|
||||
/* embedded type1 fonts in PDF documents. */
|
||||
/* */
|
||||
return ( ft_isalnum( c ) || c == '.' || c == '_' || c == '-' || c == '+' );
|
||||
return ( ft_isalnum( c ) ||
|
||||
c == '.' ||
|
||||
c == '_' ||
|
||||
c == '-' ||
|
||||
c == '+' );
|
||||
}
|
||||
|
||||
|
||||
|
@ -814,8 +818,8 @@
|
|||
/* dictionaries */
|
||||
|
||||
static void
|
||||
parse_font_name( T1_Face face,
|
||||
T1_Loader* loader )
|
||||
parse_font_name( T1_Face face,
|
||||
T1_Loader loader )
|
||||
{
|
||||
T1_Parser parser = &loader->parser;
|
||||
FT_Error error;
|
||||
|
@ -860,8 +864,8 @@
|
|||
|
||||
|
||||
static void
|
||||
parse_font_bbox( T1_Face face,
|
||||
T1_Loader* loader )
|
||||
parse_font_bbox( T1_Face face,
|
||||
T1_Loader loader )
|
||||
{
|
||||
T1_Parser parser = &loader->parser;
|
||||
FT_Fixed temp[4];
|
||||
|
@ -877,8 +881,8 @@
|
|||
|
||||
|
||||
static void
|
||||
parse_font_matrix( T1_Face face,
|
||||
T1_Loader* loader )
|
||||
parse_font_matrix( T1_Face face,
|
||||
T1_Loader loader )
|
||||
{
|
||||
T1_Parser parser = &loader->parser;
|
||||
FT_Matrix* matrix = &face->type1.font_matrix;
|
||||
|
@ -889,7 +893,7 @@
|
|||
|
||||
|
||||
if ( matrix->xx || matrix->yx )
|
||||
/* with synthetic fonts, it's possible we get here twice */
|
||||
/* with synthetic fonts, it's possible we get here twice */
|
||||
return;
|
||||
|
||||
(void)T1_ToFixedArray( parser, 6, temp, 3 );
|
||||
|
@ -926,8 +930,8 @@
|
|||
|
||||
|
||||
static void
|
||||
parse_encoding( T1_Face face,
|
||||
T1_Loader* loader )
|
||||
parse_encoding( T1_Face face,
|
||||
T1_Loader loader )
|
||||
{
|
||||
T1_Parser parser = &loader->parser;
|
||||
FT_Byte* cur = parser->root.cursor;
|
||||
|
@ -973,13 +977,13 @@
|
|||
if ( FT_NEW_ARRAY( encode->char_index, count ) ||
|
||||
FT_NEW_ARRAY( encode->char_name, count ) ||
|
||||
FT_SET_ERROR( psaux->ps_table_funcs->init(
|
||||
char_table, count, memory ) ) )
|
||||
char_table, count, memory ) ) )
|
||||
{
|
||||
parser->root.error = error;
|
||||
return;
|
||||
}
|
||||
|
||||
/* We need to `zero' out encoding_table.elements */
|
||||
/* We need to `zero' out encoding_table.elements */
|
||||
for ( n = 0; n < count; n++ )
|
||||
{
|
||||
char* notdef = (char *)".notdef";
|
||||
|
@ -1015,10 +1019,10 @@
|
|||
/* we stop when we encounter a `def' */
|
||||
if ( c == 'd' && cur + 3 < limit )
|
||||
{
|
||||
if ( cur[1] == 'e' &&
|
||||
cur[2] == 'f' &&
|
||||
is_space(cur[-1]) &&
|
||||
is_space(cur[3]) )
|
||||
if ( cur[1] == 'e' &&
|
||||
cur[2] == 'f' &&
|
||||
is_space( cur[-1] ) &&
|
||||
is_space( cur[3] ) )
|
||||
{
|
||||
FT_TRACE6(( "encoding end\n" ));
|
||||
break;
|
||||
|
@ -1033,7 +1037,7 @@
|
|||
|
||||
parser->root.cursor = cur;
|
||||
charcode = T1_ToInt( parser );
|
||||
cur = parser->root.cursor;
|
||||
cur = parser->root.cursor;
|
||||
|
||||
/* skip whitespace */
|
||||
while ( cur < limit && is_space( *cur ) )
|
||||
|
@ -1068,19 +1072,19 @@
|
|||
face->type1.encoding_type = T1_ENCODING_TYPE_ARRAY;
|
||||
parser->root.cursor = cur;
|
||||
}
|
||||
/* Otherwise, we should have either `StandardEncoding' or */
|
||||
/* `ExpertEncoding' */
|
||||
/* Otherwise, we should have either `StandardEncoding', */
|
||||
/* `ExpertEncoding', or `ISOLatin1Encoding' */
|
||||
else
|
||||
{
|
||||
if ( cur + 17 < limit &&
|
||||
if ( cur + 17 < limit &&
|
||||
ft_strncmp( (const char*)cur, "StandardEncoding", 16 ) == 0 )
|
||||
face->type1.encoding_type = T1_ENCODING_TYPE_STANDARD;
|
||||
|
||||
else if ( cur + 15 < limit &&
|
||||
else if ( cur + 15 < limit &&
|
||||
ft_strncmp( (const char*)cur, "ExpertEncoding", 14 ) == 0 )
|
||||
face->type1.encoding_type = T1_ENCODING_TYPE_EXPORT;
|
||||
face->type1.encoding_type = T1_ENCODING_TYPE_EXPERT;
|
||||
|
||||
else if ( cur + 18 < limit &&
|
||||
else if ( cur + 18 < limit &&
|
||||
ft_strncmp( (const char*)cur, "ISOLatin1Encoding", 17 ) == 0 )
|
||||
face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1;
|
||||
|
||||
|
@ -1094,8 +1098,8 @@
|
|||
|
||||
|
||||
static void
|
||||
parse_subrs( T1_Face face,
|
||||
T1_Loader* loader )
|
||||
parse_subrs( T1_Face face,
|
||||
T1_Loader loader )
|
||||
{
|
||||
T1_Parser parser = &loader->parser;
|
||||
PS_Table table = &loader->subrs;
|
||||
|
@ -1191,8 +1195,8 @@
|
|||
|
||||
|
||||
static void
|
||||
parse_charstrings( T1_Face face,
|
||||
T1_Loader* loader )
|
||||
parse_charstrings( T1_Face face,
|
||||
T1_Loader loader )
|
||||
{
|
||||
T1_Parser parser = &loader->parser;
|
||||
PS_Table code_table = &loader->charstrings;
|
||||
|
@ -1241,8 +1245,8 @@
|
|||
if ( error )
|
||||
goto Fail;
|
||||
|
||||
|
||||
n = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
FT_Int size;
|
||||
|
@ -1479,10 +1483,10 @@
|
|||
|
||||
|
||||
static FT_Error
|
||||
parse_dict( T1_Face face,
|
||||
T1_Loader* loader,
|
||||
FT_Byte* base,
|
||||
FT_Long size )
|
||||
parse_dict( T1_Face face,
|
||||
T1_Loader loader,
|
||||
FT_Byte* base,
|
||||
FT_Long size )
|
||||
{
|
||||
T1_Parser parser = &loader->parser;
|
||||
|
||||
|
@ -1499,7 +1503,7 @@
|
|||
for ( ; cur < limit; cur++ )
|
||||
{
|
||||
/* look for `FontDirectory', which causes problems on some fonts */
|
||||
if ( *cur == 'F' && cur + 25 < limit &&
|
||||
if ( *cur == 'F' && cur + 25 < limit &&
|
||||
ft_strncmp( (char*)cur, "FontDirectory", 13 ) == 0 )
|
||||
{
|
||||
FT_Byte* cur2;
|
||||
|
@ -1596,8 +1600,8 @@
|
|||
|
||||
|
||||
static void
|
||||
t1_init_loader( T1_Loader* loader,
|
||||
T1_Face face )
|
||||
t1_init_loader( T1_Loader loader,
|
||||
T1_Face face )
|
||||
{
|
||||
FT_UNUSED( face );
|
||||
|
||||
|
@ -1616,7 +1620,7 @@
|
|||
|
||||
|
||||
static void
|
||||
t1_done_loader( T1_Loader* loader )
|
||||
t1_done_loader( T1_Loader loader )
|
||||
{
|
||||
T1_Parser parser = &loader->parser;
|
||||
|
||||
|
@ -1636,7 +1640,7 @@
|
|||
FT_LOCAL_DEF( FT_Error )
|
||||
T1_Open_Face( T1_Face face )
|
||||
{
|
||||
T1_Loader loader;
|
||||
T1_LoaderRec loader;
|
||||
T1_Parser parser;
|
||||
T1_Font type1 = &face->type1;
|
||||
FT_Error error;
|
||||
|
@ -1701,8 +1705,7 @@
|
|||
loader.glyph_names.block = 0;
|
||||
loader.glyph_names.elements = 0;
|
||||
|
||||
/* we must now build type1.encoding when we have a custom */
|
||||
/* array.. */
|
||||
/* we must now build type1.encoding when we have a custom array */
|
||||
if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY )
|
||||
{
|
||||
FT_Int charcode, idx, min_char, max_char;
|
||||
|
@ -1740,8 +1743,8 @@
|
|||
if ( ft_strcmp( (const char*)".notdef",
|
||||
(const char*)glyph_name ) != 0 )
|
||||
{
|
||||
if (charcode < min_char) min_char = charcode;
|
||||
if (charcode > max_char) max_char = charcode;
|
||||
if ( charcode < min_char ) min_char = charcode;
|
||||
if ( charcode > max_char ) max_char = charcode;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ FT_BEGIN_HEADER
|
|||
PS_TableRec subrs;
|
||||
FT_Bool fontdata;
|
||||
|
||||
} T1_Loader;
|
||||
} T1_LoaderRec, *T1_Loader;
|
||||
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
|
|
|
@ -327,10 +327,9 @@
|
|||
|
||||
root->num_glyphs = face->type1.num_glyphs;
|
||||
root->face_index = face_index;
|
||||
|
||||
root->face_flags = FT_FACE_FLAG_SCALABLE;
|
||||
|
||||
root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
|
||||
|
||||
root->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
|
||||
|
||||
if ( face->type1.font_info.is_fixed_pitch )
|
||||
|
@ -432,28 +431,28 @@
|
|||
|
||||
{
|
||||
FT_Face root = &face->root;
|
||||
|
||||
|
||||
|
||||
if ( psnames && psaux )
|
||||
{
|
||||
FT_CharMapRec charmap;
|
||||
T1_CMap_Classes cmap_classes = psaux->t1_cmap_classes;
|
||||
FT_CMap_Class clazz;
|
||||
|
||||
|
||||
|
||||
charmap.face = root;
|
||||
|
||||
|
||||
/* first of all, try to synthetize a Unicode charmap */
|
||||
charmap.platform_id = 3;
|
||||
charmap.encoding_id = 1;
|
||||
charmap.encoding = ft_encoding_unicode;
|
||||
|
||||
|
||||
FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL );
|
||||
|
||||
|
||||
/* now, generate an Adobe Standard encoding when appropriate */
|
||||
charmap.platform_id = 7;
|
||||
clazz = NULL;
|
||||
|
||||
|
||||
switch ( face->type1.encoding_type )
|
||||
{
|
||||
case T1_ENCODING_TYPE_STANDARD:
|
||||
|
@ -461,29 +460,29 @@
|
|||
charmap.encoding_id = 0;
|
||||
clazz = cmap_classes->standard;
|
||||
break;
|
||||
|
||||
case T1_ENCODING_TYPE_EXPORT:
|
||||
|
||||
case T1_ENCODING_TYPE_EXPERT:
|
||||
charmap.encoding = ft_encoding_adobe_expert;
|
||||
charmap.encoding_id = 1;
|
||||
clazz = cmap_classes->expert;
|
||||
break;
|
||||
|
||||
|
||||
case T1_ENCODING_TYPE_ARRAY:
|
||||
charmap.encoding = ft_encoding_adobe_custom;
|
||||
charmap.encoding_id = 2;
|
||||
clazz = cmap_classes->custom;
|
||||
break;
|
||||
|
||||
|
||||
case T1_ENCODING_TYPE_ISOLATIN1:
|
||||
charmap.encoding = ft_encoding_latin_1;
|
||||
charmap.encoding_id = 3;
|
||||
clazz = cmap_classes->unicode;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
if ( clazz )
|
||||
FT_CMap_New( clazz, NULL, &charmap, NULL );
|
||||
}
|
||||
|
@ -535,7 +534,7 @@
|
|||
charmap->encoding_id = 0;
|
||||
break;
|
||||
|
||||
case T1_ENCODING_TYPE_EXPORT:
|
||||
case T1_ENCODING_TYPE_EXPERT:
|
||||
charmap->encoding = ft_encoding_adobe_expert;
|
||||
charmap->encoding_id = 1;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue