Formatting.
Moving some internal structures and constants from freetype.h to ftobjs.h. Finally removing FT_LOAD_ANTI_ALIAS. Cleaning up all error codes. Only the used ones have survived :-) Removed unused FT_MAX_GLYPH_FORMATS constant. T2 error codes are now in the range 0x500-0x5FF (instead of `TrueDoc'). Some minor improvements of error return values. Finally fixing error code values in ftraster and ftgrays to be compliant with all other FT error codes.
This commit is contained in:
parent
681e8eea5f
commit
b48a6094b2
|
@ -272,16 +272,6 @@
|
|||
#define FT_MAX_EXTENSIONS 8
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* FT_MAX_GLYPH_FORMATS */
|
||||
/* */
|
||||
/* The maximum number of glyph image formats that might be registered */
|
||||
/* in a given library instance. 8 seems to be a good choice due to */
|
||||
/* the relatively low number of current formats ;-) */
|
||||
/* */
|
||||
#define FT_MAX_GLYPH_FORMATS 8
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,112 +7,160 @@
|
|||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/* This file is used to define the FreeType error enumeration constants */
|
||||
/* It can also be used to create an error message table easily with */
|
||||
/* something like: */
|
||||
/* */
|
||||
/* { */
|
||||
/* */
|
||||
/* #undef FTERRORS_H */
|
||||
/* #define FT_ERRORDEF( e, v, s ) { e, s ], */
|
||||
/* #define FT_ERROR_START_LIST { */
|
||||
/* #define FT_ERROR_END_LIST { 0, 0 } }; */
|
||||
/* */
|
||||
/* const struct { int err_code; const char* err_msg } ft_errors[] = */
|
||||
/* #include <freetype/fterrors.h> */
|
||||
/* } */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* This file is used to define the FreeType error enumeration constants */
|
||||
/* It can also be used to create an error message table easily with */
|
||||
/* something like: */
|
||||
/* */
|
||||
/* { */
|
||||
/* #undef FTERRORS_H */
|
||||
/* #define FT_ERRORDEF( e, v, s ) { e, s }, */
|
||||
/* #define FT_ERROR_START_LIST { */
|
||||
/* #define FT_ERROR_END_LIST { 0, 0 } }; */
|
||||
/* */
|
||||
/* const struct */
|
||||
/* { */
|
||||
/* int err_code; */
|
||||
/* const char* err_msg */
|
||||
/* } ft_errors[] = */
|
||||
/* */
|
||||
/* #include <freetype/fterrors.h> */
|
||||
/* } */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#ifndef FTERRORS_H
|
||||
#define FTERRORS_H
|
||||
|
||||
|
||||
#ifndef FT_ERRORDEF
|
||||
#define FT_ERRORDEF( e, v, s ) e = v,
|
||||
#define FT_ERROR_START_LIST enum {
|
||||
#define FT_ERROR_END_LIST FT_Err_Max };
|
||||
#endif /* FT_ERRORDEF */
|
||||
|
||||
#define FT_ERRORDEF( e, v, s ) e = v,
|
||||
#define FT_ERROR_START_LIST enum {
|
||||
#define FT_ERROR_END_LIST FT_Err_Max };
|
||||
|
||||
#endif /* !FT_ERRORDEF */
|
||||
|
||||
|
||||
#ifdef FT_ERROR_START_LIST
|
||||
FT_ERROR_START_LIST
|
||||
FT_ERROR_START_LIST
|
||||
#endif
|
||||
|
||||
FT_ERRORDEF( FT_Err_Ok, 0x0000, "no error" )
|
||||
FT_ERRORDEF( FT_Err_Cannot_Open_Resource, 0x0001, "can't open stream" )
|
||||
FT_ERRORDEF( FT_Err_Unknown_File_Format, 0x0002, "unknown file format" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_File_Format, 0x0003, "broken file" )
|
||||
FT_ERRORDEF( FT_Err_Ok, 0x0000, \
|
||||
"no error" )
|
||||
FT_ERRORDEF( FT_Err_Cannot_Open_Resource, 0x0001, \
|
||||
"can't open stream" )
|
||||
FT_ERRORDEF( FT_Err_Unknown_File_Format, 0x0002, \
|
||||
"unknown file format" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_File_Format, 0x0003, \
|
||||
"broken file" )
|
||||
|
||||
FT_ERRORDEF( FT_Err_Invalid_Argument, 0x0010, "invalid argument" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Handle, 0x0011, "invalid object handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Glyph_Index, 0x0012, "invalid glyph index" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Character_Code, 0x0013, "invalid character code" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Argument, 0x0010, \
|
||||
"invalid argument" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Handle, 0x0011, \
|
||||
"invalid object handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Glyph_Index, 0x0012, \
|
||||
"invalid glyph index" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Character_Code, 0x0013, \
|
||||
"invalid character code" )
|
||||
|
||||
FT_ERRORDEF( FT_Err_Unimplemented_Feature, 0x0020, "unimplemented feature" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Glyph_Format, 0x0021, "unsupported glyph image format" )
|
||||
FT_ERRORDEF( FT_Err_Cannot_Render_Glyph, 0x0022, "cannot render this glyph format" )
|
||||
FT_ERRORDEF( FT_Err_Unimplemented_Feature, 0x0020, \
|
||||
"unimplemented feature" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Glyph_Format, 0x0021, \
|
||||
"unsupported glyph image format" )
|
||||
FT_ERRORDEF( FT_Err_Cannot_Render_Glyph, 0x0022, \
|
||||
"cannot render this glyph format" )
|
||||
|
||||
FT_ERRORDEF( FT_Err_Invalid_Library_Handle, 0x0030, "invalid library handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Driver_Handle, 0x0031, "invalid module handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Face_Handle, 0x0032, "invalid face handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Size_Handle, 0x0033, "invalid size handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Slot_Handle, 0x0034, "invalid glyph slot handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_CharMap_Handle, 0x0035, "invalid charmap handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Outline, 0x0036, "invalid outline" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Dimensions, 0x0037, "invalid dimensions" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Version, 0x0038, "invalid FreeType version" )
|
||||
FT_ERRORDEF( FT_Err_Lower_Module_Version, 0x0039, "module version is too low" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Library_Handle, 0x0030, \
|
||||
"invalid library handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Driver_Handle, 0x0031, \
|
||||
"invalid module handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Face_Handle, 0x0032, \
|
||||
"invalid face handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Size_Handle, 0x0033, \
|
||||
"invalid size handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Slot_Handle, 0x0034, \
|
||||
"invalid glyph slot handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_CharMap_Handle, 0x0035, \
|
||||
"invalid charmap handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Outline, 0x0036, \
|
||||
"invalid outline" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Version, 0x0037, \
|
||||
"invalid FreeType version" )
|
||||
FT_ERRORDEF( FT_Err_Lower_Module_Version, 0x0038, \
|
||||
"module version is too low" )
|
||||
|
||||
FT_ERRORDEF( FT_Err_Unavailable_Outline, 0x0040, "unavailable outline" )
|
||||
FT_ERRORDEF( FT_Err_Unavailable_Bitmap, 0x0041, "unavailable bitmap" )
|
||||
FT_ERRORDEF( FT_Err_File_Is_Not_Collection, 0x0042, "file is not a font collection" )
|
||||
FT_ERRORDEF( FT_Err_Too_Many_Drivers, 0x0043, "too many modules" )
|
||||
FT_ERRORDEF( FT_Err_Too_Many_Glyph_Formats, 0x0044, "too many glyph formats" )
|
||||
FT_ERRORDEF( FT_Err_Too_Many_Extensions, 0x0045, "too many extensions" )
|
||||
FT_ERRORDEF( FT_Err_Too_Many_Drivers, 0x0040, \
|
||||
"too many modules" )
|
||||
FT_ERRORDEF( FT_Err_Too_Many_Extensions, 0x0041, \
|
||||
"too many extensions" )
|
||||
|
||||
FT_ERRORDEF( FT_Err_Out_Of_Memory, 0x0050, "out of memory" )
|
||||
FT_ERRORDEF( FT_Err_Unlisted_Object, 0x0051, "unlisted object" )
|
||||
FT_ERRORDEF( FT_Err_Out_Of_Memory, 0x0050, \
|
||||
"out of memory" )
|
||||
FT_ERRORDEF( FT_Err_Unlisted_Object, 0x0051, \
|
||||
"unlisted object" )
|
||||
|
||||
FT_ERRORDEF( FT_Err_Invalid_Stream_Handle, 0x0060, "invalid stream handle" )
|
||||
FT_ERRORDEF( FT_Err_Cannot_Open_Stream, 0x0061, "cannot open stream" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Stream_Seek, 0x0062, "invalid stream seek" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Stream_Skip, 0x0063, "invalid stream skip" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Stream_Read, 0x0064, "invalid stream read" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Stream_Operation, 0x0065, "invalid stream operation" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Frame_Operation, 0x0066, "invalid frame operation" )
|
||||
FT_ERRORDEF( FT_Err_Nested_Frame_Access, 0x0067, "nested frame access" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Frame_Read, 0x0068, "invalid frame read" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Stream_Handle, 0x0060, \
|
||||
"invalid stream handle" )
|
||||
FT_ERRORDEF( FT_Err_Cannot_Open_Stream, 0x0061, \
|
||||
"cannot open stream" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Stream_Seek, 0x0062, \
|
||||
"invalid stream seek" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Stream_Skip, 0x0063, \
|
||||
"invalid stream skip" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Stream_Read, 0x0064, \
|
||||
"invalid stream read" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Stream_Operation, 0x0065, \
|
||||
"invalid stream operation" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Frame_Operation, 0x0066, \
|
||||
"invalid frame operation" )
|
||||
FT_ERRORDEF( FT_Err_Nested_Frame_Access, 0x0067, \
|
||||
"nested frame access" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Frame_Read, 0x0068, \
|
||||
"invalid frame read" )
|
||||
|
||||
FT_ERRORDEF( FT_Err_Too_Many_Points, 0x0070, "too many points in glyph" )
|
||||
FT_ERRORDEF( FT_Err_Too_Many_Contours, 0x0071, "too many contours in glyph" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Composite, 0x0072, "invalid composite glyph" )
|
||||
FT_ERRORDEF( FT_Err_Too_Many_Hints, 0x0073, "too many hints in glyph" )
|
||||
FT_ERRORDEF( FT_Err_Too_Many_Edges, 0x0074, "too many edges in glyph" )
|
||||
FT_ERRORDEF( FT_Err_Too_Many_Strokes, 0x0075, "too many strokes in glyph" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Composite, 0x0070, \
|
||||
"invalid composite glyph" )
|
||||
FT_ERRORDEF( FT_Err_Too_Many_Hints, 0x0071, \
|
||||
"too many hints" )
|
||||
|
||||
/* range 0x400 - 0x4FF is reserved for TrueType specific stuff */
|
||||
FT_ERRORDEF( FT_Err_Raster_Uninitialized, 0x0080, \
|
||||
"raster uninitialized" )
|
||||
FT_ERRORDEF( FT_Err_Raster_Corrupted, 0x0081, \
|
||||
"raster corrupted" )
|
||||
FT_ERRORDEF( FT_Err_Raster_Overflow, 0x0082, \
|
||||
"raster overflow" )
|
||||
FT_ERRORDEF( FT_Err_Raster_Negative_Height, 0x0083, \
|
||||
"negative height while rastering" )
|
||||
|
||||
/* range 0x500 - 0x5FF is reserved for TrueDoc specific stuff */
|
||||
/* range 0x400 - 0x4FF is reserved for TrueType specific stuff */
|
||||
|
||||
/* range 0x600 - 0x6FF is reserved for Type1 specific stuff */
|
||||
/* range 0x500 - 0x5FF is reserved for CFF specific stuff */
|
||||
|
||||
FT_ERRORDEF( FT_Err_Raster_Uninitialized, 0x0080, "raster uninitialized" )
|
||||
FT_ERRORDEF( FT_Err_Raster_Corrupted, 0x0081, "raster corrupted !!" )
|
||||
FT_ERRORDEF( FT_Err_Raster_Overflow, 0x0082, "raster overflow !!" )
|
||||
/* range 0x600 - 0x6FF is reserved for Type1 specific stuff */
|
||||
|
||||
#ifdef FT_ERROR_END_LIST
|
||||
FT_ERROR_END_LIST
|
||||
FT_ERROR_END_LIST
|
||||
#endif
|
||||
|
||||
|
||||
#undef FT_ERROR_START_LIST
|
||||
#undef FT_ERROR_END_LIST
|
||||
#undef FT_ERRORDEF
|
||||
|
||||
|
||||
#endif /* FTERRORS_H */
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
|
@ -199,6 +199,32 @@
|
|||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
|
||||
#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
|
||||
#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
|
||||
#define FT_SUBGLYPH_FLAG_SCALE 8
|
||||
#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
|
||||
#define FT_SUBGLYPH_FLAG_2X2 0x80
|
||||
#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
ft_glyph_own_bitmap = 1
|
||||
};
|
||||
|
||||
|
||||
struct FT_SubGlyph_
|
||||
{
|
||||
FT_Int index;
|
||||
FT_UShort flags;
|
||||
FT_Int arg1;
|
||||
FT_Int arg2;
|
||||
FT_Matrix transform;
|
||||
};
|
||||
|
||||
|
||||
typedef struct FT_GlyphLoad_
|
||||
{
|
||||
FT_Outline outline; /* outline */
|
||||
|
@ -209,7 +235,7 @@
|
|||
} FT_GlyphLoad;
|
||||
|
||||
|
||||
struct FT_GlyphLoader_
|
||||
struct FT_GlyphLoader_
|
||||
{
|
||||
FT_Memory memory;
|
||||
FT_UInt max_points;
|
||||
|
|
|
@ -41,9 +41,6 @@
|
|||
#define T1_Err_Invalid_Glyph_Index FT_Err_Invalid_Glyph_Index
|
||||
|
||||
#define T1_Err_Unimplemented_Feature FT_Err_Unimplemented_Feature
|
||||
#define T1_Err_Unavailable_Outline FT_Err_Unavailable_Outline
|
||||
#define T1_Err_Unavailable_Bitmap FT_Err_Unavailable_Bitmap
|
||||
#define T1_Err_File_Is_Not_Collection FT_Err_File_Is_Not_Collection
|
||||
|
||||
#define T1_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle
|
||||
|
||||
|
@ -54,13 +51,7 @@
|
|||
|
||||
/* ------------ general glyph outline errors ------ */
|
||||
|
||||
#define T1_Err_Too_Many_Points FT_Err_Too_Many_Points
|
||||
#define T1_Err_Too_Many_Contours FT_Err_Too_Many_Contours
|
||||
#define T1_Err_Too_Many_Hints FT_Err_Too_Many_Hints
|
||||
#define T1_Err_Invalid_Composite FT_Err_Invalid_Composite
|
||||
#define T1_Err_Too_Many_Edges FT_Err_Too_Many_Edges
|
||||
#define T1_Err_Too_Many_Strokes FT_Err_Too_Many_Strokes
|
||||
|
||||
|
||||
#define T1_Err_Syntax_Error FT_Err_Invalid_File_Format
|
||||
#define T1_Err_Stack_Underflow FT_Err_Invalid_File_Format
|
||||
|
|
|
@ -46,10 +46,6 @@
|
|||
#define T2_Err_Invalid_Glyph_Index FT_Err_Invalid_Glyph_Index
|
||||
|
||||
#define T2_Err_Unimplemented_Feature FT_Err_Unimplemented_Feature
|
||||
#define T2_Err_Unavailable_Outline FT_Err_Unavailable_Outline
|
||||
#define T2_Err_Unavailable_Bitmap FT_Err_Unavailable_Bitmap
|
||||
#define T2_Err_Unavailable_Pixmap FT_Err_Unavailable_Pixmap
|
||||
#define T2_Err_File_Is_Not_Collection FT_Err_File_Is_Not_Collection
|
||||
|
||||
#define T2_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle
|
||||
|
||||
|
@ -60,9 +56,6 @@
|
|||
|
||||
/* General glyph outline errors. */
|
||||
|
||||
#define T2_Err_Too_Many_Points FT_Err_Too_Many_Points
|
||||
#define T2_Err_Too_Many_Contours FT_Err_Too_Many_Contours
|
||||
#define T2_Err_Too_Many_Ins FT_Err_Too_Many_Hints
|
||||
#define T2_Err_Invalid_Composite FT_Err_Invalid_Composite
|
||||
|
||||
/* Bytecode interpreter error codes. */
|
||||
|
@ -72,53 +65,53 @@
|
|||
/* broken font file, a broken glyph within a font */
|
||||
/* file, or a bug in the interpreter! */
|
||||
|
||||
#define T2_Err_Invalid_Opcode 0x400
|
||||
#define T2_Err_Too_Few_Arguments 0x401
|
||||
#define T2_Err_Stack_Overflow 0x402
|
||||
#define T2_Err_Code_Overflow 0x403
|
||||
#define T2_Err_Bad_Argument 0x404
|
||||
#define T2_Err_Divide_By_Zero 0x405
|
||||
#define T2_Err_Storage_Overflow 0x406
|
||||
#define T2_Err_Cvt_Overflow 0x407
|
||||
#define T2_Err_Invalid_Reference 0x408
|
||||
#define T2_Err_Invalid_Distance 0x409
|
||||
#define T2_Err_Interpolate_Twilight 0x40A
|
||||
#define T2_Err_Debug_OpCode 0x40B
|
||||
#define T2_Err_ENDF_In_Exec_Stream 0x40C
|
||||
#define T2_Err_Out_Of_CodeRanges 0x40D
|
||||
#define T2_Err_Nested_DEFS 0x40E
|
||||
#define T2_Err_Invalid_CodeRange 0x40F
|
||||
#define T2_Err_Invalid_Displacement 0x410
|
||||
#define T2_Err_Execution_Too_Long 0x411
|
||||
#define T2_Err_Invalid_Opcode 0x500
|
||||
#define T2_Err_Too_Few_Arguments 0x501
|
||||
#define T2_Err_Stack_Overflow 0x502
|
||||
#define T2_Err_Code_Overflow 0x503
|
||||
#define T2_Err_Bad_Argument 0x504
|
||||
#define T2_Err_Divide_By_Zero 0x505
|
||||
#define T2_Err_Storage_Overflow 0x506
|
||||
#define T2_Err_Cvt_Overflow 0x507
|
||||
#define T2_Err_Invalid_Reference 0x508
|
||||
#define T2_Err_Invalid_Distance 0x509
|
||||
#define T2_Err_Interpolate_Twilight 0x50A
|
||||
#define T2_Err_Debug_OpCode 0x50B
|
||||
#define T2_Err_ENDF_In_Exec_Stream 0x50C
|
||||
#define T2_Err_Out_Of_CodeRanges 0x50D
|
||||
#define T2_Err_Nested_DEFS 0x50E
|
||||
#define T2_Err_Invalid_CodeRange 0x50F
|
||||
#define T2_Err_Invalid_Displacement 0x510
|
||||
#define T2_Err_Execution_Too_Long 0x511
|
||||
|
||||
#define T2_Err_Too_Many_Instruction_Defs 0x412
|
||||
#define T2_Err_Too_Many_Function_Defs 0x412
|
||||
#define T2_Err_Too_Many_Instruction_Defs 0x512
|
||||
#define T2_Err_Too_Many_Function_Defs 0x513
|
||||
|
||||
/* Other TrueType specific error codes. */
|
||||
|
||||
#define T2_Err_Table_Missing 0x420
|
||||
#define T2_Err_Too_Many_Extensions 0x421
|
||||
#define T2_Err_Extensions_Unsupported 0x422
|
||||
#define T2_Err_Invalid_Extension_Id 0x423
|
||||
#define T2_Err_Table_Missing 0x520
|
||||
#define T2_Err_Too_Many_Extensions 0x521
|
||||
#define T2_Err_Extensions_Unsupported 0x522
|
||||
#define T2_Err_Invalid_Extension_Id 0x523
|
||||
|
||||
#define T2_Err_No_Vertical_Data 0x424
|
||||
#define T2_Err_No_Vertical_Data 0x524
|
||||
|
||||
#define T2_Err_Max_Profile_Missing 0x430
|
||||
#define T2_Err_Header_Table_Missing 0x431
|
||||
#define T2_Err_Horiz_Header_Missing 0x432
|
||||
#define T2_Err_Locations_Missing 0x433
|
||||
#define T2_Err_Name_Table_Missing 0x434
|
||||
#define T2_Err_CMap_Table_Missing 0x435
|
||||
#define T2_Err_Hmtx_Table_Missing 0x436
|
||||
#define T2_Err_OS2_Table_Missing 0x437
|
||||
#define T2_Err_Post_Table_Missing 0x438
|
||||
#define T2_Err_Max_Profile_Missing 0x530
|
||||
#define T2_Err_Header_Table_Missing 0x531
|
||||
#define T2_Err_Horiz_Header_Missing 0x532
|
||||
#define T2_Err_Locations_Missing 0x533
|
||||
#define T2_Err_Name_Table_Missing 0x534
|
||||
#define T2_Err_CMap_Table_Missing 0x535
|
||||
#define T2_Err_Hmtx_Table_Missing 0x536
|
||||
#define T2_Err_OS2_Table_Missing 0x537
|
||||
#define T2_Err_Post_Table_Missing 0x538
|
||||
|
||||
#define T2_Err_Invalid_Horiz_Metrics 0x440
|
||||
#define T2_Err_Invalid_CharMap_Format 0x441
|
||||
#define T2_Err_Invalid_PPem 0x442
|
||||
#define T2_Err_Invalid_Vert_Metrics 0x443
|
||||
#define T2_Err_Invalid_Horiz_Metrics 0x540
|
||||
#define T2_Err_Invalid_CharMap_Format 0x541
|
||||
#define T2_Err_Invalid_PPem 0x542
|
||||
#define T2_Err_Invalid_Vert_Metrics 0x543
|
||||
|
||||
#define T2_Err_Could_Not_Find_Context 0x450
|
||||
#define T2_Err_Could_Not_Find_Context 0x550
|
||||
|
||||
#endif /* FTERRID_H */
|
||||
|
||||
|
|
|
@ -47,9 +47,6 @@
|
|||
#define TT_Err_Invalid_Glyph_Index FT_Err_Invalid_Glyph_Index
|
||||
|
||||
#define TT_Err_Unimplemented_Feature FT_Err_Unimplemented_Feature
|
||||
#define TT_Err_Unavailable_Outline FT_Err_Unavailable_Outline
|
||||
#define TT_Err_Unavailable_Bitmap FT_Err_Unavailable_Bitmap
|
||||
#define TT_Err_File_Is_Not_Collection FT_Err_File_Is_Not_Collection
|
||||
|
||||
#define TT_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle
|
||||
|
||||
|
@ -60,8 +57,6 @@
|
|||
|
||||
/* General glyph outline errors. */
|
||||
|
||||
#define TT_Err_Too_Many_Points FT_Err_Too_Many_Points
|
||||
#define TT_Err_Too_Many_Contours FT_Err_Too_Many_Contours
|
||||
#define TT_Err_Too_Many_Ins FT_Err_Too_Many_Hints
|
||||
#define TT_Err_Invalid_Composite FT_Err_Invalid_Composite
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
/* */
|
||||
/* Implementing basic computation routines. */
|
||||
/* */
|
||||
/* FT_MulDiv() and FT_MulFix() are declared in freetype.h. */
|
||||
/* FT_MulDiv(), FT_MulFix(), and FT_DivFix() are declared in freetype.h. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
|
|
@ -856,7 +856,10 @@
|
|||
/* vector. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* The transformation is only applied to scalable image formats. */
|
||||
/* The transformation is only applied to scalable image formats after */
|
||||
/* the glyph has been loaded. It means that hinting is unaltered by */
|
||||
/* the transformation and is performed on the character size given in */
|
||||
/* the last call to FT_Set_Char_Sizes() or FT_Set_Pixel_Sizes(). */
|
||||
/* */
|
||||
FT_EXPORT_FUNC( void ) FT_Set_Transform( FT_Face face,
|
||||
FT_Matrix* matrix,
|
||||
|
@ -1730,8 +1733,14 @@
|
|||
FT_ListNode node = 0;
|
||||
|
||||
|
||||
if ( !face || !asize || !face->driver )
|
||||
return FT_Err_Invalid_Handle;
|
||||
if ( !face )
|
||||
return FT_Err_Invalid_Face_Handle;
|
||||
|
||||
if ( !asize )
|
||||
return FT_Err_Invalid_Size_Handle;
|
||||
|
||||
if ( !face->driver )
|
||||
return FT_Err_Invalid_Driver_Handle;
|
||||
|
||||
*asize = 0;
|
||||
|
||||
|
@ -2220,6 +2229,7 @@
|
|||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the source face object. */
|
||||
/* */
|
||||
/* charcode :: The character code. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
|
@ -2621,8 +2631,8 @@
|
|||
/* convert. */
|
||||
/* */
|
||||
/* render_mode :: This is the render mode used to render the glyph */
|
||||
/* image into a bitmap. See FT_Render_Mode() for a */
|
||||
/* list of possible values. */
|
||||
/* image into a bitmap. See FT_Render_Mode for a list */
|
||||
/* of possible values. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
|
@ -2980,7 +2990,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
return FT_Err_Invalid_Handle;
|
||||
return FT_Err_Invalid_Driver_Handle;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -697,7 +697,7 @@
|
|||
if ( !error || error != FT_Err_Cannot_Render_Glyph )
|
||||
break;
|
||||
|
||||
/* FT_Err_Cannot_Render_Glyph is returned when the render mode */
|
||||
/* FT_Err_Cannot_Render_Glyph is returned if the render mode */
|
||||
/* is unsupported by the current renderer for this glyph image */
|
||||
/* format */
|
||||
|
||||
|
|
|
@ -1309,7 +1309,7 @@
|
|||
FT_Int dx = 0, dy = 0; /* used in horizontal/vertical */
|
||||
/* algorithm below */
|
||||
FT_Int horizontal, count;
|
||||
|
||||
|
||||
|
||||
FT_TRACE4(( " flex1" ));
|
||||
|
||||
|
@ -1343,7 +1343,7 @@
|
|||
|
||||
/* strange test, but here it is... */
|
||||
horizontal = ( dx > dy );
|
||||
|
||||
|
||||
for ( count = 5; count > 0; count-- )
|
||||
{
|
||||
x += args[0];
|
||||
|
@ -1351,7 +1351,7 @@
|
|||
add_point( builder, x, y, (FT_Bool)( count == 3 ) );
|
||||
args += 2;
|
||||
}
|
||||
|
||||
|
||||
if ( horizontal )
|
||||
{
|
||||
x += args[0];
|
||||
|
|
|
@ -386,9 +386,8 @@
|
|||
goto Exit;
|
||||
break;
|
||||
|
||||
|
||||
default: /* hmm... that's wrong */
|
||||
error = FT_Err_Invalid_File_Format;
|
||||
error = T2_Err_Invalid_File_Format;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
if ( !charset_offset )
|
||||
{
|
||||
FT_ERROR(( "CFF.Build_Unicode_Charmap: charset table is missing\n" ));
|
||||
error = FT_Err_Invalid_File_Format;
|
||||
error = T2_Err_Invalid_File_Format;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@
|
|||
|
||||
default: /* unknown charset format! */
|
||||
FT_ERROR(( "CFF: unknown charset format!\n" ));
|
||||
error = FT_Err_Invalid_File_Format;
|
||||
error = T2_Err_Invalid_File_Format;
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
{
|
||||
TT_CharMapRec root;
|
||||
PS_Unicodes unicodes;
|
||||
|
||||
|
||||
} T2_CharMapRec, *T2_CharMap;
|
||||
|
||||
|
||||
|
|
|
@ -158,6 +158,13 @@
|
|||
#define FT_TRACE( x ) do ; while ( 0 ) /* nothing */
|
||||
#endif
|
||||
|
||||
#define Raster_Err_None 0
|
||||
#define Raster_Err_Not_Ini -1
|
||||
#define Raster_Err_Overflow -2
|
||||
#define Raster_Err_Neg_Height -3
|
||||
#define Raster_Err_Invalid -4
|
||||
#define Raster_Err_Unsupported -5
|
||||
|
||||
|
||||
#else /* _STANDALONE_ */
|
||||
|
||||
|
@ -165,18 +172,17 @@
|
|||
#include <freetype/internal/ftobjs.h>
|
||||
#include <freetype/internal/ftdebug.h> /* for FT_TRACE() and FT_ERROR() */
|
||||
|
||||
#define Raster_Err_None FT_Err_Ok
|
||||
#define Raster_Err_Not_Ini FT_Err_Raster_Uninitialized
|
||||
#define Raster_Err_Overflow FT_Err_Raster_Overflow
|
||||
#define Raster_Err_Neg_Height FT_Err_Raster_Negative_Height
|
||||
#define Raster_Err_Invalid FT_Err_Invalid_Outline
|
||||
#define Raster_Err_Unsupported FT_Err_Unimplemented_Feature
|
||||
|
||||
|
||||
#endif /* _STANDALONE_ */
|
||||
|
||||
|
||||
#define Raster_Err_None 0
|
||||
#define Raster_Err_Not_Ini -1
|
||||
#define Raster_Err_Overflow -2
|
||||
#define Raster_Err_Neg_Height -3
|
||||
#define Raster_Err_Invalid -4
|
||||
#define Raster_Err_Gray_Unsupported -5
|
||||
#define Raster_Err_Unsupported -6
|
||||
|
||||
/* FMulDiv means `Fast MulDiv'; it is used in case where `b' is */
|
||||
/* typically a small value and the result of a*b is known to fit into */
|
||||
/* 32 bits. */
|
||||
|
|
|
@ -94,12 +94,11 @@
|
|||
#define FT_COMPONENT trace_aaraster
|
||||
|
||||
|
||||
/* XXX: Adapt error code to FreeType conventions */
|
||||
#define ErrRaster_Invalid_Outline -1
|
||||
|
||||
#ifdef _STANDALONE_
|
||||
|
||||
|
||||
#define ErrRaster_Invalid_Mode -2
|
||||
#define ErrRaster_Invalid_Outline -1
|
||||
|
||||
#include "ftimage.h"
|
||||
#include "ftgrays.h"
|
||||
|
@ -140,6 +139,7 @@
|
|||
#include <freetype/ftoutln.h> /* for FT_Outline_Decompose() */
|
||||
|
||||
#define ErrRaster_Invalid_Mode FT_Err_Cannot_Render_Glyph
|
||||
#define ErrRaster_Invalid_Outline FT_Err_Invalid_Outline
|
||||
|
||||
|
||||
#endif /* _STANDALONE_ */
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
FT_Error ft_smooth_init( FT_Renderer render )
|
||||
{
|
||||
FT_Library library = FT_MODULE_LIBRARY( render );
|
||||
|
||||
|
||||
|
||||
render->clazz->raster_class->raster_reset( render->raster,
|
||||
library->raster_pool,
|
||||
|
@ -46,7 +46,7 @@
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* sets render-specific mode */
|
||||
static
|
||||
|
@ -58,7 +58,7 @@
|
|||
return render->clazz->raster_class->raster_set_mode( render->raster,
|
||||
mode_tag,
|
||||
data );
|
||||
}
|
||||
}
|
||||
|
||||
/* transform a given glyph image */
|
||||
static
|
||||
|
@ -68,20 +68,20 @@
|
|||
FT_Vector* delta )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
|
||||
|
||||
|
||||
if ( slot->format != render->glyph_format )
|
||||
{
|
||||
error = FT_Err_Invalid_Argument;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
if ( matrix )
|
||||
FT_Outline_Transform( &slot->outline, matrix );
|
||||
|
||||
|
||||
if ( delta )
|
||||
FT_Outline_Translate( &slot->outline, delta->x, delta->y );
|
||||
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
@ -97,8 +97,8 @@
|
|||
|
||||
if ( slot->format == render->glyph_format )
|
||||
FT_Outline_Get_CBox( &slot->outline, cbox );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* convert a slot's glyph image into a bitmap */
|
||||
static
|
||||
|
@ -113,9 +113,9 @@
|
|||
FT_UInt width, height, pitch;
|
||||
FT_Bitmap* bitmap;
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
FT_Raster_Params params;
|
||||
|
||||
|
||||
|
||||
/* check glyph image format */
|
||||
if ( slot->format != render->glyph_format )
|
||||
|
@ -123,20 +123,20 @@
|
|||
error = FT_Err_Invalid_Argument;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
/* check mode */
|
||||
if ( mode != ft_render_mode_normal )
|
||||
return FT_Err_Cannot_Render_Glyph;
|
||||
|
||||
|
||||
outline = &slot->outline;
|
||||
|
||||
|
||||
/* translate the outline to the new origin if needed */
|
||||
if ( origin )
|
||||
FT_Outline_Translate( outline, origin->x, origin->y );
|
||||
|
||||
|
||||
/* compute the control box, and grid fit it */
|
||||
FT_Outline_Get_CBox( outline, &cbox );
|
||||
|
||||
|
||||
cbox.xMin &= -64;
|
||||
cbox.yMin &= -64;
|
||||
cbox.xMax = ( cbox.xMax + 63 ) & -64;
|
||||
|
@ -146,14 +146,14 @@
|
|||
height = ( cbox.yMax - cbox.yMin ) >> 6;
|
||||
bitmap = &slot->bitmap;
|
||||
memory = render->root.memory;
|
||||
|
||||
|
||||
/* release old bitmap buffer */
|
||||
if ( slot->flags & ft_glyph_own_bitmap )
|
||||
{
|
||||
FREE( bitmap->buffer );
|
||||
slot->flags &= ~ft_glyph_own_bitmap;
|
||||
}
|
||||
|
||||
|
||||
/* allocate new one, depends on pixel format */
|
||||
pitch = width;
|
||||
bitmap->pixel_mode = ft_pixel_mode_grays;
|
||||
|
@ -161,12 +161,12 @@
|
|||
bitmap->width = width;
|
||||
bitmap->rows = height;
|
||||
bitmap->pitch = pitch;
|
||||
|
||||
|
||||
if ( ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )
|
||||
goto Exit;
|
||||
|
||||
slot->flags |= ft_glyph_own_bitmap;
|
||||
|
||||
|
||||
/* translate outline to render it into the bitmap */
|
||||
FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin );
|
||||
|
||||
|
@ -179,7 +179,7 @@
|
|||
error = render->raster_render( render->raster, ¶ms );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
|
||||
slot->format = ft_glyph_format_bitmap;
|
||||
slot->bitmap_left = cbox.xMin >> 6;
|
||||
slot->bitmap_top = cbox.yMax >> 6;
|
||||
|
@ -194,25 +194,25 @@
|
|||
{
|
||||
ft_module_renderer,
|
||||
sizeof( FT_RendererRec ),
|
||||
|
||||
|
||||
"smooth",
|
||||
0x10000L,
|
||||
0x20000L,
|
||||
|
||||
|
||||
0, /* module specific interface */
|
||||
|
||||
|
||||
(FT_Module_Constructor)ft_smooth_init,
|
||||
(FT_Module_Destructor) 0,
|
||||
(FT_Module_Requester) 0
|
||||
},
|
||||
|
||||
ft_glyph_format_outline,
|
||||
|
||||
|
||||
(FTRenderer_render) ft_smooth_render,
|
||||
(FTRenderer_transform)ft_smooth_transform,
|
||||
(FTRenderer_getCBox) ft_smooth_get_cbox,
|
||||
(FTRenderer_setMode) ft_smooth_set_mode,
|
||||
|
||||
|
||||
(FT_Raster_Funcs*) &ft_grays_raster
|
||||
};
|
||||
|
||||
|
|
|
@ -436,20 +436,20 @@
|
|||
ft_module_font_driver |
|
||||
ft_module_driver_scalable |
|
||||
ft_module_driver_has_hinter,
|
||||
|
||||
|
||||
sizeof ( TT_DriverRec ),
|
||||
|
||||
|
||||
"truetype", /* driver name */
|
||||
0x10000L, /* driver version == 1.0 */
|
||||
0x20000L, /* driver requires FreeType 2.0 or above */
|
||||
|
||||
|
||||
(void*)0, /* driver specific interface */
|
||||
|
||||
|
||||
(FT_Module_Constructor)TT_Init_Driver,
|
||||
(FT_Module_Destructor) TT_Done_Driver,
|
||||
(FT_Module_Requester) tt_get_interface,
|
||||
},
|
||||
|
||||
|
||||
sizeof ( TT_FaceRec ),
|
||||
sizeof ( TT_SizeRec ),
|
||||
sizeof ( FT_GlyphSlotRec ),
|
||||
|
@ -466,7 +466,7 @@
|
|||
(FTDriver_setPixelSizes)Set_Pixel_Sizes,
|
||||
(FTDriver_loadGlyph) Load_Glyph,
|
||||
(FTDriver_getCharIndex) Get_Char_Index,
|
||||
|
||||
|
||||
(FTDriver_getKerning) Get_Kerning,
|
||||
(FTDriver_attachFile) 0,
|
||||
(FTDriver_getAdvances) 0
|
||||
|
|
|
@ -217,7 +217,7 @@
|
|||
|
||||
Exit:
|
||||
return error;
|
||||
|
||||
|
||||
Bad_Format:
|
||||
error = FT_Err_Unknown_File_Format;
|
||||
goto Exit;
|
||||
|
@ -683,7 +683,7 @@
|
|||
|
||||
/* set `extra' in glyph loader */
|
||||
error = FT_GlyphLoader_Create_Extra( FT_DRIVER( driver )->glyph_loader );
|
||||
|
||||
|
||||
/* init extension registry if needed */
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
|
||||
|
|
|
@ -287,13 +287,13 @@
|
|||
{
|
||||
ft_module_font_driver | ft_module_driver_scalable,
|
||||
sizeof( FT_DriverRec ),
|
||||
|
||||
|
||||
"type1", /* driver name */
|
||||
0x10000L, /* driver version 1.0 */
|
||||
0x20000L, /* driver requires FreeType 2.0 or above */
|
||||
|
||||
|
||||
0, /* module specific interface */
|
||||
|
||||
|
||||
(FT_Module_Constructor)0,
|
||||
(FT_Module_Destructor) 0,
|
||||
#ifdef T1_CONFIG_OPTION_NO_AFM
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
{
|
||||
if ( reset_base )
|
||||
FT_GlyphLoader_Rewind( builder->loader );
|
||||
|
||||
|
||||
FT_GlyphLoader_Prepare( builder->loader );
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@
|
|||
{
|
||||
FT_GlyphLoader* loader = FT_SLOT( glyph )->loader;
|
||||
|
||||
|
||||
|
||||
builder->loader = loader;
|
||||
builder->base = &loader->base.outline;
|
||||
builder->current = &loader->current.outline;
|
||||
|
@ -311,7 +311,7 @@
|
|||
error = FT_GlyphLoader_Check_Subglyphs( loader, 2 );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
|
||||
subg = loader->current.subglyphs;
|
||||
|
||||
/* subglyph 0 = base character */
|
||||
|
@ -332,14 +332,14 @@
|
|||
glyph->num_subglyphs = 2;
|
||||
glyph->subglyphs = loader->current.subglyphs;
|
||||
glyph->format = ft_glyph_format_composite;
|
||||
|
||||
|
||||
loader->current.num_subglyphs = 2;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* First load `bchar' in builder */
|
||||
/* now load the unscaled outline */
|
||||
|
||||
|
||||
if ( decoder->builder.loader )
|
||||
FT_GlyphLoader_Prepare( decoder->builder.loader ); /* prepare loader */
|
||||
|
||||
|
@ -384,7 +384,7 @@
|
|||
{
|
||||
FT_Outline dummy;
|
||||
|
||||
|
||||
|
||||
dummy.n_points = base->n_points - n_base_points;
|
||||
dummy.points = base->points + n_base_points;
|
||||
|
||||
|
@ -1266,14 +1266,14 @@
|
|||
FT_Int first = 0;
|
||||
FT_Vector* p1 = cur->points + first;
|
||||
FT_Vector* p2 = cur->points + cur->n_points - 1;
|
||||
|
||||
|
||||
|
||||
if ( cur->n_contours > 1 )
|
||||
{
|
||||
first = cur->contours[cur->n_contours - 2] + 1;
|
||||
p1 = cur->points + first;
|
||||
}
|
||||
|
||||
|
||||
if ( p1->x == p2->x && p1->y == p2->y )
|
||||
cur->n_points--;
|
||||
}
|
||||
|
@ -1546,16 +1546,16 @@
|
|||
FT_UInt old_points, old_contours;
|
||||
FT_GlyphLoader* loader = decoder->builder.loader;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
|
||||
/* Pass 1 -- try to load first glyph, simply recording points */
|
||||
old_points = loader->base.outline.n_points;
|
||||
old_contours = loader->base.outline.n_contours;
|
||||
|
||||
|
||||
FT_GlyphLoader_Prepare( decoder->builder.loader );
|
||||
|
||||
T1_Reset_Builder( builder, 0 );
|
||||
|
||||
|
||||
builder->no_recurse = recurse;
|
||||
builder->pass = 0;
|
||||
glyph->hints->hori_stems.num_stems = 0;
|
||||
|
@ -1568,7 +1568,7 @@
|
|||
type1->subrs,
|
||||
type1->subrs_len );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
goto Exit;
|
||||
|
||||
/* check for composite (i.e. `seac' operator) */
|
||||
if ( glyph->root.format == ft_glyph_format_composite )
|
||||
|
@ -1603,7 +1603,7 @@
|
|||
error = t1_load_hinted_glyph( decoder, subglyph->index, 0 );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
|
||||
/* Finally, move the accent */
|
||||
dx = FT_MulFix( subglyph->arg1, size->root.metrics.x_scale );
|
||||
dy = FT_MulFix( subglyph->arg2, size->root.metrics.y_scale );
|
||||
|
@ -1612,7 +1612,7 @@
|
|||
{
|
||||
FT_Outline dummy;
|
||||
|
||||
|
||||
|
||||
dummy.n_points = loader->base.outline.n_points - n_base_points;
|
||||
dummy.points = loader->base.outline.points + n_base_points;
|
||||
|
||||
|
@ -1628,17 +1628,17 @@
|
|||
{
|
||||
/* All right, pass 1 is finished, now grid-fit all stem hints */
|
||||
T1_Hint_Stems( &decoder->builder );
|
||||
|
||||
|
||||
/* undo the end-char */
|
||||
builder->base->n_points = old_points;
|
||||
builder->base->n_contours = old_contours;
|
||||
|
||||
/* Pass 2 -- record and scale/hint the points */
|
||||
T1_Reset_Builder( builder, 0 );
|
||||
|
||||
|
||||
builder->pass = 1;
|
||||
builder->no_recurse = 0;
|
||||
|
||||
|
||||
error = T1_Parse_CharStrings( decoder,
|
||||
type1->charstrings [glyph_index],
|
||||
type1->charstrings_len[glyph_index],
|
||||
|
@ -1646,14 +1646,14 @@
|
|||
type1->subrs,
|
||||
type1->subrs_len );
|
||||
}
|
||||
|
||||
|
||||
/* save new glyph tables */
|
||||
if ( recurse )
|
||||
T1_Done_Builder( builder );
|
||||
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* !T1_CONFIG_OPTION_DISABLE_HINTER */
|
||||
|
@ -1694,7 +1694,7 @@
|
|||
T1_Init_Decoder( &decoder, &t1_hinter_funcs );
|
||||
T1_Init_Builder( &decoder.builder, face, size, glyph,
|
||||
&gload_builder_interface );
|
||||
|
||||
|
||||
error = t1_load_hinted_glyph( &decoder, glyph_index, 1 );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -890,7 +890,7 @@
|
|||
|
||||
|
||||
tokzer->cursor += count; /* skip */
|
||||
|
||||
|
||||
if ( face->type1.private_dict.lenIV >= 0 )
|
||||
{
|
||||
t1_decrypt( base, count, 4330 );
|
||||
|
|
|
@ -291,10 +291,10 @@
|
|||
psnames = (PSNames_Interface*)
|
||||
FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
|
||||
"psnames" );
|
||||
|
||||
|
||||
face->psnames = psnames;
|
||||
}
|
||||
|
||||
|
||||
/* open the tokenizer, this will also check the font format */
|
||||
error = New_Tokenizer( stream, &tokenizer );
|
||||
if ( error )
|
||||
|
|
|
@ -946,7 +946,7 @@
|
|||
tok->token.kind = ( c >= '0' && c <= '9' ? tok_number : tok_any );
|
||||
goto L2;
|
||||
}
|
||||
|
||||
|
||||
if ( grow( tok ) )
|
||||
goto Exit;
|
||||
base = tok->base;
|
||||
|
|
|
@ -83,16 +83,16 @@
|
|||
{
|
||||
FT_UNUSED( driver );
|
||||
FT_UNUSED( interface );
|
||||
|
||||
|
||||
#ifndef Z1_CONFIG_OPTION_NO_MM_SUPPORT
|
||||
if ( strcmp( (const char*)interface, "get_mm" ) == 0 )
|
||||
return (FT_Module_Interface)Z1_Get_Multi_Master;
|
||||
|
||||
|
||||
if ( strcmp( (const char*)interface, "set_mm_design") == 0 )
|
||||
return (FT_Module_Interface)Z1_Set_MM_Design;
|
||||
return (FT_Module_Interface)Z1_Set_MM_Design;
|
||||
|
||||
if ( strcmp( (const char*)interface, "set_mm_blend") == 0 )
|
||||
return (FT_Module_Interface)Z1_Set_MM_Blend;
|
||||
return (FT_Module_Interface)Z1_Set_MM_Blend;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
@ -259,13 +259,13 @@
|
|||
{
|
||||
ft_module_font_driver | ft_module_driver_scalable,
|
||||
sizeof( FT_DriverRec ),
|
||||
|
||||
|
||||
"type1z",
|
||||
0x10000L,
|
||||
0x20000L,
|
||||
|
||||
|
||||
0, /* format interface */
|
||||
|
||||
|
||||
(FT_Module_Constructor)Z1_Init_Driver,
|
||||
(FT_Module_Destructor) Z1_Done_Driver,
|
||||
(FT_Module_Requester) Get_Interface,
|
||||
|
|
|
@ -156,7 +156,7 @@
|
|||
if ( glyph )
|
||||
{
|
||||
FT_GlyphLoader* loader = glyph->root.loader;
|
||||
|
||||
|
||||
|
||||
builder->loader = loader;
|
||||
builder->current = &loader->current.outline;
|
||||
|
@ -303,7 +303,7 @@
|
|||
{
|
||||
if ( outline->n_contours > 0 )
|
||||
outline->contours[outline->n_contours - 1] = outline->n_points - 1;
|
||||
|
||||
|
||||
outline->n_contours++;
|
||||
}
|
||||
|
||||
|
@ -346,18 +346,18 @@
|
|||
FT_Int first = 0;
|
||||
FT_Vector* p1 = outline->points + first;
|
||||
FT_Vector* p2 = outline->points + outline->n_points-1;
|
||||
|
||||
|
||||
|
||||
if ( outline->n_contours > 1 )
|
||||
{
|
||||
first = outline->contours[outline->n_contours - 2] + 1;
|
||||
p1 = outline->points + first;
|
||||
}
|
||||
|
||||
|
||||
if ( p1->x == p2->x && p1->y == p2->y )
|
||||
outline->n_points--;
|
||||
}
|
||||
|
||||
|
||||
if ( outline->n_contours > 0 )
|
||||
outline->contours[outline->n_contours - 1] = outline->n_points - 1;
|
||||
}
|
||||
|
@ -474,7 +474,7 @@
|
|||
error = FT_GlyphLoader_Check_Subglyphs( loader, 2 );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
|
||||
subg = loader->current.subglyphs;
|
||||
|
||||
/* subglyph 0 = base character */
|
||||
|
@ -495,13 +495,13 @@
|
|||
glyph->num_subglyphs = 2;
|
||||
glyph->subglyphs = loader->base.subglyphs;
|
||||
glyph->format = ft_glyph_format_composite;
|
||||
|
||||
|
||||
loader->current.num_subglyphs = 2;
|
||||
}
|
||||
|
||||
/* First load `bchar' in builder */
|
||||
/* now load the unscaled outline */
|
||||
|
||||
|
||||
FT_GlyphLoader_Prepare( decoder->builder.loader ); /* prepare loader */
|
||||
|
||||
error = Z1_Parse_CharStrings( decoder,
|
||||
|
@ -546,7 +546,7 @@
|
|||
{
|
||||
FT_Outline dummy;
|
||||
|
||||
|
||||
|
||||
dummy.n_points = base->n_points - n_base_points;
|
||||
dummy.points = base->points + n_base_points;
|
||||
FT_Outline_Translate( &dummy, adx - asb, ady );
|
||||
|
@ -889,7 +889,7 @@
|
|||
/* counter control hints, clear stack */
|
||||
top = decoder->stack;
|
||||
break;
|
||||
|
||||
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
|
@ -901,14 +901,14 @@
|
|||
FT_Int* delta;
|
||||
FT_Int* values;
|
||||
|
||||
|
||||
|
||||
if ( !blend )
|
||||
{
|
||||
FT_ERROR(( "Z1_Parse_CharStrings:" ));
|
||||
FT_ERROR(( " unexpected multiple masters operator!\n" ));
|
||||
goto Syntax_Error;
|
||||
}
|
||||
|
||||
|
||||
num_points = top[1] - 13 + ( top[1] == 18 );
|
||||
if ( top[0] != (FT_Int)( num_points * blend->num_designs ) )
|
||||
{
|
||||
|
@ -916,7 +916,7 @@
|
|||
FT_ERROR(( " incorrect number of mm arguments\n" ));
|
||||
goto Syntax_Error;
|
||||
}
|
||||
|
||||
|
||||
top -= blend->num_designs*num_points;
|
||||
if ( top < decoder->stack )
|
||||
goto Stack_Underflow;
|
||||
|
@ -951,7 +951,7 @@
|
|||
/* note that `top' will be incremented later by calls to `pop' */
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
Unexpected_OtherSubr:
|
||||
FT_ERROR(( "Z1_Parse_CharStrings: invalid othersubr [%d %d]!\n",
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
static
|
||||
FT_Error t1_allocate_blend( T1_Face face,
|
||||
FT_UInt num_designs,
|
||||
|
@ -113,17 +113,17 @@
|
|||
T1_Blend* blend;
|
||||
FT_Memory memory = face->root.memory;
|
||||
FT_Error error = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
blend = face->blend;
|
||||
if ( !blend )
|
||||
{
|
||||
if ( ALLOC( blend, sizeof ( *blend ) ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
face->blend = blend;
|
||||
}
|
||||
|
||||
|
||||
/* allocate design data if needed */
|
||||
if ( num_designs > 0 )
|
||||
{
|
||||
|
@ -134,9 +134,9 @@
|
|||
ALLOC_ARRAY( blend->privates[1], num_designs, T1_Private ) ||
|
||||
ALLOC_ARRAY( blend->weight_vector, num_designs * 2, FT_Fixed ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
blend->default_weight_vector = blend->weight_vector + num_designs;
|
||||
|
||||
|
||||
blend->font_infos[0] = &face->type1.font_info;
|
||||
blend->privates [0] = &face->type1.private_dict;
|
||||
blend->num_designs = num_designs;
|
||||
|
@ -144,41 +144,41 @@
|
|||
else if ( blend->num_designs != num_designs )
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
|
||||
/* allocate axis data if needed */
|
||||
if ( num_axis > 0 )
|
||||
{
|
||||
if ( blend->num_axis != 0 && blend->num_axis != num_axis )
|
||||
goto Fail;
|
||||
|
||||
|
||||
blend->num_axis = num_axis;
|
||||
}
|
||||
|
||||
|
||||
/* allocate the blend design pos table if needed */
|
||||
num_designs = blend->num_designs;
|
||||
num_axis = blend->num_axis;
|
||||
if ( num_designs && num_axis && blend->design_pos[0] == 0 )
|
||||
{
|
||||
FT_UInt n;
|
||||
|
||||
|
||||
|
||||
|
||||
if ( ALLOC_ARRAY( blend->design_pos[0],
|
||||
num_designs * num_axis, FT_Fixed ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
for ( n = 1; n < num_designs; n++ )
|
||||
blend->design_pos[n] = blend->design_pos[0] + num_axis * n;
|
||||
}
|
||||
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
|
||||
|
||||
Fail:
|
||||
error = -1;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
LOCAL_FUNC
|
||||
FT_Error Z1_Get_Multi_Master( T1_Face face,
|
||||
FT_Multi_Master* master )
|
||||
|
@ -186,21 +186,21 @@
|
|||
T1_Blend* blend = face->blend;
|
||||
FT_UInt n;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
|
||||
|
||||
error = T1_Err_Invalid_Argument;
|
||||
|
||||
|
||||
if ( blend )
|
||||
{
|
||||
master->num_axis = blend->num_axis;
|
||||
master->num_designs = blend->num_designs;
|
||||
|
||||
|
||||
for ( n = 0; n < blend->num_axis; n++ )
|
||||
{
|
||||
FT_MM_Axis* axis = master->axis + n;
|
||||
T1_DesignMap* map = blend->design_map + n;
|
||||
|
||||
|
||||
|
||||
|
||||
axis->name = blend->axis_names[n];
|
||||
axis->minimum = map->design_points[0];
|
||||
axis->maximum = map->design_points[map->num_points - 1];
|
||||
|
@ -208,9 +208,9 @@
|
|||
error = 0;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
LOCAL_FUNC
|
||||
FT_Error Z1_Set_MM_Blend( T1_Face face,
|
||||
FT_UInt num_coords,
|
||||
|
@ -219,7 +219,7 @@
|
|||
T1_Blend* blend = face->blend;
|
||||
FT_Error error;
|
||||
FT_UInt n, m;
|
||||
|
||||
|
||||
|
||||
error = T1_Err_Invalid_Argument;
|
||||
|
||||
|
@ -236,16 +236,16 @@
|
|||
for ( m = 0; m < blend->num_axis; m++ )
|
||||
{
|
||||
FT_Fixed factor;
|
||||
|
||||
|
||||
|
||||
/* get current blend axis position */
|
||||
factor = coords[m];
|
||||
if ( factor < 0 ) factor = 0;
|
||||
if ( factor > 0x10000L ) factor = 0x10000L;
|
||||
|
||||
|
||||
if ( ( n & ( 1 << m ) ) == 0 )
|
||||
factor = 0x10000L - factor;
|
||||
|
||||
|
||||
result = FT_MulFix( result, factor );
|
||||
}
|
||||
blend->weight_vector[n] = result;
|
||||
|
@ -255,8 +255,8 @@
|
|||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
LOCAL_FUNC
|
||||
FT_Error Z1_Set_MM_Design( T1_Face face,
|
||||
FT_UInt num_coords,
|
||||
|
@ -266,13 +266,13 @@
|
|||
FT_Error error;
|
||||
FT_UInt n, p;
|
||||
|
||||
|
||||
|
||||
error = T1_Err_Invalid_Argument;
|
||||
if ( blend && blend->num_axis == num_coords )
|
||||
{
|
||||
/* compute the blend coordinates through the blend design map */
|
||||
FT_Fixed final_blends[T1_MAX_MM_DESIGNS];
|
||||
|
||||
|
||||
|
||||
for ( n = 0; n < blend->num_axis; n++ )
|
||||
{
|
||||
|
@ -282,11 +282,11 @@
|
|||
FT_Fixed* designs = map->design_points;
|
||||
FT_Fixed* blends = map->blend_points;
|
||||
FT_Int before = -1, after = -1;
|
||||
|
||||
|
||||
for ( p = 0; p < map->num_points; p++ )
|
||||
{
|
||||
FT_Fixed p_design = designs[p];
|
||||
|
||||
|
||||
|
||||
/* exact match ? */
|
||||
if ( design == p_design )
|
||||
|
@ -294,23 +294,23 @@
|
|||
the_blend = blends[p];
|
||||
goto Found;
|
||||
}
|
||||
|
||||
|
||||
if ( design < p_design )
|
||||
{
|
||||
after = p;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
before = p;
|
||||
}
|
||||
|
||||
|
||||
/* now, interpolate if needed */
|
||||
if ( before < 0 )
|
||||
the_blend = blends[0];
|
||||
|
||||
|
||||
else if ( after < 0 )
|
||||
the_blend = blends[map->num_points - 1];
|
||||
|
||||
|
||||
else
|
||||
the_blend = FT_MulDiv( design - designs[before],
|
||||
blends [after] - blends [before],
|
||||
|
@ -319,33 +319,33 @@
|
|||
Found:
|
||||
final_blends[n] = the_blend;
|
||||
}
|
||||
|
||||
error = Z1_Set_MM_Blend( face, num_coords, final_blends );
|
||||
|
||||
error = Z1_Set_MM_Blend( face, num_coords, final_blends );
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
LOCAL_FUNC
|
||||
void Z1_Done_Blend( T1_Face face )
|
||||
{
|
||||
FT_Memory memory = face->root.memory;
|
||||
T1_Blend* blend = face->blend;
|
||||
|
||||
|
||||
|
||||
if ( blend )
|
||||
{
|
||||
FT_UInt num_designs = blend->num_designs;
|
||||
FT_UInt num_axis = blend->num_axis;
|
||||
FT_UInt n;
|
||||
|
||||
|
||||
|
||||
/* release design pos table */
|
||||
FREE( blend->design_pos[0] );
|
||||
for ( n = 1; n < num_designs; n++ )
|
||||
blend->design_pos[n] = 0;
|
||||
|
||||
|
||||
/* release blend `private' and `font info' dictionaries */
|
||||
FREE( blend->privates[1] );
|
||||
FREE( blend->font_infos[1] );
|
||||
|
@ -355,15 +355,15 @@
|
|||
blend->privates [n] = 0;
|
||||
blend->font_infos[n] = 0;
|
||||
}
|
||||
|
||||
|
||||
/* release weight vectors */
|
||||
FREE( blend->weight_vector );
|
||||
blend->default_weight_vector = 0;
|
||||
|
||||
|
||||
/* release axis names */
|
||||
for ( n = 0; n < num_axis; n++ )
|
||||
FREE( blend->axis_names[n] );
|
||||
|
||||
|
||||
/* release design map */
|
||||
for ( n = 0; n < num_axis; n++ )
|
||||
{
|
||||
|
@ -373,12 +373,12 @@
|
|||
FREE( dmap->design_points );
|
||||
dmap->num_points = 0;
|
||||
}
|
||||
|
||||
|
||||
FREE( face->blend );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static
|
||||
void parse_blend_axis_types( T1_Face face,
|
||||
Z1_Loader* loader )
|
||||
|
@ -388,7 +388,7 @@
|
|||
FT_Error error = 0;
|
||||
T1_Blend* blend;
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
|
||||
/* take an array of objects */
|
||||
Z1_ToTokenArray( &loader->parser, axis_tokens,
|
||||
|
@ -400,46 +400,46 @@
|
|||
error = T1_Err_Invalid_File_Format;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
/* allocate blend if necessary */
|
||||
error = t1_allocate_blend( face, 0, (FT_UInt)num_axis );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
|
||||
blend = face->blend;
|
||||
memory = face->root.memory;
|
||||
|
||||
|
||||
/* each token is an immediate containing the name of the axis */
|
||||
for ( n = 0; n < num_axis; n++ )
|
||||
{
|
||||
Z1_Token_Rec* token = axis_tokens + n;
|
||||
FT_Byte* name;
|
||||
FT_Int len;
|
||||
|
||||
|
||||
/* skip first slash, if any */
|
||||
if (token->start[0] == '/')
|
||||
token->start++;
|
||||
|
||||
|
||||
len = token->limit - token->start;
|
||||
if ( len <= 0 )
|
||||
{
|
||||
error = T1_Err_Invalid_File_Format;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
if ( ALLOC( blend->axis_names[n], len + 1 ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
name = (FT_Byte*)blend->axis_names[n];
|
||||
MEM_Copy( name, token->start, len );
|
||||
name[len] = 0;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
Exit:
|
||||
loader->parser.error = error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static
|
||||
void parse_blend_design_positions( T1_Face face,
|
||||
Z1_Loader* loader )
|
||||
|
@ -448,12 +448,12 @@
|
|||
FT_Int num_designs;
|
||||
FT_Int num_axis;
|
||||
Z1_Parser* parser = &loader->parser;
|
||||
|
||||
|
||||
FT_Error error = 0;
|
||||
T1_Blend* blend;
|
||||
|
||||
|
||||
/* get the array of design tokens - compute number of designs */
|
||||
|
||||
/* get the array of design tokens - compute number of designs */
|
||||
Z1_ToTokenArray( parser, design_tokens, T1_MAX_MM_DESIGNS, &num_designs );
|
||||
if ( num_designs <= 0 || num_designs > T1_MAX_MM_DESIGNS )
|
||||
{
|
||||
|
@ -463,12 +463,12 @@
|
|||
error = T1_Err_Invalid_File_Format;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
FT_Byte* old_cursor = parser->cursor;
|
||||
FT_Byte* old_limit = parser->limit;
|
||||
FT_UInt n;
|
||||
|
||||
|
||||
|
||||
blend = face->blend;
|
||||
num_axis = 0; /* make compiler happy */
|
||||
|
@ -478,14 +478,14 @@
|
|||
Z1_Token_Rec axis_tokens[ T1_MAX_MM_DESIGNS ];
|
||||
Z1_Token_Rec* token;
|
||||
FT_Int axis, n_axis;
|
||||
|
||||
|
||||
|
||||
/* read axis/coordinates tokens */
|
||||
token = design_tokens + n;
|
||||
parser->cursor = token->start - 1;
|
||||
parser->limit = token->limit + 1;
|
||||
Z1_ToTokenArray( parser, axis_tokens, T1_MAX_MM_AXIS, &n_axis );
|
||||
|
||||
|
||||
if ( n == 0 )
|
||||
{
|
||||
num_axis = n_axis;
|
||||
|
@ -500,7 +500,7 @@
|
|||
error = T1_Err_Invalid_File_Format;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
/* now, read each axis token into the design position */
|
||||
for ( axis = 0; axis < n_axis; axis++ )
|
||||
{
|
||||
|
@ -512,15 +512,15 @@
|
|||
blend->design_pos[n][axis] = Z1_ToFixed( parser, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
loader->parser.cursor = old_cursor;
|
||||
loader->parser.limit = old_limit;
|
||||
}
|
||||
|
||||
|
||||
Exit:
|
||||
loader->parser.error = error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static
|
||||
void parse_blend_design_map( T1_Face face,
|
||||
|
@ -534,7 +534,7 @@
|
|||
FT_Byte* old_cursor;
|
||||
FT_Byte* old_limit;
|
||||
FT_Memory memory = face->root.memory;
|
||||
|
||||
|
||||
|
||||
Z1_ToTokenArray( parser, axis_tokens, T1_MAX_MM_AXIS, &num_axis );
|
||||
if ( num_axis <= 0 || num_axis > T1_MAX_MM_AXIS )
|
||||
|
@ -546,29 +546,29 @@
|
|||
}
|
||||
old_cursor = parser->cursor;
|
||||
old_limit = parser->limit;
|
||||
|
||||
|
||||
error = t1_allocate_blend( face, 0, num_axis );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
blend = face->blend;
|
||||
|
||||
|
||||
/* now, read each axis design map */
|
||||
for ( n = 0; n < num_axis; n++ )
|
||||
{
|
||||
T1_DesignMap* map = blend->design_map + n;
|
||||
Z1_Token_Rec* token;
|
||||
FT_Int p, num_points;
|
||||
|
||||
|
||||
|
||||
token = axis_tokens + n;
|
||||
parser->cursor = token->start;
|
||||
parser->limit = token->limit;
|
||||
|
||||
|
||||
/* count the number of map points */
|
||||
{
|
||||
FT_Byte* p = token->start;
|
||||
FT_Byte* limit = token->limit;
|
||||
|
||||
|
||||
|
||||
num_points = 0;
|
||||
for ( ; p < limit; p++ )
|
||||
|
@ -581,27 +581,27 @@
|
|||
error = T1_Err_Invalid_File_Format;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
/* allocate design map data */
|
||||
if ( ALLOC_ARRAY( map->design_points, num_points * 2, FT_Fixed ) )
|
||||
goto Exit;
|
||||
map->blend_points = map->design_points + num_points;
|
||||
map->num_points = (FT_Byte)num_points;
|
||||
|
||||
|
||||
for ( p = 0; p < num_points; p++ )
|
||||
{
|
||||
map->design_points[p] = Z1_ToInt( parser );
|
||||
map->blend_points [p] = Z1_ToFixed( parser, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
parser->cursor = old_cursor;
|
||||
parser->limit = old_limit;
|
||||
|
||||
Exit:
|
||||
parser->error = error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static
|
||||
void parse_weight_vector( T1_Face face,
|
||||
|
@ -614,7 +614,7 @@
|
|||
FT_UInt n;
|
||||
FT_Byte* old_cursor;
|
||||
FT_Byte* old_limit;
|
||||
|
||||
|
||||
|
||||
if ( !blend || blend->num_designs == 0 )
|
||||
{
|
||||
|
@ -622,7 +622,7 @@
|
|||
error = T1_Err_Invalid_File_Format;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
Z1_ToToken( parser, &master );
|
||||
if ( master.type != t1_token_array )
|
||||
{
|
||||
|
@ -630,10 +630,10 @@
|
|||
error = T1_Err_Invalid_File_Format;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
old_cursor = parser->cursor;
|
||||
old_limit = parser->limit;
|
||||
|
||||
|
||||
parser->cursor = master.start;
|
||||
parser->limit = master.limit;
|
||||
|
||||
|
@ -642,14 +642,14 @@
|
|||
blend->default_weight_vector[n] =
|
||||
blend->weight_vector[n] = Z1_ToFixed( parser, 0 );
|
||||
}
|
||||
|
||||
|
||||
parser->cursor = old_cursor;
|
||||
parser->limit = old_limit;
|
||||
|
||||
Exit:
|
||||
parser->error = error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* the keyword `/shareddict' appears in some multiple master fonts */
|
||||
/* with a lot of Postscript garbage behind it (that's completely out */
|
||||
|
@ -660,9 +660,9 @@
|
|||
Z1_Loader* loader )
|
||||
{
|
||||
Z1_Parser* parser = &loader->parser;
|
||||
|
||||
|
||||
FT_UNUSED( face );
|
||||
|
||||
|
||||
|
||||
parser->cursor = parser->limit;
|
||||
parser->error = 0;
|
||||
|
@ -670,7 +670,7 @@
|
|||
|
||||
#endif /* Z1_CONFIG_OPTION_NO_MM_SUPPORT */
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
|
@ -696,12 +696,12 @@
|
|||
static \
|
||||
const Z1_Field_Rec t1_field_ ## _field = \
|
||||
Z1_FIELD_BOOL( T1TYPE, _field );
|
||||
|
||||
|
||||
#define Z1_NEW_NUM( _name, _field ) \
|
||||
static \
|
||||
const Z1_Field_Rec t1_field_ ## _field = \
|
||||
Z1_FIELD_NUM( T1TYPE, _field );
|
||||
|
||||
|
||||
#define Z1_NEW_FIXED( _name, _field ) \
|
||||
static \
|
||||
const Z1_Field_Rec t1_field_ ## _field = \
|
||||
|
@ -711,7 +711,7 @@
|
|||
static \
|
||||
const Z1_Field_Rec t1_field_ ## _field = \
|
||||
Z1_FIELD_NUM_ARRAY( T1TYPE, _field, _count, _max );
|
||||
|
||||
|
||||
#define Z1_NEW_FIXED_TABLE( _name, _field, _max, _count ) \
|
||||
static \
|
||||
const Z1_Field_Rec t1_field_ ## _field = \
|
||||
|
@ -721,7 +721,7 @@
|
|||
static \
|
||||
const Z1_Field_Rec t1_field_ ## _field = \
|
||||
Z1_FIELD_NUM_ARRAY2( T1TYPE, _field, _max );
|
||||
|
||||
|
||||
#define Z1_NEW_FIXED_TABLE2( _name, _field, _max ) \
|
||||
static \
|
||||
const Z1_Field_Rec t1_field_ ## _field = \
|
||||
|
@ -767,18 +767,18 @@
|
|||
t1_keyword_callback = 0,
|
||||
t1_keyword_field,
|
||||
t1_keyword_field_table
|
||||
|
||||
|
||||
} Z1_KeyWord_Type;
|
||||
|
||||
|
||||
|
||||
typedef enum Z1_KeyWord_Location_
|
||||
{
|
||||
t1_keyword_type1 = 0,
|
||||
t1_keyword_font_info,
|
||||
t1_keyword_private
|
||||
|
||||
|
||||
} Z1_KeyWord_Location;
|
||||
|
||||
|
||||
|
||||
typedef struct Z1_KeyWord_
|
||||
{
|
||||
|
@ -800,7 +800,7 @@
|
|||
{ \
|
||||
name, t1_keyword_field, t1_keyword_type1, 0, &t1_field_ ## f \
|
||||
}
|
||||
|
||||
|
||||
#define Z1_KEYWORD_FONTINFO( name, f ) \
|
||||
{ \
|
||||
name, t1_keyword_field, t1_keyword_font_info, 0, &t1_field_ ## f \
|
||||
|
@ -855,7 +855,7 @@
|
|||
void** objects;
|
||||
FT_UInt max_objects;
|
||||
T1_Blend* blend = face->blend;
|
||||
|
||||
|
||||
|
||||
/* if the keyword has a dedicated callback, call it */
|
||||
if ( keyword->type == t1_keyword_callback )
|
||||
|
@ -864,7 +864,7 @@
|
|||
error = loader->parser.error;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
/* now, the keyword is either a simple field, or a table of fields; */
|
||||
/* we are now going to take care of it */
|
||||
switch ( keyword->location )
|
||||
|
@ -880,7 +880,7 @@
|
|||
max_objects = blend->num_designs;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case t1_keyword_private:
|
||||
dummy_object = &face->type1.private_dict;
|
||||
objects = &dummy_object;
|
||||
|
@ -892,23 +892,23 @@
|
|||
max_objects = blend->num_designs;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
dummy_object = &face->type1;
|
||||
objects = &dummy_object;
|
||||
max_objects = 0;
|
||||
}
|
||||
|
||||
|
||||
if ( keyword->type == t1_keyword_field_table )
|
||||
error = Z1_Load_Field_Table( &loader->parser, keyword->field,
|
||||
objects, max_objects, 0 );
|
||||
else
|
||||
error = Z1_Load_Field( &loader->parser, keyword->field,
|
||||
objects, max_objects, 0 );
|
||||
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
|
@ -1392,7 +1392,7 @@
|
|||
#include <type1z/z1tokens.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* now add the special functions... */
|
||||
Z1_KEYWORD_CALLBACK( "FontName", parse_font_name ),
|
||||
Z1_KEYWORD_CALLBACK( "FontBBox", parse_font_bbox ),
|
||||
|
@ -1407,7 +1407,7 @@
|
|||
Z1_KEYWORD_CALLBACK( "BlendAxisTypes", parse_blend_axis_types ),
|
||||
Z1_KEYWORD_CALLBACK( "WeightVector", parse_weight_vector ),
|
||||
Z1_KEYWORD_CALLBACK( "shareddict", parse_shared_dict ),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Z1_KEYWORD_CALLBACK( 0, 0 )
|
||||
};
|
||||
|
@ -1438,27 +1438,27 @@
|
|||
strncmp( (char*)cur, "FontDirectory", 13 ) == 0 )
|
||||
{
|
||||
FT_Byte* cur2;
|
||||
|
||||
|
||||
|
||||
/* skip the `FontDirectory' keyword */
|
||||
cur += 13;
|
||||
cur2 = cur;
|
||||
|
||||
|
||||
/* lookup the `known' keyword */
|
||||
while ( cur < limit && *cur != 'k' &&
|
||||
strncmp( (char*)cur, "known", 5 ) )
|
||||
cur++;
|
||||
|
||||
|
||||
if ( cur < limit )
|
||||
{
|
||||
Z1_Token_Rec token;
|
||||
|
||||
|
||||
|
||||
/* skip the `known' keyword and the token following it */
|
||||
cur += 5;
|
||||
loader->parser.cursor = cur;
|
||||
Z1_ToToken( &loader->parser, &token );
|
||||
|
||||
|
||||
/* if the last token was an array, skip it! */
|
||||
if ( token.type == t1_token_array )
|
||||
cur2 = parser->cursor;
|
||||
|
@ -1489,17 +1489,17 @@
|
|||
{
|
||||
/* now, compare the immediate name to the keyword table */
|
||||
Z1_KeyWord* keyword = (Z1_KeyWord*)t1_keywords;
|
||||
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
FT_Byte* name;
|
||||
|
||||
|
||||
|
||||
name = (FT_Byte*)keyword->name;
|
||||
if ( !name )
|
||||
break;
|
||||
|
||||
|
||||
if ( cur[0] == name[0] &&
|
||||
len == (FT_Int)strlen( (const char*)name ) )
|
||||
{
|
||||
|
@ -1509,7 +1509,7 @@
|
|||
for ( n = 1; n < len; n++ )
|
||||
if ( cur[n] != name[n] )
|
||||
break;
|
||||
|
||||
|
||||
if ( n >= len )
|
||||
{
|
||||
/* we found it -- run the parsing callback! */
|
||||
|
@ -1518,7 +1518,7 @@
|
|||
parser->error = t1_load_keyword( face, loader, keyword );
|
||||
if ( parser->error )
|
||||
return parser->error;
|
||||
|
||||
|
||||
cur = parser->cursor;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -425,15 +425,15 @@
|
|||
while ( parser->cursor < parser->limit )
|
||||
{
|
||||
Z1_Token_Rec token;
|
||||
|
||||
|
||||
|
||||
Z1_ToToken( parser, &token );
|
||||
if ( !token.type )
|
||||
break;
|
||||
|
||||
|
||||
if ( cur < limit )
|
||||
*cur = token;
|
||||
|
||||
|
||||
cur++;
|
||||
}
|
||||
|
||||
|
@ -867,17 +867,17 @@
|
|||
{
|
||||
FT_Memory memory = parser->memory;
|
||||
FT_UInt len = limit-cur;
|
||||
|
||||
|
||||
if ( ALLOC( string, len + 1 ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
MEM_Copy( string, cur, len );
|
||||
string[len] = 0;
|
||||
string[len] = 0;
|
||||
|
||||
*(FT_String**)q = string;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
/* an error occured */
|
||||
goto Fail;
|
||||
|
@ -915,7 +915,7 @@
|
|||
FT_Byte* old_cursor;
|
||||
FT_Byte* old_limit;
|
||||
Z1_Field_Rec fieldrec = *(Z1_Field_Rec*)field;
|
||||
|
||||
|
||||
|
||||
Z1_ToTokenArray( parser, elements, 32, &num_elements );
|
||||
if ( num_elements < 0 )
|
||||
|
@ -942,7 +942,7 @@
|
|||
|
||||
if ( pflags )
|
||||
*pflags |= 1L << field->flag_bit;
|
||||
|
||||
|
||||
parser->cursor = old_cursor;
|
||||
parser->limit = old_limit;
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@
|
|||
t1_token_any,
|
||||
t1_token_string,
|
||||
t1_token_array,
|
||||
|
||||
|
||||
/* do not remove */
|
||||
t1_token_max
|
||||
|
||||
|
||||
} Z1_Token_Type;
|
||||
|
||||
|
||||
|
@ -46,8 +46,8 @@
|
|||
FT_Byte* start; /* first character of token in input stream */
|
||||
FT_Byte* limit; /* first character after the token */
|
||||
Z1_Token_Type type; /* type of token.. */
|
||||
|
||||
} Z1_Token_Rec;
|
||||
|
||||
} Z1_Token_Rec;
|
||||
|
||||
|
||||
/* enumeration type used to identify object fields */
|
||||
|
@ -60,10 +60,10 @@
|
|||
t1_field_string,
|
||||
t1_field_integer_array,
|
||||
t1_field_fixed_array,
|
||||
|
||||
|
||||
/* do not remove */
|
||||
t1_field_max
|
||||
|
||||
|
||||
} Z1_Field_Type;
|
||||
|
||||
|
||||
|
@ -76,7 +76,7 @@
|
|||
FT_UInt array_max; /* maximum number of elements for array */
|
||||
FT_UInt count_offset; /* offset of element count for arrays */
|
||||
FT_Int flag_bit; /* bit number for field flag */
|
||||
|
||||
|
||||
} Z1_Field_Rec;
|
||||
|
||||
|
||||
|
|
|
@ -114,10 +114,10 @@
|
|||
{
|
||||
if ( font->fnt_frame )
|
||||
RELEASE_Frame( font->fnt_frame );
|
||||
|
||||
|
||||
font->fnt_size = 0;
|
||||
font->fnt_frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
|
@ -126,7 +126,7 @@
|
|||
{
|
||||
FT_Error error;
|
||||
WinFNT_Header* header = &font->header;
|
||||
|
||||
|
||||
|
||||
/* first of all, read the FNT header */
|
||||
if ( FILE_Seek( font->offset ) ||
|
||||
|
@ -160,7 +160,7 @@
|
|||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
|
@ -170,11 +170,11 @@
|
|||
FT_Stream stream = FT_FACE(face)->stream;
|
||||
FNT_Font* cur = face->fonts;
|
||||
FNT_Font* limit = cur + face->num_fonts;
|
||||
|
||||
|
||||
|
||||
for ( ; cur < limit; cur++ )
|
||||
fnt_done_font( stream, cur );
|
||||
|
||||
|
||||
FREE( face->fonts );
|
||||
face->num_fonts = 0;
|
||||
}
|
||||
|
@ -201,49 +201,49 @@
|
|||
{
|
||||
/* yes, now look for a NE header in the file */
|
||||
WinNE_Header ne_header;
|
||||
|
||||
|
||||
|
||||
if ( FILE_Seek( mz_header.lfanew ) ||
|
||||
READ_Fields( winne_header_fields, &ne_header ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
error = FT_Err_Unknown_File_Format;
|
||||
if ( ne_header.magic == WINFNT_NE_MAGIC )
|
||||
{
|
||||
/* good, now look in the resource table for each FNT resource */
|
||||
FT_ULong res_offset = mz_header.lfanew +
|
||||
ne_header.resource_tab_offset;
|
||||
|
||||
|
||||
FT_UShort size_shift;
|
||||
FT_UShort font_count = 0;
|
||||
FT_ULong font_offset = 0;
|
||||
|
||||
|
||||
|
||||
if ( FILE_Seek( res_offset ) ||
|
||||
ACCESS_Frame( ne_header.rname_tab_offset -
|
||||
ne_header.resource_tab_offset ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
size_shift = GET_UShortLE();
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
FT_UShort type_id, count;
|
||||
|
||||
|
||||
|
||||
type_id = GET_UShortLE();
|
||||
if ( !type_id )
|
||||
break;
|
||||
|
||||
|
||||
count = GET_UShortLE();
|
||||
|
||||
|
||||
if ( type_id == 0x8008 )
|
||||
{
|
||||
font_count = count;
|
||||
font_offset = FILE_Pos() + 4 + ( stream->cursor - stream->limit );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
stream->cursor += 4 + count * 12;
|
||||
}
|
||||
FORGET_Frame();
|
||||
|
@ -253,22 +253,22 @@
|
|||
FT_TRACE2(( "this file doesn't contain any FNT resources!\n" ));
|
||||
error = FT_Err_Unknown_File_Format;
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ( FILE_Seek( font_offset ) ||
|
||||
ALLOC_ARRAY( face->fonts, font_count, FNT_Font ) )
|
||||
ALLOC_ARRAY( face->fonts, font_count, FNT_Font ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
face->num_fonts = font_count;
|
||||
|
||||
|
||||
if ( ACCESS_Frame( (FT_Long)font_count * 12 ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
/* now read the offset and position of each FNT font */
|
||||
{
|
||||
FNT_Font* cur = face->fonts;
|
||||
FNT_Font* limit = cur + font_count;
|
||||
|
||||
|
||||
|
||||
for ( ; cur < limit; cur++ )
|
||||
{
|
||||
|
@ -279,12 +279,12 @@
|
|||
}
|
||||
}
|
||||
FORGET_Frame();
|
||||
|
||||
|
||||
/* finally, try to load each font there */
|
||||
{
|
||||
FNT_Font* cur = face->fonts;
|
||||
FNT_Font* limit = cur + font_count;
|
||||
|
||||
|
||||
|
||||
for ( ; cur < limit; cur++ )
|
||||
{
|
||||
|
@ -309,15 +309,15 @@
|
|||
void FNT_Done_Face( FNT_Face face )
|
||||
{
|
||||
FT_Memory memory = FT_FACE_MEMORY( face );
|
||||
|
||||
|
||||
|
||||
fnt_done_fonts( face );
|
||||
|
||||
|
||||
FREE( face->root.available_sizes );
|
||||
face->root.num_fixed_sizes = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static
|
||||
FT_Error FNT_Init_Face( FT_Stream stream,
|
||||
FNT_Face face,
|
||||
|
@ -327,11 +327,11 @@
|
|||
{
|
||||
FT_Error error;
|
||||
FT_Memory memory = FT_FACE_MEMORY( face );
|
||||
|
||||
|
||||
FT_UNUSED( num_params );
|
||||
FT_UNUSED( params );
|
||||
FT_UNUSED( face_index );
|
||||
|
||||
|
||||
|
||||
/* try to load several fonts from a DLL */
|
||||
error = fnt_get_dll_fonts( face );
|
||||
|
@ -340,23 +340,23 @@
|
|||
/* this didn't work, now try to load a single FNT font */
|
||||
FT_Memory memory = FT_FACE_MEMORY( face );
|
||||
FNT_Font* font;
|
||||
|
||||
|
||||
if ( ALLOC( face->fonts, sizeof ( *face->fonts ) ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
face->num_fonts = 1;
|
||||
font = face->fonts;
|
||||
|
||||
|
||||
font->offset = 0;
|
||||
font->fnt_size = stream->size;
|
||||
|
||||
|
||||
error = fnt_load_font( stream, font );
|
||||
if ( error )
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
/* all right, one or more fonts were loaded; we now need to */
|
||||
/* fill the root FT_Face fields with relevant information */
|
||||
/* fill the root FT_Face fields with relevant information */
|
||||
{
|
||||
FT_Face root = FT_FACE( face );
|
||||
FNT_Font* fonts = face->fonts;
|
||||
|
@ -370,10 +370,10 @@
|
|||
|
||||
if ( fonts->header.avg_width == fonts->header.max_width )
|
||||
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
||||
|
||||
|
||||
if ( fonts->header.italic )
|
||||
root->style_flags |= FT_STYLE_FLAG_ITALIC;
|
||||
|
||||
|
||||
if ( fonts->header.weight >= 800 )
|
||||
root->style_flags |= FT_STYLE_FLAG_BOLD;
|
||||
|
||||
|
@ -382,11 +382,11 @@
|
|||
FT_Bitmap_Size ) )
|
||||
goto Fail;
|
||||
|
||||
root->num_fixed_sizes = face->num_fonts;
|
||||
|
||||
root->num_fixed_sizes = face->num_fonts;
|
||||
|
||||
{
|
||||
FT_Bitmap_Size* size = root->available_sizes;
|
||||
|
||||
|
||||
|
||||
for ( cur = fonts; cur < limit; cur++, size++ )
|
||||
{
|
||||
|
@ -394,7 +394,7 @@
|
|||
size->height = cur->header.pixel_height;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Setup the `charmaps' array */
|
||||
root->charmaps = &face->charmap_handle;
|
||||
root->num_charmaps = 1;
|
||||
|
@ -403,15 +403,15 @@
|
|||
face->charmap.platform_id = 3;
|
||||
face->charmap.encoding_id = 1;
|
||||
face->charmap.face = root;
|
||||
|
||||
|
||||
face->charmap_handle = &face->charmap;
|
||||
|
||||
|
||||
root->charmap = face->charmap_handle;
|
||||
|
||||
/* setup remaining flags */
|
||||
/* setup remaining flags */
|
||||
root->num_glyphs = fonts->header.last_char -
|
||||
fonts->header.first_char + 1;
|
||||
|
||||
|
||||
root->family_name = (FT_String*)fonts->fnt_frame +
|
||||
fonts->header.face_name_offset;
|
||||
root->style_name = "Regular";
|
||||
|
@ -426,14 +426,14 @@
|
|||
else if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
|
||||
root->style_name = "Italic";
|
||||
}
|
||||
|
||||
|
||||
Fail:
|
||||
if ( error )
|
||||
FNT_Done_Face( face );
|
||||
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
|
@ -454,10 +454,10 @@
|
|||
{
|
||||
size->font = cur;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ( size->font ? FT_Err_Ok : FT_Err_Invalid_Argument );
|
||||
return ( size->font ? FT_Err_Ok : FT_Err_Invalid_Argument );
|
||||
}
|
||||
|
||||
|
||||
|
@ -466,14 +466,14 @@
|
|||
FT_ULong char_code )
|
||||
{
|
||||
FT_UInt result = char_code;
|
||||
|
||||
|
||||
|
||||
if ( charmap )
|
||||
{
|
||||
FNT_Font* font = ((FNT_Face)charmap->face)->fonts;
|
||||
FT_UInt first = font->header.first_char;
|
||||
FT_UInt count = font->header.last_char - first + 1;
|
||||
|
||||
|
||||
|
||||
char_code -= first;
|
||||
if ( char_code < count )
|
||||
|
@ -499,11 +499,11 @@
|
|||
FT_Bitmap* bitmap = &slot->bitmap;
|
||||
FT_ULong offset;
|
||||
FT_Bool new_format;
|
||||
|
||||
|
||||
FT_UNUSED( slot );
|
||||
FT_UNUSED( load_flags );
|
||||
|
||||
|
||||
|
||||
if ( !font )
|
||||
{
|
||||
error = FT_Err_Invalid_Argument;
|
||||
|
@ -513,61 +513,61 @@
|
|||
new_format = font->header.version == 0x300;
|
||||
len = new_format ? 6 : 4;
|
||||
|
||||
/* jump to glyph entry */
|
||||
/* jump to glyph entry */
|
||||
p = font->fnt_frame + 118 + len * glyph_index;
|
||||
|
||||
|
||||
bitmap->width = NEXT_ShortLE(p);
|
||||
|
||||
|
||||
if ( new_format )
|
||||
offset = NEXT_ULongLE(p);
|
||||
else
|
||||
offset = NEXT_UShortLE(p);
|
||||
|
||||
|
||||
/* jump to glyph data */
|
||||
p = font->fnt_frame + /* font->header.bits_offset */ + offset;
|
||||
|
||||
|
||||
/* allocate and build bitmap */
|
||||
{
|
||||
FT_Memory memory = FT_FACE_MEMORY( slot->face );
|
||||
FT_Int pitch = ( bitmap->width + 7 ) >> 3;
|
||||
FT_Byte* column;
|
||||
FT_Byte* write;
|
||||
|
||||
|
||||
|
||||
bitmap->pitch = pitch;
|
||||
bitmap->rows = font->header.pixel_height;
|
||||
bitmap->pixel_mode = ft_pixel_mode_mono;
|
||||
|
||||
|
||||
if ( ALLOC( bitmap->buffer, pitch * bitmap->rows ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
column = (FT_Byte*)bitmap->buffer;
|
||||
|
||||
for ( ; pitch > 0; pitch--, column++ )
|
||||
{
|
||||
FT_Byte* limit = p + bitmap->rows;
|
||||
|
||||
|
||||
|
||||
for ( write = column; p < limit; p++, write += bitmap->pitch )
|
||||
write[0] = p[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
slot->flags = ft_glyph_own_bitmap;
|
||||
slot->bitmap_left = 0;
|
||||
slot->bitmap_top = font->header.ascent;
|
||||
slot->format = ft_glyph_format_bitmap;
|
||||
|
||||
|
||||
/* now set up metrics */
|
||||
slot->metrics.horiAdvance = bitmap->width << 6;
|
||||
slot->metrics.horiBearingX = 0;
|
||||
slot->metrics.horiBearingY = slot->bitmap_top << 6;
|
||||
|
||||
slot->linearHoriAdvance = (FT_Fixed)bitmap->width << 16;
|
||||
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const FT_Driver_Class winfnt_driver_class =
|
||||
|
@ -575,22 +575,22 @@
|
|||
{
|
||||
ft_module_font_driver,
|
||||
sizeof ( FT_DriverRec ),
|
||||
|
||||
|
||||
"winfonts",
|
||||
0x10000L,
|
||||
0x20000L,
|
||||
|
||||
|
||||
0,
|
||||
|
||||
|
||||
(FT_Module_Constructor)0,
|
||||
(FT_Module_Destructor) 0,
|
||||
(FT_Module_Requester) 0
|
||||
},
|
||||
|
||||
|
||||
sizeof( FNT_FaceRec ),
|
||||
sizeof( FNT_SizeRec ),
|
||||
sizeof( FT_GlyphSlotRec ),
|
||||
|
||||
|
||||
(FTDriver_initFace) FNT_Init_Face,
|
||||
(FTDriver_doneFace) FNT_Done_Face,
|
||||
(FTDriver_initSize) 0,
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
FT_UShort magic;
|
||||
/* skipped content */
|
||||
FT_UShort lfanew;
|
||||
|
||||
|
||||
} WinMZ_Header;
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
|||
/* skipped content */
|
||||
FT_UShort resource_tab_offset;
|
||||
FT_UShort rname_tab_offset;
|
||||
|
||||
|
||||
} WinNE_Header;
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
|||
FT_UShort id;
|
||||
FT_UShort handle;
|
||||
FT_UShort usage;
|
||||
|
||||
|
||||
} WinNameInfo;
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@
|
|||
{
|
||||
FT_UShort type_id;
|
||||
FT_UShort count;
|
||||
|
||||
|
||||
} WinResourceInfo;
|
||||
|
||||
|
||||
|
@ -103,7 +103,7 @@
|
|||
FT_UShort C_space;
|
||||
FT_UShort color_table_offset;
|
||||
FT_Byte reserved2[4];
|
||||
|
||||
|
||||
} WinFNT_Header;
|
||||
|
||||
|
||||
|
@ -111,12 +111,12 @@
|
|||
{
|
||||
FT_ULong offset;
|
||||
FT_Int size_shift;
|
||||
|
||||
|
||||
WinFNT_Header header;
|
||||
|
||||
|
||||
FT_Byte* fnt_frame;
|
||||
FT_ULong fnt_size;
|
||||
|
||||
|
||||
} FNT_Font;
|
||||
|
||||
|
||||
|
@ -124,18 +124,18 @@
|
|||
{
|
||||
FT_SizeRec root;
|
||||
FNT_Font* font;
|
||||
|
||||
|
||||
} FNT_SizeRec, *FNT_Size;
|
||||
|
||||
|
||||
typedef struct FNT_FaceRec_
|
||||
{
|
||||
FT_FaceRec root;
|
||||
|
||||
|
||||
FT_UInt num_fonts;
|
||||
FNT_Font* fonts;
|
||||
|
||||
FT_CharMap charmap_handle;
|
||||
FT_CharMap charmap_handle;
|
||||
FT_CharMapRec charmap; /* a single charmap per face */
|
||||
|
||||
} FNT_FaceRec, *FNT_Face;
|
||||
|
|
Loading…
Reference in New Issue