22 #include FT_WINFONTS_H
23 #include FT_INTERNAL_DEBUG_H
24 #include FT_INTERNAL_STREAM_H
25 #include FT_INTERNAL_OBJECTS_H
26 #include FT_TRUETYPE_IDS_H
30 #include FT_SERVICE_WINFNT_H
31 #include FT_SERVICE_XFREE86_NAME_H
40 #define FT_COMPONENT trace_winfnt
46 #define FT_STRUCTURE WinMZ_HeaderRec
58 #define FT_STRUCTURE WinNE_HeaderRec
71 #define FT_STRUCTURE WinPE32_HeaderRec
91 #define FT_STRUCTURE WinPE32_SectionRec
106 #define FT_STRUCTURE WinPE_RsrcDirRec
121 #define FT_STRUCTURE WinPE_RsrcDirEntryRec
132 #define FT_STRUCTURE WinPE_RsrcDataEntryRec
145 #define FT_STRUCTURE FT_WinFNT_HeaderRec
224 if ( header->
version != 0x200 &&
227 FT_TRACE2((
" not a Windows FNT file\n" ));
228 error = FNT_Err_Unknown_File_Format;
233 size = new_format ? 148 : 118;
237 FT_TRACE2((
" not a Windows FNT file\n" ));
238 error = FNT_Err_Unknown_File_Format;
243 if ( header->
version == 0x200 )
255 FT_TRACE2((
"[can't handle vector FNT fonts]\n" ));
256 error = FNT_Err_Unknown_File_Format;
287 error = FNT_Err_Unknown_File_Format;
300 error = FNT_Err_Unknown_File_Format;
304 FT_ULong res_offset = mz_header.lfanew +
331 if ( type_id == 0x8008U )
339 stream->
cursor += 4 + count * 12;
344 if ( !font_count || !font_offset )
346 FT_TRACE2((
"this file doesn't contain any FNT resources\n" ));
347 error = FNT_Err_Invalid_File_Format;
353 if ( font_count * 118UL > stream->
size )
355 FT_TRACE2((
"invalid number of faces\n" ));
356 error = FNT_Err_Invalid_File_Format;
362 if ( face_index >= font_count )
364 error = FNT_Err_Invalid_Argument;
367 else if ( face_index < 0 )
394 FT_Long root_dir_offset, name_dir_offset, lang_dir_offset;
404 FT_TRACE2((
"magic %04lx, machine %02x, number_of_sections %u, "
405 "size_of_optional_header %02x\n"
406 "magic32 %02x, rsrc_virtual_address %04lx, "
415 pe32_header.
machine != 0x014c ||
419 FT_TRACE2((
"this file has an invalid PE header\n" ));
420 error = FNT_Err_Invalid_File_Format;
432 FT_TRACE2((
"name %.8s, va %04lx, size %04lx, offset %04lx\n",
439 goto Found_rsrc_section;
442 FT_TRACE2((
"this file doesn't contain any resources\n" ));
443 error = FNT_Err_Invalid_File_Format;
447 FT_TRACE2((
"found resources section %.8s\n", pe32_section.
name ));
463 if ( !(dir_entry1.
offset & 0x80000000UL ) )
465 error = FNT_Err_Invalid_File_Format;
469 dir_entry1.
offset &= ~0x80000000UL;
487 if ( !(dir_entry2.
offset & 0x80000000UL ) )
489 error = FNT_Err_Invalid_File_Format;
493 dir_entry2.
offset &= ~0x80000000UL;
511 if ( dir_entry2.
offset & 0x80000000UL )
513 error = FNT_Err_Invalid_File_Format;
517 if ( dir_entry1.
name == 8 )
524 FT_TRACE2((
"found font #%lu, offset %04lx, "
525 "size %04lx, cp %lu\n",
546 dir_entry2.
name, error ));
550 FT_TRACE2((
"font #%lu successfully loaded\n",
563 FT_TRACE2((
"this file doesn't contain any RT_FONT resources\n" ));
564 error = FNT_Err_Invalid_File_Format;
570 error = FNT_Err_Invalid_Argument;
584 typedef struct FNT_CMapRec_
609 FT_UInt32 char_code )
614 char_code -= cmap->first;
615 if ( char_code < cmap->
count )
618 gindex = (
FT_UInt)( char_code + 1 );
625 FT_UInt32 *pchar_code )
629 FT_UInt32 char_code = *pchar_code + 1;
632 if ( char_code <= cmap->
first )
634 result = cmap->first;
639 char_code -= cmap->first;
640 if ( char_code < cmap->
count )
642 result = cmap->first + char_code;
643 gindex = (
FT_UInt)( char_code + 1 );
705 if ( !error && face_index < 0 )
708 if ( error == FNT_Err_Unknown_File_Format )
726 if ( face_index > 0 )
727 error = FNT_Err_Invalid_Argument;
728 else if ( face_index < 0 )
795 FT_TRACE2((
"use pixel_height as the nominal height\n" ));
809 charmap.
encoding = FT_ENCODING_NONE;
817 charmap.
encoding = FT_ENCODING_APPLE_ROMAN;
838 FT_TRACE2((
"invalid number of glyphs\n" ));
839 error = FNT_Err_Invalid_File_Format;
849 FT_TRACE2((
"invalid family name offset\n" ));
850 error = FNT_Err_Invalid_File_Format;
933 if (
height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
943 error = FNT_Err_Unimplemented_Feature;
958 FT_Int32 load_flags )
974 error = FNT_Err_Invalid_Argument;
983 error = FNT_Err_Invalid_Argument;
987 if ( glyph_index > 0 )
993 len = new_format ? 6 : 4;
996 p = font->
fnt_frame + ( new_format ? 148 : 118 ) + len * glyph_index;
1008 error = FNT_Err_Invalid_File_Format;
1023 bitmap->
pitch = pitch;
1029 FT_TRACE2((
"invalid bitmap width\n" ));
1030 error = FNT_Err_Invalid_File_Format;
1041 for ( ; pitch > 0; pitch--, column++ )
1046 for ( write = column; p <
limit; p++, write += bitmap->
pitch )
1054 slot->
format = FT_GLYPH_FORMAT_BITMAP;
1060 slot->
metrics.horiBearingX = 0;
1064 bitmap->
rows << 6 );
1144 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
1145 ft_stub_set_char_sizes,
1146 ft_stub_set_pixel_sizes,
#define FT_ALLOC(ptr, size)
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
cannot open resource broken file module version is too low unimplemented feature broken offset within table missing module invalid character code cannot render this glyph format invalid composite glyph invalid pixel size invalid library handle invalid face handle invalid glyph slot handle invalid cache manager handle too many modules out of memory cannot open stream invalid stream skip invalid stream operation nested frame access raster uninitialized raster overflow too many registered caches too few arguments code overflow division by zero found debug opcode nested DEFS execution context too long too many instruction definitions horizontal header(hhea) table missing" ) FT_ERRORDEF_( Locations_Missing
#define FT_SERVICE_ID_WINFNT
ft_synthesize_vertical_metrics(FT_Glyph_Metrics *metrics, FT_Pos advance)
static FT_Error FNT_Face_Init(FT_Stream stream, FT_Face fntface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
FT_Select_Metrics(FT_Face face, FT_ULong strike_index)
struct FNT_CMapRec_ FNT_CMapRec
#define FT_NEXT_ULONG_LE(buffer)
FT_UInt(* FT_CMap_CharIndexFunc)(FT_CMap cmap, FT_UInt32 char_code)
#define FT_REQUEST_HEIGHT(req)
#define FT_XF86_FORMAT_WINFNT
static const FT_Frame_Field winne_header_fields[]
static FT_Error fnt_face_get_dll_font(FNT_Face face, FT_Int face_index)
FT_Bitmap_Size * available_sizes
FT_UInt(* FT_CMap_CharNextFunc)(FT_CMap cmap, FT_UInt32 *achar_code)
EGLSurface EGLint EGLint EGLint EGLint height
#define FT_FACE_FLAG_FIXED_SIZES
static FT_CMap_Class const fnt_cmap_class
struct FT_SizeRec_ FT_SizeRec
FT_BEGIN_HEADER struct WinMZ_HeaderRec_ WinMZ_HeaderRec
EGLImageKHR EGLint * name
#define FT_FRAME_BYTES(field, count)
#define FT_FRAME_ULONG_LE(f)
#define FT_GLYPH_OWN_BITMAP
GLuint GLuint GLfloat weight
FT_ULong size_of_raw_data
FT_BEGIN_HEADER typedef unsigned char FT_Bool
FT_UShort number_of_named_entries
static FT_Error FNT_Size_Request(FT_Size size, FT_Size_Request req)
FT_UShort number_of_id_entries
#define FT_STYLE_FLAG_BOLD
void(* FT_CMap_DoneFunc)(FT_CMap cmap)
#define FT_FRAME_SKIP_BYTES(count)
FT_WinFNT_HeaderRec header
static FT_Error winfnt_get_header(FT_Face face, FT_WinFNT_HeaderRec *aheader)
#define FT_STREAM_READ_FIELDS(fields, object)
static const FT_ServiceDescRec winfnt_services[]
static FT_Error fnt_cmap_init(FNT_CMap cmap)
static const FT_CMap_ClassRec fnt_cmap_class_rec
#define FT_FACE_FLAG_FIXED_WIDTH
static FT_Module_Interface winfnt_get_service(FT_Module module, const FT_String *service_id)
static const FT_Frame_Field winpe32_section_fields[]
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
#define FT_SERVICE_ID_XF86_NAME
#define FT_FACE_FLAG_HORIZONTAL
static FT_Error FNT_Load_Glyph(FT_GlyphSlot slot, FT_Size size, FT_UInt glyph_index, FT_Int32 load_flags)
static void fnt_font_done(FNT_Face face)
static const FT_Frame_Field winmz_header_fields[]
#define FT_GET_USHORT_LE()
FT_Pointer FT_Module_Interface
#define FT_TRACE2(varformat)
GLenum GLenum GLvoid GLvoid * column
static FT_Error fnt_font_load(FNT_Font font, FT_Stream stream)
struct FNT_FaceRec_ * FNT_Face
#define FT_FRAME_USHORT_LE(f)
#define FT_MODULE_FONT_DRIVER
static const FT_Frame_Field winfnt_header_fields[]
#define FT_NEXT_USHORT_LE(buffer)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
static const FT_Frame_Field winpe32_header_fields[]
#define FT_NEW_ARRAY(ptr, count)
static FT_UInt32 fnt_cmap_char_next(FNT_CMap cmap, FT_UInt32 *pchar_code)
#define FT_STREAM_SEEK(position)
FT_Size_Request_Type type
#define FT_FRAME_RELEASE(bytes)
FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec winfnt_driver_class
#define TT_PLATFORM_MACINTOSH
#define FT_FACE_MEMORY(x)
FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
static FT_UInt fnt_cmap_char_index(FNT_CMap cmap, FT_UInt32 char_code)
#define FT_REALLOC(ptr, cursz, newsz)
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
static const FT_Frame_Field winpe_rsrc_data_entry_fields[]
#define FT_NEXT_SHORT_LE(buffer)
FT_Slot_Internal internal
#define FT_FRAME_EXTRACT(size, bytes)
#define FT_ALLOC_MULT(ptr, count, item_size)
FT_Error(* FT_CMap_InitFunc)(FT_CMap cmap, FT_Pointer init_data)
#define TT_PLATFORM_APPLE_UNICODE
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
#define FT_FRAME_ENTER(size)
FT_ULong pointer_to_raw_data
static const FT_Frame_Field winpe_rsrc_dir_entry_fields[]
#define FT_MODULE_DRIVER_NO_OUTLINES
struct FNT_CMapRec_ * FNT_CMap
struct FT_DriverRec_ FT_DriverRec
#define FT_MEM_COPY(dest, source, count)
#define FT_STYLE_FLAG_ITALIC
static const FT_Frame_Field winpe_rsrc_dir_fields[]
static FT_Error FNT_Size_Select(FT_Size size, FT_ULong strike_index)
#define TT_APPLE_ID_DEFAULT
static void FNT_Face_Done(FT_Face fntface)
#define FT_FRAME_START(size)
#define FT_CALLBACK_TABLE_DEF
static const FT_Service_WinFntRec winfnt_service_rec