20#include FT_INTERNAL_DEBUG_H
21#include FT_CONFIG_CONFIG_H
22#include FT_MULTIPLE_MASTERS_H
23#include FT_INTERNAL_TYPE1_TYPES_H
37#define FT_COMPONENT trace_cidload
49 for (
result = 0; offsize > 0; offsize-- )
115 FT_ERROR((
"cid_load_keyword: invalid use of `%s'\n",
121 dict =
cid->font_dicts +
parser->num_dict;
125 object = (
FT_Byte*)&dict->private_dict;
166 dict =
face->cid.font_dicts +
parser->num_dict;
174 return FT_THROW( Invalid_File_Format );
178 if ( temp_scale == 0 )
180 FT_ERROR((
"cid_parse_font_matrix: invalid font matrix\n" ));
181 return FT_THROW( Invalid_File_Format );
185 if ( temp_scale != 0x10000L )
195 temp[3] =
temp[3] < 0 ? -0x10000L : 0x10000L;
226 FT_ERROR((
"parse_fd_array: invalid number of dictionaries\n" ));
249 FT_TRACE0((
"parse_fd_array: adjusting FDArray size"
250 " (from %d to %d)\n",
256 if ( !
cid->font_dicts )
264 cid->num_dicts = num_dicts;
267 for (
n = 0;
n <
cid->num_dicts;
n++ )
295 dict =
face->cid.font_dicts +
parser->num_dict;
346 newlimit =
limit - 1 - 17;
348 newlimit =
parser->root.cursor - 17;
351 for ( ;
cur < newlimit;
cur++ )
358 if (
face->cid.num_dicts > 0 )
381 if (
len > 0 &&
len < 22 )
402 for (
n = 1;
n <
len;
n++ )
425 if ( !
face->cid.num_dicts )
427 FT_ERROR((
"cid_parse_dict: No font dictionary found\n" ));
428 return FT_THROW( Invalid_File_Format );
455 for (
n = 0;
n <
cid->num_dicts;
n++, subr++ )
468 if ( num_subrs + 1 > max_offsets )
473 if ( new_max <= max_offsets )
482 max_offsets = new_max;
500 FT_ERROR((
"cid_read_subrs: offsets are not ordered\n" ));
507 FT_ERROR((
"cid_read_subrs: too large `subrs' offsets\n" ));
557 for (
n = 0;
n <
cid->num_dicts;
n++ )
559 if (
face->subrs[
n].code )
612 dlimit =
d + data_len;
641 else if ( *
p >=
'a' && *
p <=
'f' )
643 else if ( *
p >=
'A' && *
p <=
'F' )
645 else if ( *
p ==
' ' ||
655 else if ( *
p ==
'>' )
674 upper_nibble = (
FT_Byte)( 1 - upper_nibble );
719 if ( face_index < 0 )
725 if (
parser->binary_length )
727 if (
parser->binary_length >
728 face->root.stream->size -
parser->data_offset )
730 FT_TRACE0((
"cid_face_open: adjusting length of binary data\n"
731 " (from %d to %d bytes)\n",
733 face->root.stream->size -
parser->data_offset ));
734 parser->binary_length =
face->root.stream->size -
748 cid->data_offset = 0;
752 *
face->cid_stream = *
face->root.stream;
753 cid->data_offset = loader.parser.data_offset;
758 if (
cid->fd_bytes < 0 ||
cid->gd_bytes < 1 )
761 " Invalid `FDBytes' or `GDBytes' value\n" ));
767 if (
cid->fd_bytes > 4 ||
cid->gd_bytes > 4 )
770 " Values of `FDBytes' or `GDBytes' larger than 4\n"
772 " are not supported\n" ));
777 binary_length =
face->cid_stream->size -
cid->data_offset;
780 for (
n = 0;
n <
cid->num_dicts;
n++ )
788 FT_ERROR((
"cid_parse_dict: Invalid `SDBytes' value\n" ));
796 " Values of `SDBytes' larger than 4"
797 " are not supported\n" ));
804 FT_ERROR((
"cid_parse_dict: Invalid `SubrMapOffset' value\n" ));
815 FT_ERROR((
"cid_parse_dict: Invalid `SubrCount' value\n" ));
821 if (
cid->cidmap_offset > binary_length )
823 FT_ERROR((
"cid_parse_dict: Invalid `CIDMapOffset' value\n" ));
830 ( binary_length -
cid->cidmap_offset ) / entry_len )
832 FT_ERROR((
"cid_parse_dict: Invalid `CIDCount' value\n" ));
parse_fd_array(CID_Face face, CID_Parser *parser)
static FT_Error cid_read_subrs(CID_Face face)
static void cid_init_loader(CID_Loader *loader, CID_Face face)
cid_get_offset(FT_Byte **start, FT_Byte offsize)
static void cid_done_loader(CID_Loader *loader)
static FT_Error cid_load_keyword(CID_Face face, CID_Loader *loader, const T1_Field keyword)
parse_expansion_factor(CID_Face face, CID_Parser *parser)
cid_face_open(CID_Face face, FT_Int face_index)
static FT_Error cid_hex_to_binary(FT_Byte *data, FT_ULong data_len, FT_ULong offset, CID_Face face)
static const T1_FieldRec cid_field_records[]
static FT_Error cid_parse_dict(CID_Face face, CID_Loader *loader, FT_Byte *base, FT_ULong size)
cid_parse_font_matrix(CID_Face face, CID_Parser *parser)
FT_BEGIN_HEADER struct CID_Loader_ CID_Loader
cid_parser_new(CID_Parser *parser, FT_Stream stream, FT_Memory memory, PSAux_Service psaux)
cid_parser_done(CID_Parser *parser)
#define cid_parser_skip_PS_token(p)
FT_BEGIN_HEADER struct CID_Parser_ CID_Parser
#define cid_parser_to_fixed_array(p, m, f, t)
#define cid_parser_load_field(p, f, o)
#define cid_parser_load_field_table(p, f, o)
#define cid_parser_to_int(p)
#define cid_parser_skip_spaces(p)
#define cid_parser_to_fixed(p, t)
FT_DivFix(FT_Long a, FT_Long b)
struct FT_FaceRec_ * FT_Face
#define FT_CALLBACK_DEF(x)
#define FT_TRACE0(varformat)
#define FT_ERROR(varformat)
#define FT_NEW_ARRAY(ptr, count)
#define FT_SET_ERROR(expression)
#define FT_ALLOC(ptr, size)
#define FT_RENEW_ARRAY(ptr, curcnt, newcnt)
#define FT_PAD_CEIL(x, n)
#define FT_FRAME_ENTER(size)
#define FT_STREAM_SEEK(position)
#define FT_STREAM_READ(buffer, count)
FT_Stream_OpenMemory(FT_Stream stream, const FT_Byte *base, FT_ULong size)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
FT_BEGIN_HEADER typedef unsigned char FT_Bool
static const FxOffsetAndName offsets[]
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLint GLenum face
static char memory[1024 *256]
struct PSAux_ServiceRec_ * PSAux_Service
@ T1_FIELD_TYPE_INTEGER_ARRAY
@ T1_FIELD_TYPE_FIXED_ARRAY
#define T1_FIELD_CALLBACK(_ident, _name, _dict)
@ T1_FIELD_LOCATION_FONT_EXTRA
@ T1_FIELD_LOCATION_CID_INFO
@ T1_FIELD_LOCATION_PRIVATE
@ T1_FIELD_LOCATION_FONT_INFO
struct T1_FieldRec_ * T1_Field
PS_PrivateRec private_dict
FT_Fixed expansion_factor
void(* t1_decrypt)(FT_Byte *buffer, FT_Offset length, FT_UShort seed)
FT_Fixed expansion_factor