37#define FT_COMPONENT cffparse
61 parser->num_designs = num_designs;
62 parser->num_axes = num_axes;
71 parser->stackSize = stackSize;
79#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
85 CFF_T2_String t2 = (CFF_T2_String)
data;
104#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
120#ifndef CFF_CONFIG_OPTION_OLD_ENGINE
135 last < parser->
limit )
142 CFF_T2_String t2 = (CFF_T2_String)
node->
data;
152 return FT_THROW( Invalid_Argument );
194 val = (
v - 247 ) * 256 +
p[0] + 108;
201 val = -(
v - 251 ) * 256 -
p[0] - 108;
257 FT_Int sign = 0, exponent_sign = 0, have_overflow = 0;
258 FT_Long exponent_add, integer_length, fraction_length;
290 nib = (
FT_Int)(
p[0] >> phase ) & 0xF;
300 if (
number >= 0xCCCCCCCL )
327 nib = (
p[0] >> phase ) & 0xF;
336 else if (
number < 0xCCCCCCCL && fraction_length < 9 )
366 nib = (
p[0] >> phase ) & 0xF;
394 exponent += power_ten + exponent_add;
399 fraction_length += integer_length;
402 if ( fraction_length <= 5 )
407 *scaling =
exponent - fraction_length + 1;
418 shift = new_fraction_length - fraction_length;
459 if ( integer_length > 5 )
461 if ( integer_length < -5 )
465 if ( integer_length < 0 )
468 fraction_length += integer_length;
472 if ( fraction_length == 10 )
475 fraction_length -= 1;
479 if ( fraction_length > 0 )
531 else if ( **
d == 255 )
541 ( ( ( (FT_UInt32)*(
d[0] + 1 ) << 24 ) |
542 ( (FT_UInt32)*(
d[0] + 2 ) << 16 ) |
543 ( (FT_UInt32)*(
d[0] + 3 ) << 8 ) |
544 (FT_UInt32)*(
d[0] + 4 ) ) + 0x8000U ) >> 16 );
547 ( ( ( (FT_UInt32)*(
d[0] + 1 ) << 16 ) |
548 ( (FT_UInt32)*(
d[0] + 2 ) << 8 ) |
549 (FT_UInt32)*(
d[0] + 3 ) ) + 0x80U ) >> 8 );
575 val =
val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFL;
587 else if (
val < -0x7FFF )
644 for ( integer_length = 5; integer_length < 10; integer_length++ )
650 *scaling = integer_length - 4;
655 *scaling = integer_length - 5;
683 FT_Long min_scaling, max_scaling;
698 for (
i = 0;
i < 6;
i++ )
703 if ( scalings[
i] > max_scaling )
704 max_scaling = scalings[
i];
705 if ( scalings[
i] < min_scaling )
706 min_scaling = scalings[
i];
710 if ( max_scaling < -9 ||
712 ( max_scaling - min_scaling ) < 0 ||
713 ( max_scaling - min_scaling ) > 9 )
716 " strange scaling values (minimum %ld, maximum %ld),\n"
718 " using default matrix\n", min_scaling, max_scaling ));
722 for (
i = 0;
i < 6;
i++ )
760 (
double)
matrix->xx / *upm / 65536,
761 (
double)
matrix->xy / *upm / 65536,
762 (
double)
matrix->yx / *upm / 65536,
763 (
double)
matrix->yy / *upm / 65536,
764 (
double)
offset->x / *upm / 65536,
765 (
double)
offset->y / *upm / 65536 ));
770 " degenerate values, using default matrix\n" ));
842 FT_ERROR((
"cff_parse_private_dict: Invalid dictionary size\n" ));
851 FT_ERROR((
"cff_parse_private_dict: Invalid dictionary offset\n" ));
878#ifdef FT_DEBUG_LEVEL_TRACE
881 FT_TRACE1((
"Multiple Master CFFs not supported yet,"
882 " handling first master design only\n" ));
885 " handling first master design only)\n" ));
896 if ( num_designs > 16 || num_designs < 2 )
898 FT_ERROR((
"cff_parse_multiple_master:"
899 " Invalid number of designs\n" ));
933 FT_TRACE1((
"cff_parse_cid_ros: real supplement is rounded\n" ));
936 FT_TRACE1((
"cff_parse_cid_ros: negative supplement %ld is found\n",
970 FT_ERROR((
" cff_parse_vsindex: vsindex not allowed after blend\n" ));
1004 blend = &subFont->
blend;
1020 if ( numBlends >
parser->stackSize )
1022 FT_ERROR((
"cff_parse_blend: Invalid number of blends\n" ));
1029 numBlends == 1 ?
"" :
"s" ));
1033 blend->usedBV =
TRUE;
1069#define CFF_FIELD_NUM( code, name, id ) \
1070 CFF_FIELD( code, name, id, cff_kind_num )
1071#define CFF_FIELD_FIXED( code, name, id ) \
1072 CFF_FIELD( code, name, id, cff_kind_fixed )
1073#define CFF_FIELD_FIXED_1000( code, name, id ) \
1074 CFF_FIELD( code, name, id, cff_kind_fixed_thousand )
1075#define CFF_FIELD_STRING( code, name, id ) \
1076 CFF_FIELD( code, name, id, cff_kind_string )
1077#define CFF_FIELD_BOOL( code, name, id ) \
1078 CFF_FIELD( code, name, id, cff_kind_bool )
1082#undef CFF_FIELD_DELTA
1085#ifndef FT_DEBUG_LEVEL_TRACE
1088#define CFF_FIELD_CALLBACK( code, name, id ) \
1090 cff_kind_callback, \
1093 cff_parse_ ## name, \
1097#define CFF_FIELD_BLEND( code, id ) \
1106#define CFF_FIELD( code, name, id, kind ) \
1110 FT_FIELD_OFFSET( name ), \
1111 FT_FIELD_SIZE( name ), \
1115#define CFF_FIELD_DELTA( code, name, max, id ) \
1119 FT_FIELD_OFFSET( name ), \
1120 FT_FIELD_SIZE_DELTA( name ), \
1123 FT_FIELD_OFFSET( num_ ## name ) \
1131 { 0, 0, 0, 0, 0, 0, 0 }
1139#define CFF_FIELD_CALLBACK( code, name, id ) \
1141 cff_kind_callback, \
1144 cff_parse_ ## name, \
1149#define CFF_FIELD_BLEND( code, id ) \
1159#define CFF_FIELD( code, name, id, kind ) \
1163 FT_FIELD_OFFSET( name ), \
1164 FT_FIELD_SIZE( name ), \
1169#define CFF_FIELD_DELTA( code, name, max, id ) \
1173 FT_FIELD_OFFSET( name ), \
1174 FT_FIELD_SIZE_DELTA( name ), \
1177 FT_FIELD_OFFSET( num_ ## name ), \
1186 { 0, 0, 0, 0, 0, 0, 0, 0 }
1201#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
1221 if (
v >= 27 &&
v != 31 &&
v != 255 )
1225 goto Stack_Overflow;
1256#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
1273 charstring_base = ++
p;
1285 charstring_len = (
FT_ULong)(
p - charstring_base ) + 1;
1298 FT_ERROR((
"cff_parser_run: cannot access `psaux' module\n" ));
1304 &
decoder, charstring_base, charstring_len, 1 );
1315 goto Out_Of_Memory_Error;
1320 sizeof ( CFF_T2_StringRec ) );
1322 goto Out_Of_Memory_Error;
1333 goto Out_Of_Memory_Error;
1336 t2->limit =
q + t2_size;
1347 goto Stack_Overflow;
1362 if (
num & 0xFFFFU )
1368 *
q++ = (
num & 0xFF000000U ) >> 24;
1369 *
q++ = (
num & 0x00FF0000U ) >> 16;
1370 *
q++ = (
num & 0x0000FF00U ) >> 8;
1371 *
q++ =
num & 0x000000FFU;
1381 else if (
num <= 1131 )
1399 else if (
num <= 1131 )
1428 goto Stack_Overflow;
1441 code = 0x100 |
p[0];
1454#ifdef FT_DEBUG_LEVEL_TRACE
1461 goto Stack_Underflow;
1463 switch (
field->kind )
1479 switch (
field->size )
1497#ifdef FT_DEBUG_LEVEL_TRACE
1498 switch (
field->kind )
1529 field->count_offset;
1534 if ( num_args >
field->array_max )
1535 num_args =
field->array_max;
1543 while ( num_args > 0 )
1546 switch (
field->size )
1599#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
1600 Out_Of_Memory_Error:
void user(int argc, const char *argv[])
cff_blend_build_vector(CFF_Blend blend, FT_UInt vsindex, FT_UInt lenNDV, FT_Fixed *NDV)
cff_blend_doBlend(CFF_SubFont subFont, CFF_Parser parser, FT_UInt numBlends)
cff_blend_check_vector(CFF_Blend blend, FT_UInt vsindex, FT_UInt lenNDV, FT_Fixed *NDV)
cff_parser_init(CFF_Parser parser, FT_UInt code, void *object, FT_Library library, FT_UInt stackSize, FT_UShort num_designs, FT_UShort num_axes)
static FT_Fixed cff_parse_fixed(CFF_Parser parser, FT_Byte **d)
cff_parse_num(CFF_Parser parser, FT_Byte **d)
static FT_Fixed cff_parse_real(CFF_Parser parser, FT_Byte *start, FT_Long power_ten, FT_Long *scaling)
static FT_Error cff_parse_maxstack(CFF_Parser parser)
static FT_Error cff_parse_font_bbox(CFF_Parser parser)
static FT_Error cff_parse_vsindex(CFF_Parser parser)
static FT_Fixed cff_parse_fixed_dynamic(CFF_Parser parser, FT_Byte **d, FT_Long *scaling)
static FT_Fixed cff_parse_fixed_scaled(CFF_Parser parser, FT_Byte **d, FT_Long scaling)
static FT_Fixed do_fixed(CFF_Parser parser, FT_Byte **d, FT_Long scaling)
static const FT_Long power_tens[]
cff_parser_done(CFF_Parser parser)
static FT_Error cff_parse_font_matrix(CFF_Parser parser)
static FT_Long cff_parse_integer(CFF_Parser parser, FT_Byte *start)
static FT_Error cff_parse_private_dict(CFF_Parser parser)
static const CFF_Field_Handler cff_field_handlers[]
static FT_Error cff_parse_multiple_master(CFF_Parser parser)
static FT_Error cff_parse_blend(CFF_Parser parser)
static FT_Error cff_parse_cid_ros(CFF_Parser parser)
cff_parser_run(CFF_Parser parser, FT_Byte *start, FT_Byte *limit)
static const FT_Long power_ten_limits[]
static FT_Error cff_parser_within_limits(CFF_Parser parser, FT_Byte *first, FT_Byte *last)
#define CFF2_DEFAULT_STACK
@ cff_kind_fixed_thousand
struct CFF_PrivateRec_ * CFF_Private
struct CFF_FontRecDictRec_ * CFF_FontRecDict
FT_DivFix(FT_Long a, FT_Long b)
FT_Matrix_Check(const FT_Matrix *matrix)
#define FT_ASSERT(condition)
#define FT_ERROR(varformat)
#define FT_TRACE1(varformat)
#define FT_TRACE4(varformat)
FT_List_Finalize(FT_List list, FT_List_Destructor destroy, FT_Memory memory, void *user)
FT_List_Add(FT_List list, FT_ListNode node)
#define FT_NEW_ARRAY(ptr, count)
FT_Get_Module_Interface(FT_Library library, const char *mod_name)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
struct FT_ListNodeRec_ * FT_ListNode
FT_BEGIN_HEADER typedef unsigned char FT_Bool
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble GLdouble q
GLboolean GLenum GLenum GLvoid * values
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static unsigned int number
static char memory[1024 *256]
struct PSAux_ServiceRec_ * PSAux_Service
CFF_FontRecDictRec font_dict
const CFF_Decoder_FuncsRec * cff_decoder_funcs
enum parser_state stack[4]
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList