Index: src/sfnt/ttload.c |
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c |
index 5fb9aea4e5bb21faa6b9838ffd80e76a77744066..fbe70f7974a47141874a5d2f9cd851631b015a14 100644 |
--- a/src/sfnt/ttload.c |
+++ b/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, 2013 by */ |
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
/* */ |
/* This file is part of the FreeType project, and may only be used, */ |
@@ -143,7 +142,7 @@ |
goto Exit; |
} |
else |
- error = SFNT_Err_Table_Missing; |
+ error = FT_THROW( Table_Missing ); |
Exit: |
return error; |
@@ -238,7 +237,7 @@ |
if ( table.Length < 0x36 ) |
{ |
FT_TRACE2(( "check_table_dir: `head' table too small\n" )); |
- error = SFNT_Err_Table_Missing; |
+ error = FT_THROW( Table_Missing ); |
goto Exit; |
} |
@@ -250,7 +249,7 @@ |
{ |
FT_TRACE2(( "check_table_dir:" |
" no magic number found in `head' table\n")); |
- error = SFNT_Err_Table_Missing; |
+ error = FT_THROW( Table_Missing ); |
goto Exit; |
} |
@@ -268,14 +267,14 @@ |
if ( sfnt->num_tables == 0 ) |
{ |
FT_TRACE2(( "check_table_dir: no tables found\n" )); |
- error = SFNT_Err_Unknown_File_Format; |
+ error = FT_THROW( Unknown_File_Format ); |
goto Exit; |
} |
/* if `sing' and `meta' tables are present, there is no `head' table */ |
if ( has_head || ( has_sing && has_meta ) ) |
{ |
- error = SFNT_Err_Ok; |
+ error = FT_Err_Ok; |
goto Exit; |
} |
else |
@@ -286,7 +285,7 @@ |
#else |
FT_TRACE2(( " neither `head' nor `sing' table found\n" )); |
#endif |
- error = SFNT_Err_Table_Missing; |
+ error = FT_THROW( Table_Missing ); |
} |
Exit: |
@@ -354,7 +353,7 @@ |
#if 0 |
if ( sfnt.search_range != 1 << ( sfnt.entry_selector + 4 ) || |
sfnt.search_range + sfnt.range_shift != sfnt.num_tables << 4 ) |
- return SFNT_Err_Unknown_File_Format; |
+ return FT_THROW( Unknown_File_Format ); |
#endif |
/* load the table directory */ |
@@ -362,14 +361,17 @@ |
FT_TRACE2(( "-- Number of tables: %10u\n", sfnt.num_tables )); |
FT_TRACE2(( "-- Format version: 0x%08lx\n", sfnt.format_tag )); |
- /* check first */ |
- error = check_table_dir( &sfnt, stream ); |
- if ( error ) |
+ if ( sfnt.format_tag != TTAG_OTTO ) |
{ |
- FT_TRACE2(( "tt_face_load_font_dir:" |
- " invalid table directory for TrueType\n" )); |
+ /* check first */ |
+ error = check_table_dir( &sfnt, stream ); |
+ if ( error ) |
+ { |
+ FT_TRACE2(( "tt_face_load_font_dir:" |
+ " invalid table directory for TrueType\n" )); |
- goto Exit; |
+ goto Exit; |
+ } |
} |
face->num_tables = sfnt.num_tables; |
@@ -480,7 +482,7 @@ |
table = tt_face_lookup_table( face, tag ); |
if ( !table ) |
{ |
- error = SFNT_Err_Table_Missing; |
+ error = FT_THROW( Table_Missing ); |
goto Exit; |
} |
@@ -495,7 +497,7 @@ |
{ |
*length = size; |
- return SFNT_Err_Ok; |
+ return FT_Err_Ok; |
} |
if ( length ) |
@@ -624,7 +626,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 +637,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 +723,7 @@ |
/*************************************************************************/ |
/* */ |
/* <Function> */ |
- /* tt_face_load_names */ |
+ /* tt_face_load_name */ |
/* */ |
/* <Description> */ |
/* Loads the name records. */ |
@@ -799,7 +801,7 @@ |
if ( storage_start > storage_limit ) |
{ |
FT_ERROR(( "tt_face_load_name: invalid `name' table\n" )); |
- error = SFNT_Err_Name_Table_Missing; |
+ error = FT_THROW( Name_Table_Missing ); |
goto Exit; |
} |
@@ -952,7 +954,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 +1006,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 +1014,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 ), |
@@ -1125,7 +1127,7 @@ |
FT_TRACE3(( "isFixedPitch: %s\n", post->isFixedPitch |
? " yes" : " no" )); |
- return SFNT_Err_Ok; |
+ return FT_Err_Ok; |
} |
@@ -1233,18 +1235,18 @@ |
if ( face->gasp.version >= 2 ) |
{ |
face->gasp.numRanges = 0; |
- error = SFNT_Err_Invalid_Table; |
+ error = FT_THROW( Invalid_Table ); |
goto Exit; |
} |
num_ranges = face->gasp.numRanges; |
FT_TRACE3(( "numRanges: %u\n", num_ranges )); |
- if ( FT_QNEW_ARRAY( gaspranges, num_ranges ) || |
- FT_FRAME_ENTER( num_ranges * 4L ) ) |
+ if ( FT_QNEW_ARRAY( face->gasp.gaspRanges, num_ranges ) || |
+ FT_FRAME_ENTER( num_ranges * 4L ) ) |
goto Exit; |
- face->gasp.gaspRanges = gaspranges; |
+ gaspranges = face->gasp.gaspRanges; |
for ( j = 0; j < num_ranges; j++ ) |
{ |