summaryrefslogtreecommitdiffstats
path: root/src/cff
diff options
context:
space:
mode:
authorOlivier Bailly <olivier@google.com>2011-11-07 15:47:04 -0800
committerGeremy Condra <gcondra@google.com>2011-11-11 10:43:54 -0800
commitbff90fb5ec88ad7fdfb6d1d2f5a5719c20a2c5dc (patch)
tree720489aa1d9176e568acf0f8cb441a3f8cb0663f /src/cff
parent50571ad2593c5b9c46fc93ea59bfd82a80c1b55c (diff)
downloadandroid_external_freetype-bff90fb5ec88ad7fdfb6d1d2f5a5719c20a2c5dc.tar.gz
android_external_freetype-bff90fb5ec88ad7fdfb6d1d2f5a5719c20a2c5dc.tar.bz2
android_external_freetype-bff90fb5ec88ad7fdfb6d1d2f5a5719c20a2c5dc.zip
DO NOT MERGE Update FreeType library to 2.4.7
Copied common files from upstream repository only. changes to ftoption.h which were intentionally NOT taken: /* contain no glyph data, but supply it via a callback function. */ /* This is required by clients supporting document formats which */ /* supply font data incrementally as the document is parsed, such */ /* as the Ghostscript interpreter for the PostScript language. */ /* */ -/* #define FT_CONFIG_OPTION_INCREMENTAL */ +#define FT_CONFIG_OPTION_INCREMENTAL /*************************************************************************/ /* */ /* The size in bytes of the render pool used by the scan-line converter */ @@ -553,11 +553,11 @@ FT_BEGIN_HEADER /* TrueType glyphs without hinting. */ /* */ /* Do not #undef this macro here, since the build system might */ /* define it for certain configurations only. */ /* */ -/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ +#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER /*************************************************************************/ /* */ /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ @@ -603,11 +603,11 @@ FT_BEGIN_HEADER /* */ /* error = FT_Open_Face( library, &open_args, index, &face ); */ /* ... */ /* } */ /* */ -#define TT_CONFIG_OPTION_UNPATENTED_HINTING +/* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */ /*************************************************************************/ /* */ /* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType */ Manual changes to ftmodule.h: +/* + * New modules in 2.4.7: +FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) +FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) +FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) +FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) +FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) +FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) +FT_USE_MODULE( FT_Module_Class, psaux_module_class ) +FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) + */ + These lines were added for 2.4.7 but we decided to stick with our current use. Change-Id: Ic1b52909580c78ead44cf4f882be06f2837539db
Diffstat (limited to 'src/cff')
-rw-r--r--src/cff/cffload.c11
-rw-r--r--src/cff/cffobjs.c68
-rw-r--r--src/cff/cffparse.c351
-rw-r--r--src/cff/cffparse.h6
-rw-r--r--src/cff/cfftoken.h114
-rw-r--r--src/cff/cfftypes.h1
6 files changed, 371 insertions, 180 deletions
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 629d38e..8bbf474 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -4,8 +4,7 @@
/* */
/* OpenType and CFF data/program tables loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
-/* 2010 by */
+/* Copyright 1996-2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -1269,7 +1268,7 @@
if ( gid != 0 )
{
encoding->codes[j] = (FT_UShort)gid;
- encoding->count = j + 1;
+ encoding->count = j + 1;
}
else
{
@@ -1337,7 +1336,10 @@
error = cff_index_access_element( idx, font_index, &dict, &dict_len );
if ( !error )
+ {
+ FT_TRACE4(( " top dictionary:\n" ));
error = cff_parser_run( &parser, dict, dict + dict_len );
+ }
cff_index_forget_element( idx, &dict );
@@ -1366,6 +1368,7 @@
FT_FRAME_ENTER( font->font_dict.private_size ) )
goto Exit;
+ FT_TRACE4(( " private dictionary:\n" ));
error = cff_parser_run( &parser,
(FT_Byte*)stream->cursor,
(FT_Byte*)stream->limit );
@@ -1494,6 +1497,7 @@
goto Exit;
/* now, parse the top-level font dictionary */
+ FT_TRACE4(( "parsing top-level\n" ));
error = cff_subfont_load( &font->top_font,
&font->font_dict_index,
face_index,
@@ -1546,6 +1550,7 @@
for ( idx = 0; idx < fd_index.count; idx++ )
{
sub = font->subfonts[idx];
+ FT_TRACE4(( "parsing subfont %u\n", idx ));
error = cff_subfont_load( sub, &fd_index, idx,
stream, base_offset, library );
if ( error )
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index cd38676..15707a2 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -607,7 +607,25 @@
goto Bad_Format;
}
- if ( !dict->units_per_em )
+#ifdef FT_DEBUG_LEVEL_TRACE
+ {
+ FT_UInt idx;
+ FT_String* s;
+
+
+ FT_TRACE4(( "SIDs\n" ));
+
+ /* dump string index, including default strings for convenience */
+ for ( idx = 0; idx < cff->num_strings + 390; idx++ )
+ {
+ s = cff_index_get_sid_string( cff, idx );
+ if ( s )
+ FT_TRACE4((" %5d %s\n", idx, s ));
+ }
+ }
+#endif /* FT_DEBUG_LEVEL_TRACE */
+
+ if ( !dict->has_font_matrix )
dict->units_per_em = pure_cff ? 1000 : face->root.units_per_EM;
/* Normalize the font matrix so that `matrix->xx' is 1; the */
@@ -652,26 +670,32 @@
FT_Fixed temp;
- if ( sub->units_per_em )
+ if ( sub->has_font_matrix )
{
FT_Long scaling;
- if ( top->units_per_em > 1 && sub->units_per_em > 1 )
- scaling = FT_MIN( top->units_per_em, sub->units_per_em );
- else
- scaling = 1;
-
- FT_Matrix_Multiply_Scaled( &top->font_matrix,
- &sub->font_matrix,
- scaling );
- FT_Vector_Transform_Scaled( &sub->font_offset,
- &top->font_matrix,
- scaling );
-
- sub->units_per_em = FT_MulDiv( sub->units_per_em,
- top->units_per_em,
- scaling );
+ /* if we have a top-level matrix, */
+ /* concatenate the subfont matrix */
+
+ if ( top->has_font_matrix )
+ {
+ if ( top->units_per_em > 1 && sub->units_per_em > 1 )
+ scaling = FT_MIN( top->units_per_em, sub->units_per_em );
+ else
+ scaling = 1;
+
+ FT_Matrix_Multiply_Scaled( &top->font_matrix,
+ &sub->font_matrix,
+ scaling );
+ FT_Vector_Transform_Scaled( &sub->font_offset,
+ &top->font_matrix,
+ scaling );
+
+ sub->units_per_em = FT_MulDiv( sub->units_per_em,
+ top->units_per_em,
+ scaling );
+ }
}
else
{
@@ -690,16 +714,6 @@
{
*upm = FT_DivFix( *upm, temp );
- /* if *upm is larger than 100*1000 we divide by 1000 -- */
- /* this can happen if e.g. there is no top-font FontMatrix */
- /* and the subfont FontMatrix already contains the complete */
- /* scaling for the subfont (see section 5.11 of the PLRM) */
-
- /* 100 is a heuristic value */
-
- if ( *upm > 100L * 1000L )
- *upm = ( *upm + 500 ) / 1000;
-
matrix->xx = FT_DivFix( matrix->xx, temp );
matrix->yx = FT_DivFix( matrix->yx, temp );
matrix->xy = FT_DivFix( matrix->xy, temp );
diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c
index b12a8d3..61fa87c 100644
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -460,6 +460,8 @@
error = CFF_Err_Ok;
+ dict->has_font_matrix = TRUE;
+
/* We expect a well-formed font matrix, this is, the matrix elements */
/* `xx' and `yy' are of approximately the same magnitude. To avoid */
/* loss of precision, we use the magnitude of element `xx' to scale */
@@ -498,11 +500,13 @@
*upm = power_tens[scaling];
- FT_TRACE4(( " font matrix: [%f %f %f %f]\n",
+ FT_TRACE4(( " [%f %f %f %f %f %f]\n",
(double)matrix->xx / *upm / 65536,
(double)matrix->xy / *upm / 65536,
(double)matrix->yx / *upm / 65536,
- (double)matrix->yy / *upm / 65536 ));
+ (double)matrix->yy / *upm / 65536,
+ (double)offset->x / *upm / 65536,
+ (double)offset->y / *upm / 65536 ));
}
Exit:
@@ -529,7 +533,7 @@
bbox->yMax = FT_RoundFix( cff_parse_fixed( data ) );
error = CFF_Err_Ok;
- FT_TRACE4(( " bbox: [%d %d %d %d]\n",
+ FT_TRACE4(( " [%d %d %d %d]\n",
bbox->xMin / 65536,
bbox->yMin / 65536,
bbox->xMax / 65536,
@@ -554,6 +558,9 @@
{
dict->private_size = cff_parse_num( data++ );
dict->private_offset = cff_parse_num( data );
+ FT_TRACE4(( " %lu %lu\n",
+ dict->private_size, dict->private_offset ));
+
error = CFF_Err_Ok;
}
@@ -573,8 +580,8 @@
if ( parser->top >= parser->stack + 3 )
{
- dict->cid_registry = (FT_UInt)cff_parse_num( data++ );
- dict->cid_ordering = (FT_UInt)cff_parse_num( data++ );
+ dict->cid_registry = (FT_UInt)cff_parse_num( data++ );
+ dict->cid_ordering = (FT_UInt)cff_parse_num( data++ );
if ( **data == 30 )
FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" ));
dict->cid_supplement = cff_parse_num( data );
@@ -583,7 +590,7 @@
dict->cid_supplement ));
error = CFF_Err_Ok;
- FT_TRACE4(( " ROS: registry sid %d, ordering sid %d, supplement %d\n",
+ FT_TRACE4(( " %d %d %d\n",
dict->cid_registry,
dict->cid_ordering,
dict->cid_supplement ));
@@ -593,54 +600,59 @@
}
-#define CFF_FIELD_NUM( code, name ) \
- CFF_FIELD( code, name, cff_kind_num )
-#define CFF_FIELD_FIXED( code, name ) \
- CFF_FIELD( code, name, cff_kind_fixed )
-#define CFF_FIELD_FIXED_1000( code, name ) \
- CFF_FIELD( code, name, cff_kind_fixed_thousand )
-#define CFF_FIELD_STRING( code, name ) \
- CFF_FIELD( code, name, cff_kind_string )
-#define CFF_FIELD_BOOL( code, name ) \
- CFF_FIELD( code, name, cff_kind_bool )
-#define CFF_FIELD_DELTA( code, name, max ) \
- CFF_FIELD( code, name, cff_kind_delta )
+#define CFF_FIELD_NUM( code, name, id ) \
+ CFF_FIELD( code, name, id, cff_kind_num )
+#define CFF_FIELD_FIXED( code, name, id ) \
+ CFF_FIELD( code, name, id, cff_kind_fixed )
+#define CFF_FIELD_FIXED_1000( code, name, id ) \
+ CFF_FIELD( code, name, id, cff_kind_fixed_thousand )
+#define CFF_FIELD_STRING( code, name, id ) \
+ CFF_FIELD( code, name, id, cff_kind_string )
+#define CFF_FIELD_BOOL( code, name, id ) \
+ CFF_FIELD( code, name, id, cff_kind_bool )
#define CFFCODE_TOPDICT 0x1000
#define CFFCODE_PRIVATE 0x2000
+
#ifndef FT_CONFIG_OPTION_PIC
-#define CFF_FIELD_CALLBACK( code, name ) \
- { \
- cff_kind_callback, \
- code | CFFCODE, \
- 0, 0, \
- cff_parse_ ## name, \
- 0, 0 \
- },
#undef CFF_FIELD
-#define CFF_FIELD( code, name, kind ) \
- { \
- kind, \
- code | CFFCODE, \
- FT_FIELD_OFFSET( name ), \
- FT_FIELD_SIZE( name ), \
- 0, 0, 0 \
+#undef CFF_FIELD_DELTA
+
+
+#ifndef FT_DEBUG_LEVEL_TRACE
+
+
+#define CFF_FIELD_CALLBACK( code, name, id ) \
+ { \
+ cff_kind_callback, \
+ code | CFFCODE, \
+ 0, 0, \
+ cff_parse_ ## name, \
+ 0, 0 \
},
-#undef CFF_FIELD_DELTA
-#define CFF_FIELD_DELTA( code, name, max ) \
- { \
- cff_kind_delta, \
- code | CFFCODE, \
- FT_FIELD_OFFSET( name ), \
- FT_FIELD_SIZE_DELTA( name ), \
- 0, \
- max, \
- FT_FIELD_OFFSET( num_ ## name ) \
- },
+#define CFF_FIELD( code, name, id, kind ) \
+ { \
+ kind, \
+ code | CFFCODE, \
+ FT_FIELD_OFFSET( name ), \
+ FT_FIELD_SIZE( name ), \
+ 0, 0, 0 \
+ },
+
+#define CFF_FIELD_DELTA( code, name, max, id ) \
+ { \
+ cff_kind_delta, \
+ code | CFFCODE, \
+ FT_FIELD_OFFSET( name ), \
+ FT_FIELD_SIZE_DELTA( name ), \
+ 0, \
+ max, \
+ FT_FIELD_OFFSET( num_ ## name ) \
+ },
static const CFF_Field_Handler cff_field_handlers[] =
{
@@ -651,83 +663,200 @@
};
+#else /* FT_DEBUG_LEVEL_TRACE */
+
+
+
+#define CFF_FIELD_CALLBACK( code, name, id ) \
+ { \
+ cff_kind_callback, \
+ code | CFFCODE, \
+ 0, 0, \
+ cff_parse_ ## name, \
+ 0, 0, \
+ id \
+ },
+
+#define CFF_FIELD( code, name, id, kind ) \
+ { \
+ kind, \
+ code | CFFCODE, \
+ FT_FIELD_OFFSET( name ), \
+ FT_FIELD_SIZE( name ), \
+ 0, 0, 0, \
+ id \
+ },
+
+#define CFF_FIELD_DELTA( code, name, max, id ) \
+ { \
+ cff_kind_delta, \
+ code | CFFCODE, \
+ FT_FIELD_OFFSET( name ), \
+ FT_FIELD_SIZE_DELTA( name ), \
+ 0, \
+ max, \
+ FT_FIELD_OFFSET( num_ ## name ), \
+ id \
+ },
+
+ static const CFF_Field_Handler cff_field_handlers[] =
+ {
+
+#include "cfftoken.h"
+
+ { 0, 0, 0, 0, 0, 0, 0, 0 }
+ };
+
+
+#endif /* FT_DEBUG_LEVEL_TRACE */
+
+
#else /* FT_CONFIG_OPTION_PIC */
- void FT_Destroy_Class_cff_field_handlers(FT_Library library, CFF_Field_Handler* clazz)
+
+ void
+ FT_Destroy_Class_cff_field_handlers( FT_Library library,
+ CFF_Field_Handler* clazz )
{
- FT_Memory memory = library->memory;
+ FT_Memory memory = library->memory;
+
+
if ( clazz )
FT_FREE( clazz );
}
- FT_Error FT_Create_Class_cff_field_handlers(FT_Library library, CFF_Field_Handler** output_class)
+
+ FT_Error
+ FT_Create_Class_cff_field_handlers( FT_Library library,
+ CFF_Field_Handler** output_class )
{
CFF_Field_Handler* clazz;
- FT_Error error;
- FT_Memory memory = library->memory;
- int i=0;
+ FT_Error error;
+ FT_Memory memory = library->memory;
+
+ int i = 0;
+
#undef CFF_FIELD
+#define CFF_FIELD( code, name, id, kind ) i++;
#undef CFF_FIELD_DELTA
+#define CFF_FIELD_DELTA( code, name, max, id ) i++;
#undef CFF_FIELD_CALLBACK
-#define CFF_FIELD_CALLBACK( code, name ) i++;
-#define CFF_FIELD( code, name, kind ) i++;
-#define CFF_FIELD_DELTA( code, name, max ) i++;
+#define CFF_FIELD_CALLBACK( code, name, id ) i++;
#include "cfftoken.h"
- i++;/*{ 0, 0, 0, 0, 0, 0, 0 }*/
- if ( FT_ALLOC( clazz, sizeof(CFF_Field_Handler)*i ) )
+ i++; /* { 0, 0, 0, 0, 0, 0, 0 } */
+
+ if ( FT_ALLOC( clazz, sizeof ( CFF_Field_Handler ) * i ) )
return error;
- i=0;
-#undef CFF_FIELD
-#undef CFF_FIELD_DELTA
+ i = 0;
+
+
+#ifndef FT_DEBUG_LEVEL_TRACE
+
+
#undef CFF_FIELD_CALLBACK
+#define CFF_FIELD_CALLBACK( code_, name_, id_ ) \
+ clazz[i].kind = cff_kind_callback; \
+ clazz[i].code = code_ | CFFCODE; \
+ clazz[i].offset = 0; \
+ clazz[i].size = 0; \
+ clazz[i].reader = cff_parse_ ## name_; \
+ clazz[i].array_max = 0; \
+ clazz[i].count_offset = 0; \
+ i++;
+
+#undef CFF_FIELD
+#define CFF_FIELD( code_, name_, id_, kind_ ) \
+ clazz[i].kind = kind_; \
+ clazz[i].code = code_ | CFFCODE; \
+ clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
+ clazz[i].size = FT_FIELD_SIZE( name_ ); \
+ clazz[i].reader = 0; \
+ clazz[i].array_max = 0; \
+ clazz[i].count_offset = 0; \
+ i++; \
+
+#undef CFF_FIELD_DELTA
+#define CFF_FIELD_DELTA( code_, name_, max_, id_ ) \
+ clazz[i].kind = cff_kind_delta; \
+ clazz[i].code = code_ | CFFCODE; \
+ clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
+ clazz[i].size = FT_FIELD_SIZE_DELTA( name_ ); \
+ clazz[i].reader = 0; \
+ clazz[i].array_max = max_; \
+ clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ ); \
+ i++;
-#define CFF_FIELD_CALLBACK( code_, name_ ) \
- clazz[i].kind = cff_kind_callback; \
- clazz[i].code = code_ | CFFCODE; \
- clazz[i].offset = 0; \
- clazz[i].size = 0; \
- clazz[i].reader = cff_parse_ ## name_; \
- clazz[i].array_max = 0; \
- clazz[i].count_offset = 0; \
- i++;
+#include "cfftoken.h"
+
+ clazz[i].kind = 0;
+ clazz[i].code = 0;
+ clazz[i].offset = 0;
+ clazz[i].size = 0;
+ clazz[i].reader = 0;
+ clazz[i].array_max = 0;
+ clazz[i].count_offset = 0;
+
+
+#else /* FT_DEBUG_LEVEL_TRACE */
+
+
+#undef CFF_FIELD_CALLBACK
+#define CFF_FIELD_CALLBACK( code_, name_, id_ ) \
+ clazz[i].kind = cff_kind_callback; \
+ clazz[i].code = code_ | CFFCODE; \
+ clazz[i].offset = 0; \
+ clazz[i].size = 0; \
+ clazz[i].reader = cff_parse_ ## name_; \
+ clazz[i].array_max = 0; \
+ clazz[i].count_offset = 0; \
+ clazz[i].id = id_; \
+ i++;
#undef CFF_FIELD
-#define CFF_FIELD( code_, name_, kind_ ) \
- clazz[i].kind = kind_; \
- clazz[i].code = code_ | CFFCODE; \
- clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
- clazz[i].size = FT_FIELD_SIZE( name_ ); \
- clazz[i].reader = 0; \
- clazz[i].array_max = 0; \
- clazz[i].count_offset = 0; \
- i++; \
+#define CFF_FIELD( code_, name_, id_, kind_ ) \
+ clazz[i].kind = kind_; \
+ clazz[i].code = code_ | CFFCODE; \
+ clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
+ clazz[i].size = FT_FIELD_SIZE( name_ ); \
+ clazz[i].reader = 0; \
+ clazz[i].array_max = 0; \
+ clazz[i].count_offset = 0; \
+ clazz[i].id = id_; \
+ i++; \
#undef CFF_FIELD_DELTA
-#define CFF_FIELD_DELTA( code_, name_, max_ ) \
- clazz[i].kind = cff_kind_delta; \
- clazz[i].code = code_ | CFFCODE; \
- clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
- clazz[i].size = FT_FIELD_SIZE_DELTA( name_ ); \
- clazz[i].reader = 0; \
- clazz[i].array_max = max_; \
- clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ ); \
- i++;
+#define CFF_FIELD_DELTA( code_, name_, max_, id_ ) \
+ clazz[i].kind = cff_kind_delta; \
+ clazz[i].code = code_ | CFFCODE; \
+ clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
+ clazz[i].size = FT_FIELD_SIZE_DELTA( name_ ); \
+ clazz[i].reader = 0; \
+ clazz[i].array_max = max_; \
+ clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ ); \
+ clazz[i].id = id_; \
+ i++;
#include "cfftoken.h"
- clazz[i].kind = 0;
- clazz[i].code = 0;
- clazz[i].offset = 0;
- clazz[i].size = 0;
- clazz[i].reader = 0;
- clazz[i].array_max = 0;
+ clazz[i].kind = 0;
+ clazz[i].code = 0;
+ clazz[i].offset = 0;
+ clazz[i].size = 0;
+ clazz[i].reader = 0;
+ clazz[i].array_max = 0;
clazz[i].count_offset = 0;
+ clazz[i].id = 0;
+
+
+#endif /* FT_DEBUG_LEVEL_TRACE */
+
*output_class = clazz;
+
return CFF_Err_Ok;
}
@@ -743,7 +872,7 @@
FT_Byte* p = start;
FT_Error error = CFF_Err_Ok;
FT_Library library = parser->library;
- FT_UNUSED(library);
+ FT_UNUSED( library );
parser->top = parser->stack;
@@ -824,6 +953,10 @@
FT_Byte* q = (FT_Byte*)parser->object + field->offset;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_TRACE4(( " %s", field->id ));
+#endif
+
/* check that we have enough arguments -- except for */
/* delta encoded arrays, which can be empty */
if ( field->kind != cff_kind_delta && num_args < 1 )
@@ -862,6 +995,34 @@
default: /* for 64-bit systems */
*(FT_Long*)q = val;
}
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ switch ( field->kind )
+ {
+ case cff_kind_bool:
+ FT_TRACE4(( " %s\n", val ? "true" : "false" ));
+ break;
+
+ case cff_kind_string:
+ FT_TRACE4(( " %ld (SID)\n", val ));
+ break;
+
+ case cff_kind_num:
+ FT_TRACE4(( " %ld\n", val ));
+ break;
+
+ case cff_kind_fixed:
+ FT_TRACE4(( " %f\n", (double)val / 65536 ));
+ break;
+
+ case cff_kind_fixed_thousand:
+ FT_TRACE4(( " %f\n", (double)val / 65536 / 1000 ));
+
+ default:
+ ; /* never reached */
+ }
+#endif
+
break;
case cff_kind_delta:
@@ -875,6 +1036,8 @@
if ( num_args > field->array_max )
num_args = field->array_max;
+ FT_TRACE4(( " [" ));
+
/* store count */
*qcount = (FT_Byte)num_args;
@@ -900,9 +1063,13 @@
*(FT_Long*)q = val;
}
+ FT_TRACE4(( " %ld", val ));
+
q += field->size;
num_args--;
}
+
+ FT_TRACE4(( "]\n" ));
}
break;
diff --git a/src/cff/cffparse.h b/src/cff/cffparse.h
index 7e2c00a..61d91ed 100644
--- a/src/cff/cffparse.h
+++ b/src/cff/cffparse.h
@@ -4,7 +4,7 @@
/* */
/* CFF token stream parser (specification) */
/* */
-/* Copyright 1996-2001, 2002, 2003 by */
+/* Copyright 1996-2003, 2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -90,6 +90,10 @@ FT_BEGIN_HEADER
FT_UInt array_max;
FT_UInt count_offset;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ const char* id;
+#endif
+
} CFF_Field_Handler;
diff --git a/src/cff/cfftoken.h b/src/cff/cfftoken.h
index 6bb27d5..bcb4276 100644
--- a/src/cff/cfftoken.h
+++ b/src/cff/cfftoken.h
@@ -4,7 +4,7 @@
/* */
/* CFF token definitions (specification only). */
/* */
-/* Copyright 1996-2001, 2002, 2003 by */
+/* Copyright 1996-2003, 2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,48 +22,48 @@
#undef CFFCODE
#define CFFCODE CFFCODE_TOPDICT
- CFF_FIELD_STRING ( 0, version )
- CFF_FIELD_STRING ( 1, notice )
- CFF_FIELD_STRING ( 0x100, copyright )
- CFF_FIELD_STRING ( 2, full_name )
- CFF_FIELD_STRING ( 3, family_name )
- CFF_FIELD_STRING ( 4, weight )
- CFF_FIELD_BOOL ( 0x101, is_fixed_pitch )
- CFF_FIELD_FIXED ( 0x102, italic_angle )
- CFF_FIELD_FIXED ( 0x103, underline_position )
- CFF_FIELD_FIXED ( 0x104, underline_thickness )
- CFF_FIELD_NUM ( 0x105, paint_type )
- CFF_FIELD_NUM ( 0x106, charstring_type )
- CFF_FIELD_CALLBACK( 0x107, font_matrix )
- CFF_FIELD_NUM ( 13, unique_id )
- CFF_FIELD_CALLBACK( 5, font_bbox )
- CFF_FIELD_NUM ( 0x108, stroke_width )
- CFF_FIELD_NUM ( 15, charset_offset )
- CFF_FIELD_NUM ( 16, encoding_offset )
- CFF_FIELD_NUM ( 17, charstrings_offset )
- CFF_FIELD_CALLBACK( 18, private_dict )
- CFF_FIELD_NUM ( 0x114, synthetic_base )
- CFF_FIELD_STRING ( 0x115, embedded_postscript )
+ CFF_FIELD_STRING ( 0, version, "Version" )
+ CFF_FIELD_STRING ( 1, notice, "Notice" )
+ CFF_FIELD_STRING ( 0x100, copyright, "Copyright" )
+ CFF_FIELD_STRING ( 2, full_name, "FullName" )
+ CFF_FIELD_STRING ( 3, family_name, "FamilyName" )
+ CFF_FIELD_STRING ( 4, weight, "Weight" )
+ CFF_FIELD_BOOL ( 0x101, is_fixed_pitch, "isFixedPitch" )
+ CFF_FIELD_FIXED ( 0x102, italic_angle, "ItalicAngle" )
+ CFF_FIELD_FIXED ( 0x103, underline_position, "UnderlinePosition" )
+ CFF_FIELD_FIXED ( 0x104, underline_thickness, "UnderlineThickness" )
+ CFF_FIELD_NUM ( 0x105, paint_type, "PaintType" )
+ CFF_FIELD_NUM ( 0x106, charstring_type, "CharstringType" )
+ CFF_FIELD_CALLBACK( 0x107, font_matrix, "FontMatrix" )
+ CFF_FIELD_NUM ( 13, unique_id, "UniqueID" )
+ CFF_FIELD_CALLBACK( 5, font_bbox, "FontBBox" )
+ CFF_FIELD_NUM ( 0x108, stroke_width, "StrokeWidth" )
+ CFF_FIELD_NUM ( 15, charset_offset, "charset" )
+ CFF_FIELD_NUM ( 16, encoding_offset, "Encoding" )
+ CFF_FIELD_NUM ( 17, charstrings_offset, "CharStrings" )
+ CFF_FIELD_CALLBACK( 18, private_dict, "Private" )
+ CFF_FIELD_NUM ( 0x114, synthetic_base, "SyntheticBase" )
+ CFF_FIELD_STRING ( 0x115, embedded_postscript, "PostScript" )
#if 0
- CFF_FIELD_STRING ( 0x116, base_font_name )
- CFF_FIELD_DELTA ( 0x117, base_font_blend, 16 )
- CFF_FIELD_CALLBACK( 0x118, multiple_master )
- CFF_FIELD_CALLBACK( 0x119, blend_axis_types )
+ CFF_FIELD_STRING ( 0x116, base_font_name, "BaseFontName" )
+ CFF_FIELD_DELTA ( 0x117, base_font_blend, 16, "BaseFontBlend" )
+ CFF_FIELD_CALLBACK( 0x118, multiple_master, "MultipleMaster" )
+ CFF_FIELD_CALLBACK( 0x119, blend_axis_types, "BlendAxisTypes" )
#endif
- CFF_FIELD_CALLBACK( 0x11E, cid_ros )
- CFF_FIELD_NUM ( 0x11F, cid_font_version )
- CFF_FIELD_NUM ( 0x120, cid_font_revision )
- CFF_FIELD_NUM ( 0x121, cid_font_type )
- CFF_FIELD_NUM ( 0x122, cid_count )
- CFF_FIELD_NUM ( 0x123, cid_uid_base )
- CFF_FIELD_NUM ( 0x124, cid_fd_array_offset )
- CFF_FIELD_NUM ( 0x125, cid_fd_select_offset )
- CFF_FIELD_STRING ( 0x126, cid_font_name )
+ CFF_FIELD_CALLBACK( 0x11E, cid_ros, "ROS" )
+ CFF_FIELD_NUM ( 0x11F, cid_font_version, "CIDFontVersion" )
+ CFF_FIELD_NUM ( 0x120, cid_font_revision, "CIDFontRevision" )
+ CFF_FIELD_NUM ( 0x121, cid_font_type, "CIDFontType" )
+ CFF_FIELD_NUM ( 0x122, cid_count, "CIDCount" )
+ CFF_FIELD_NUM ( 0x123, cid_uid_base, "UIDBase" )
+ CFF_FIELD_NUM ( 0x124, cid_fd_array_offset, "FDArray" )
+ CFF_FIELD_NUM ( 0x125, cid_fd_select_offset, "FDSelect" )
+ CFF_FIELD_STRING ( 0x126, cid_font_name, "FontName" )
#if 0
- CFF_FIELD_NUM ( 0x127, chameleon )
+ CFF_FIELD_NUM ( 0x127, chameleon, "Chameleon" )
#endif
@@ -72,26 +72,26 @@
#undef CFFCODE
#define CFFCODE CFFCODE_PRIVATE
- CFF_FIELD_DELTA ( 6, blue_values, 14 )
- CFF_FIELD_DELTA ( 7, other_blues, 10 )
- CFF_FIELD_DELTA ( 8, family_blues, 14 )
- CFF_FIELD_DELTA ( 9, family_other_blues, 10 )
- CFF_FIELD_FIXED_1000( 0x109, blue_scale )
- CFF_FIELD_NUM ( 0x10A, blue_shift )
- CFF_FIELD_NUM ( 0x10B, blue_fuzz )
- CFF_FIELD_NUM ( 10, standard_width )
- CFF_FIELD_NUM ( 11, standard_height )
- CFF_FIELD_DELTA ( 0x10C, snap_widths, 13 )
- CFF_FIELD_DELTA ( 0x10D, snap_heights, 13 )
- CFF_FIELD_BOOL ( 0x10E, force_bold )
- CFF_FIELD_FIXED ( 0x10F, force_bold_threshold )
- CFF_FIELD_NUM ( 0x110, lenIV )
- CFF_FIELD_NUM ( 0x111, language_group )
- CFF_FIELD_FIXED ( 0x112, expansion_factor )
- CFF_FIELD_NUM ( 0x113, initial_random_seed )
- CFF_FIELD_NUM ( 19, local_subrs_offset )
- CFF_FIELD_NUM ( 20, default_width )
- CFF_FIELD_NUM ( 21, nominal_width )
+ CFF_FIELD_DELTA ( 6, blue_values, 14, "BlueValues" )
+ CFF_FIELD_DELTA ( 7, other_blues, 10, "OtherBlues" )
+ CFF_FIELD_DELTA ( 8, family_blues, 14, "FamilyBlues" )
+ CFF_FIELD_DELTA ( 9, family_other_blues, 10, "FamilyOtherBlues" )
+ CFF_FIELD_FIXED_1000( 0x109, blue_scale, "BlueScale" )
+ CFF_FIELD_NUM ( 0x10A, blue_shift, "BlueShift" )
+ CFF_FIELD_NUM ( 0x10B, blue_fuzz, "BlueFuzz" )
+ CFF_FIELD_NUM ( 10, standard_width, "StdHW" )
+ CFF_FIELD_NUM ( 11, standard_height, "StdVW" )
+ CFF_FIELD_DELTA ( 0x10C, snap_widths, 13, "StemSnapH" )
+ CFF_FIELD_DELTA ( 0x10D, snap_heights, 13, "StemSnapV" )
+ CFF_FIELD_BOOL ( 0x10E, force_bold, "ForceBold" )
+ CFF_FIELD_FIXED ( 0x10F, force_bold_threshold, "ForceBoldThreshold" )
+ CFF_FIELD_NUM ( 0x110, lenIV, "lenIV" )
+ CFF_FIELD_NUM ( 0x111, language_group, "LanguageGroup" )
+ CFF_FIELD_FIXED ( 0x112, expansion_factor, "ExpansionFactor" )
+ CFF_FIELD_NUM ( 0x113, initial_random_seed, "initialRandomSeed" )
+ CFF_FIELD_NUM ( 19, local_subrs_offset, "Subrs" )
+ CFF_FIELD_NUM ( 20, default_width, "defaultWidthX" )
+ CFF_FIELD_NUM ( 21, nominal_width, "nominalWidthX" )
/* END */
diff --git a/src/cff/cfftypes.h b/src/cff/cfftypes.h
index 665ab6f..cae3689 100644
--- a/src/cff/cfftypes.h
+++ b/src/cff/cfftypes.h
@@ -117,6 +117,7 @@ FT_BEGIN_HEADER
FT_Int paint_type;
FT_Int charstring_type;
FT_Matrix font_matrix;
+ FT_Bool has_font_matrix;
FT_ULong units_per_em; /* temporarily used as scaling value also */
FT_Vector font_offset;
FT_ULong unique_id;