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_FONT_FORMAT_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
199 if (
font->fnt_frame )
224 if (
header->version != 0x200 &&
225 header->version != 0x300 )
227 FT_TRACE2((
" not a Windows FNT file\n" ));
232 new_format =
FT_BOOL(
font->header.version == 0x300 );
233 size = new_format ? 148 : 118;
237 FT_TRACE2((
" not a Windows FNT file\n" ));
243 if (
header->version == 0x200 )
250 header->color_table_offset = 0;
253 if (
header->file_type & 1 )
255 FT_TRACE2((
"[can't handle vector FNT fonts]\n" ));
272 FT_Int face_instance_index )
283 face_index =
FT_ABS( face_instance_index ) & 0xFFFF;
307 FT_ULong res_offset = mz_header.lfanew +
330 if ( size_shift > 16 )
332 FT_TRACE2((
"invalid alignment shift count for resource data\n" ));
362 if ( !font_count || !font_offset )
364 FT_TRACE2((
"this file doesn't contain any FNT resources\n" ));
373 FT_TRACE2((
"invalid number of faces\n" ));
378 face->root.num_faces = font_count;
380 if ( face_instance_index < 0 )
383 if ( face_index >= font_count )
413 FT_ULong root_dir_offset, name_dir_offset, lang_dir_offset;
423 FT_TRACE2((
"magic %04lx, machine %02x, number_of_sections %u, "
424 "size_of_optional_header %02x\n"
425 "magic32 %02x, rsrc_virtual_address %04lx, "
434 pe32_header.
machine != 0x014C ||
438 FT_TRACE2((
"this file has an invalid PE header\n" ));
443 face->root.num_faces = 0;
451 FT_TRACE2((
"name %.8s, va %04lx, size %04lx, offset %04lx\n",
458 goto Found_rsrc_section;
461 FT_TRACE2((
"this file doesn't contain any resources\n" ));
466 FT_TRACE2((
"found resources section %.8s\n", pe32_section.
name ));
474 for (
i = 0;
i <
root_dir.number_of_named_entries +
482 if ( !(dir_entry1.
offset & 0x80000000UL ) )
488 dir_entry1.
offset &= ~0x80000000UL;
506 if ( !(dir_entry2.
offset & 0x80000000UL ) )
512 dir_entry2.
offset &= ~0x80000000UL;
530 if ( dir_entry2.
offset & 0x80000000UL )
536 if ( dir_entry1.
name == 8 )
543 FT_TRACE2((
"found font #%lu, offset %04lx, "
544 "size %04lx, cp %lu\n",
551 if ( face_index ==
face->root.num_faces )
559 face->font->fnt_size = data_entry.
size;
564 FT_TRACE2((
"font #%lu load error 0x%x\n",
569 FT_TRACE2((
"font #%lu successfully loaded\n",
573 face->root.num_faces++;
580 if ( !
face->root.num_faces )
582 FT_TRACE2((
"this file doesn't contain any RT_FONT resources\n" ));
587 if ( face_index >=
face->root.num_faces )
622 cmap->
first = (FT_UInt32)
font->header.first_char;
623 cmap->
count = (FT_UInt32)(
font->header.last_char - cmap->
first + 1 );
631 FT_UInt32 char_code )
636 char_code -= cmap->
first;
637 if ( char_code < cmap->
count )
640 gindex = (
FT_UInt)( char_code + 1 );
647 FT_UInt32 *pchar_code )
651 FT_UInt32 char_code = *pchar_code + 1;
654 if ( char_code <= cmap->
first )
661 char_code -= cmap->
first;
662 if ( char_code < cmap->
count )
665 gindex = (
FT_UInt)( char_code + 1 );
711 FT_Int face_instance_index,
726 face_index =
FT_ABS( face_instance_index ) & 0xFFFF;
730 if ( !
error && face_instance_index < 0 )
751 if ( face_instance_index < 0 )
754 if ( face_index > 0 )
763 if ( !
face->font->header.pixel_height )
778 root->face_index = face_index;
783 if (
font->header.avg_width ==
font->header.max_width )
786 if (
font->header.italic )
789 if (
font->header.weight >= 800 )
796 root->num_fixed_sizes = 1;
805 font->header.external_leading );
806 bsize->
size =
font->header.nominal_point_size << 6;
808 x_res =
font->header.horizontal_resolution;
812 y_res =
font->header.vertical_resolution;
827 if ( bsize->
y_ppem > (
font->header.pixel_height << 6 ) )
829 FT_TRACE2((
"use pixel_height as the nominal height\n" ));
831 bsize->
y_ppem =
font->header.pixel_height << 6;
843 charmap.
encoding = FT_ENCODING_NONE;
851 charmap.
encoding = FT_ENCODING_APPLE_ROMAN;
866 if (
font->header.last_char <
font->header.first_char )
868 FT_TRACE2((
"invalid number of glyphs\n" ));
874 root->num_glyphs =
font->header.last_char -
875 font->header.first_char + 1 + 1;
877 if (
font->header.face_name_offset >=
font->header.file_size )
879 FT_TRACE2((
"invalid family name offset\n" ));
883 family_size =
font->header.file_size -
font->header.face_name_offset;
892 font->fnt_frame +
font->header.face_name_offset,
895 font->family_name[family_size] =
'\0';
902 root->family_name =
font->family_name;
903 root->style_name = (
char *)
"Regular";
908 root->style_name = (
char *)
"Bold Italic";
910 root->style_name = (
char *)
"Bold";
913 root->style_name = (
char *)
"Italic";
938 size->metrics.descender = -(
header->pixel_height -
940 size->metrics.max_advance =
header->max_width * 64;
963 if (
height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
988 FT_Int32 load_flags )
1015 FT_TRACE1((
"FNT_Load_Glyph: glyph index %d\n", glyph_index ));
1017 if ( glyph_index > 0 )
1020 glyph_index =
font->header.default_char;
1022 new_format =
FT_BOOL(
font->header.version == 0x300 );
1023 len = new_format ? 6 : 4;
1026 offset = ( new_format ? 148 : 118 ) +
len * glyph_index;
1028 if (
offset >=
font->header.file_size - 2 - ( new_format ? 4 : 2 ) )
1055 slot->bitmap_left = 0;
1056 slot->bitmap_top =
font->header.ascent;
1057 slot->format = FT_GLYPH_FORMAT_BITMAP;
1063 slot->metrics.horiBearingX = 0;
1064 slot->metrics.horiBearingY =
slot->bitmap_top << 6;
1087 FT_TRACE2((
"invalid bitmap width\n" ));
1123 *aheader =
font->header;
static const WCHAR version[]
#define TT_APPLE_ID_DEFAULT
#define TT_PLATFORM_MACINTOSH
#define TT_PLATFORM_APPLE_UNICODE
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
static const char root_dir[]
#define FT_STYLE_FLAG_ITALIC
#define FT_FACE_FLAG_FIXED_SIZES
@ FT_SIZE_REQUEST_TYPE_NOMINAL
@ FT_SIZE_REQUEST_TYPE_REAL_DIM
#define FT_LOAD_BITMAP_METRICS_ONLY
#define FT_FACE_FLAG_FIXED_WIDTH
struct FT_GlyphSlotRec_ FT_GlyphSlotRec
#define FT_STYLE_FLAG_BOLD
#define FT_FACE_FLAG_HORIZONTAL
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
#define FT_CALLBACK_TABLE_DEF
#define FT_TRACE2(varformat)
#define FT_TRACE1(varformat)
FT_BEGIN_HEADER typedef signed long FT_Pos
#define FT_ALLOC_MULT(ptr, count, item_size)
#define FT_REALLOC(ptr, cursz, newsz)
#define FT_NEW_ARRAY(ptr, count)
#define FT_ALLOC(ptr, size)
#define FT_MEM_COPY(dest, source, count)
#define FT_MODULE_FONT_DRIVER
#define FT_MODULE_DRIVER_NO_OUTLINES
FT_UInt(* FT_CMap_CharNextFunc)(FT_CMap cmap, FT_UInt32 *achar_code)
ft_synthesize_vertical_metrics(FT_Glyph_Metrics *metrics, FT_Pos advance)
FT_Select_Metrics(FT_Face face, FT_ULong strike_index)
struct FT_DriverRec_ FT_DriverRec
#define FT_REQUEST_HEIGHT(req)
#define FT_FACE_MEMORY(x)
FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
#define FT_GLYPH_OWN_BITMAP
FT_Error(* FT_CMap_InitFunc)(FT_CMap cmap, FT_Pointer init_data)
void(* FT_CMap_DoneFunc)(FT_CMap cmap)
FT_UInt(* FT_CMap_CharIndexFunc)(FT_CMap cmap, FT_UInt32 char_code)
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
#define FT_FRAME_ENTER(size)
#define FT_NEXT_ULONG_LE(buffer)
#define FT_NEXT_USHORT_LE(buffer)
#define FT_FRAME_RELEASE(bytes)
#define FT_STREAM_SEEK(position)
#define FT_GET_USHORT_LE()
#define FT_FRAME_SKIP_BYTES(count)
#define FT_FRAME_USHORT_LE(f)
#define FT_FRAME_EXTRACT(size, bytes)
#define FT_FRAME_ULONG_LE(f)
#define FT_STREAM_READ_FIELDS(fields, object)
#define FT_FRAME_BYTES(field, count)
#define FT_FRAME_START(size)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
FT_BEGIN_HEADER typedef unsigned char FT_Bool
GLuint GLuint GLsizei count
GLint GLint GLsizei GLsizei height
GLsizei const GLvoid * pointer
GLenum GLuint GLint GLenum face
GLenum const GLfloat * params
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
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 GLint GLint j
static char memory[1024 *256]
static const char machine[]
static unsigned int file_size
FD_TYPE file_type(FDSC **curr, char *fixed)
FT_Bitmap_Size * available_sizes
FT_Size_Request_Type type
FT_ULong size_of_raw_data
FT_ULong pointer_to_raw_data
FT_UShort number_of_id_entries
FT_UShort number_of_named_entries
#define FT_SERVICE_ID_FONT_FORMAT
#define FT_FONT_FORMAT_WINFNT
#define FT_SERVICE_ID_WINFNT
static FT_Error FNT_Load_Glyph(FT_GlyphSlot slot, FT_Size size, FT_UInt glyph_index, FT_Int32 load_flags)
static const FT_Frame_Field winpe_rsrc_dir_fields[]
FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec winfnt_driver_class
static FT_Module_Interface winfnt_get_service(FT_Module module, const FT_String *service_id)
static const FT_Frame_Field winne_header_fields[]
static FT_Error fnt_font_load(FNT_Font font, FT_Stream stream)
struct FNT_CMapRec_ FNT_CMapRec
static const FT_Frame_Field winpe32_header_fields[]
static FT_Error fnt_cmap_init(FNT_CMap cmap, FT_Pointer pointer)
static void fnt_font_done(FNT_Face face)
static FT_Error winfnt_get_header(FT_Face face, FT_WinFNT_HeaderRec *aheader)
static FT_UInt32 fnt_cmap_char_next(FNT_CMap cmap, FT_UInt32 *pchar_code)
static const FT_Frame_Field winpe32_section_fields[]
static FT_CMap_Class const fnt_cmap_class
static const FT_Service_WinFntRec winfnt_service_rec
static const FT_Frame_Field winmz_header_fields[]
static const FT_Frame_Field winfnt_header_fields[]
static FT_Error FNT_Size_Select(FT_Size size, FT_ULong strike_index)
static FT_Error FNT_Face_Init(FT_Stream stream, FT_Face fntface, FT_Int face_instance_index, FT_Int num_params, FT_Parameter *params)
static FT_Error FNT_Size_Request(FT_Size size, FT_Size_Request req)
static const FT_CMap_ClassRec fnt_cmap_class_rec
static const FT_Frame_Field winpe_rsrc_data_entry_fields[]
struct FNT_CMapRec_ * FNT_CMap
static const FT_Frame_Field winpe_rsrc_dir_entry_fields[]
static FT_UInt fnt_cmap_char_index(FNT_CMap cmap, FT_UInt32 char_code)
static void FNT_Face_Done(FT_Face fntface)
static FT_Error fnt_face_get_dll_font(FNT_Face face, FT_Int face_instance_index)
static const FT_ServiceDescRec winfnt_services[]
FT_BEGIN_HEADER struct WinMZ_HeaderRec_ WinMZ_HeaderRec
struct FNT_FaceRec_ FNT_FaceRec
struct FNT_FaceRec_ * FNT_Face