21#include FT_INTERNAL_STREAM_H
22#include FT_INTERNAL_DEBUG_H
23#include FT_INTERNAL_CALC_H
24#include FT_INTERNAL_POSTSCRIPT_AUX_H
38#define FT_COMPONENT cffparse
62 parser->num_designs = num_designs;
63 parser->num_axes = num_axes;
72 parser->stackSize = stackSize;
126 val = (
v - 247 ) * 256 +
p[0] + 108;
133 val = -(
v - 251 ) * 256 -
p[0] - 108;
189 FT_Int sign = 0, exponent_sign = 0, have_overflow = 0;
190 FT_Long exponent_add, integer_length, fraction_length;
222 nib = (
FT_Int)(
p[0] >> phase ) & 0xF;
232 if (
number >= 0xCCCCCCCL )
259 nib = (
p[0] >> phase ) & 0xF;
268 else if (
number < 0xCCCCCCCL && fraction_length < 9 )
298 nib = (
p[0] >> phase ) & 0xF;
326 exponent += power_ten + exponent_add;
331 fraction_length += integer_length;
334 if ( fraction_length <= 5 )
339 *scaling =
exponent - fraction_length + 1;
350 shift = new_fraction_length - fraction_length;
391 if ( integer_length > 5 )
393 if ( integer_length < -5 )
397 if ( integer_length < 0 )
400 fraction_length += integer_length;
404 if ( fraction_length == 10 )
407 fraction_length -= 1;
411 if ( fraction_length > 0 )
463 else if ( **
d == 255 )
473 ( ( ( (FT_UInt32)*(
d[0] + 1 ) << 24 ) |
474 ( (FT_UInt32)*(
d[0] + 2 ) << 16 ) |
475 ( (FT_UInt32)*(
d[0] + 3 ) << 8 ) |
476 (FT_UInt32)*(
d[0] + 4 ) ) + 0x8000U ) >> 16 );
479 ( ( ( (FT_UInt32)*(
d[0] + 1 ) << 16 ) |
480 ( (FT_UInt32)*(
d[0] + 2 ) << 8 ) |
481 (FT_UInt32)*(
d[0] + 3 ) ) + 0x80U ) >> 8 );
507 val =
val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFL;
519 else if (
val < -0x7FFF )
576 for ( integer_length = 5; integer_length < 10; integer_length++ )
582 *scaling = integer_length - 4;
587 *scaling = integer_length - 5;
615 FT_Long min_scaling, max_scaling;
630 for (
i = 0;
i < 6;
i++ )
635 if ( scalings[
i] > max_scaling )
636 max_scaling = scalings[
i];
637 if ( scalings[
i] < min_scaling )
638 min_scaling = scalings[
i];
642 if ( max_scaling < -9 ||
644 ( max_scaling - min_scaling ) < 0 ||
645 ( max_scaling - min_scaling ) > 9 )
648 " strange scaling values (minimum %d, maximum %d),\n"
650 " using default matrix\n", min_scaling, max_scaling ));
654 for (
i = 0;
i < 6;
i++ )
692 (
double)
matrix->xx / *upm / 65536,
693 (
double)
matrix->xy / *upm / 65536,
694 (
double)
matrix->yx / *upm / 65536,
695 (
double)
matrix->yy / *upm / 65536,
696 (
double)
offset->x / *upm / 65536,
697 (
double)
offset->y / *upm / 65536 ));
702 " degenerate values, using default matrix\n" ));
774 FT_ERROR((
"cff_parse_private_dict: Invalid dictionary size\n" ));
783 FT_ERROR((
"cff_parse_private_dict: Invalid dictionary offset\n" ));
810#ifdef FT_DEBUG_LEVEL_TRACE
813 FT_TRACE1((
"Multiple Master CFFs not supported yet,"
814 " handling first master design only\n" ));
817 " handling first master design only)\n" ));
828 if ( num_designs > 16 || num_designs < 2 )
830 FT_ERROR((
"cff_parse_multiple_master:"
831 " Invalid number of designs\n" ));
865 FT_TRACE1((
"cff_parse_cid_ros: real supplement is rounded\n" ));
868 FT_TRACE1((
"cff_parse_cid_ros: negative supplement %d is found\n",
902 FT_ERROR((
" cff_parse_vsindex: vsindex not allowed after blend\n" ));
936 blend = &subFont->
blend;
952 if ( numBlends >
parser->stackSize )
954 FT_ERROR((
"cff_parse_blend: Invalid number of blends\n" ));
961 numBlends == 1 ?
"" :
"s" ));
965 blend->usedBV =
TRUE;
1001#define CFF_FIELD_NUM( code, name, id ) \
1002 CFF_FIELD( code, name, id, cff_kind_num )
1003#define CFF_FIELD_FIXED( code, name, id ) \
1004 CFF_FIELD( code, name, id, cff_kind_fixed )
1005#define CFF_FIELD_FIXED_1000( code, name, id ) \
1006 CFF_FIELD( code, name, id, cff_kind_fixed_thousand )
1007#define CFF_FIELD_STRING( code, name, id ) \
1008 CFF_FIELD( code, name, id, cff_kind_string )
1009#define CFF_FIELD_BOOL( code, name, id ) \
1010 CFF_FIELD( code, name, id, cff_kind_bool )
1014#undef CFF_FIELD_DELTA
1017#ifndef FT_DEBUG_LEVEL_TRACE
1020#define CFF_FIELD_CALLBACK( code, name, id ) \
1022 cff_kind_callback, \
1025 cff_parse_ ## name, \
1029#define CFF_FIELD_BLEND( code, id ) \
1038#define CFF_FIELD( code, name, id, kind ) \
1042 FT_FIELD_OFFSET( name ), \
1043 FT_FIELD_SIZE( name ), \
1047#define CFF_FIELD_DELTA( code, name, max, id ) \
1051 FT_FIELD_OFFSET( name ), \
1052 FT_FIELD_SIZE_DELTA( name ), \
1055 FT_FIELD_OFFSET( num_ ## name ) \
1063 { 0, 0, 0, 0, 0, 0, 0 }
1071#define CFF_FIELD_CALLBACK( code, name, id ) \
1073 cff_kind_callback, \
1076 cff_parse_ ## name, \
1081#define CFF_FIELD_BLEND( code, id ) \
1091#define CFF_FIELD( code, name, id, kind ) \
1095 FT_FIELD_OFFSET( name ), \
1096 FT_FIELD_SIZE( name ), \
1101#define CFF_FIELD_DELTA( code, name, max, id ) \
1105 FT_FIELD_OFFSET( name ), \
1106 FT_FIELD_SIZE_DELTA( name ), \
1109 FT_FIELD_OFFSET( num_ ## name ), \
1118 { 0, 0, 0, 0, 0, 0, 0, 0 }
1125#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
1145#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
1170 if (
v >= 27 &&
v != 31 &&
v != 255 )
1174 goto Stack_Overflow;
1205#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
1220 charstring_base = ++
p;
1232 charstring_len = (
FT_ULong)(
p - charstring_base ) + 1;
1245 FT_ERROR((
"cff_parser_run: cannot access `psaux' module\n" ));
1251 &
decoder, charstring_base, charstring_len, 1 );
1262 goto Out_Of_Memory_Error;
1269 goto Out_Of_Memory_Error;
1284 goto Stack_Overflow;
1299 if (
num & 0xFFFFU )
1305 *
q++ = (
num & 0xFF000000U ) >> 24;
1306 *
q++ = (
num & 0x00FF0000U ) >> 16;
1307 *
q++ = (
num & 0x0000FF00U ) >> 8;
1308 *
q++ =
num & 0x000000FFU;
1318 else if (
num <= 1131 )
1336 else if (
num <= 1131 )
1365 goto Stack_Overflow;
1378 code = 0x100 |
p[0];
1391#ifdef FT_DEBUG_LEVEL_TRACE
1398 goto Stack_Underflow;
1400 switch (
field->kind )
1416 switch (
field->size )
1434#ifdef FT_DEBUG_LEVEL_TRACE
1435 switch (
field->kind )
1466 field->count_offset;
1471 if ( num_args >
field->array_max )
1472 num_args =
field->array_max;
1480 while ( num_args > 0 )
1483 switch (
field->size )
1534#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
1539#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
1540 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_Long cff_parse_integer(FT_Byte *start, FT_Byte *limit)
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_Fixed cff_parse_real(FT_Byte *start, FT_Byte *limit, FT_Long power_ten, FT_Long *scaling)
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[]
#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