39#define FT_COMPONENT winfnt
45#define FT_STRUCTURE WinMZ_HeaderRec
57#define FT_STRUCTURE WinNE_HeaderRec
70#define FT_STRUCTURE WinPE32_HeaderRec
90#define FT_STRUCTURE WinPE32_SectionRec
105#define FT_STRUCTURE WinPE_RsrcDirRec
120#define FT_STRUCTURE WinPE_RsrcDirEntryRec
131#define FT_STRUCTURE WinPE_RsrcDataEntryRec
144#define FT_STRUCTURE FT_WinFNT_HeaderRec
198 if (
font->fnt_frame )
223 if (
header->version != 0x200 &&
224 header->version != 0x300 )
226 FT_TRACE2((
" not a Windows FNT file\n" ));
231 new_format =
FT_BOOL(
font->header.version == 0x300 );
232 size = new_format ? 148 : 118;
236 FT_TRACE2((
" not a Windows FNT file\n" ));
242 if (
header->version == 0x200 )
249 header->color_table_offset = 0;
252 if (
header->file_type & 1 )
254 FT_TRACE2((
"[can't handle vector FNT fonts]\n" ));
271 FT_Int face_instance_index )
282 face_index =
FT_ABS( face_instance_index ) & 0xFFFF;
306 FT_ULong res_offset = mz_header.lfanew +
329 if ( size_shift > 16 )
331 FT_TRACE2((
"invalid alignment shift count for resource data\n" ));
361 if ( !font_count || !font_offset )
363 FT_TRACE2((
"this file doesn't contain any FNT resources\n" ));
372 FT_TRACE2((
"invalid number of faces\n" ));
377 face->root.num_faces = font_count;
379 if ( face_instance_index < 0 )
382 if ( face_index >= font_count )
412 FT_ULong root_dir_offset, name_dir_offset, lang_dir_offset;
422 FT_TRACE2((
"magic %04lx, machine %02x, number_of_sections %u, "
423 "size_of_optional_header %02x\n"
424 "magic32 %02x, rsrc_virtual_address %04lx, "
433 pe32_header.
machine != 0x014C ||
437 FT_TRACE2((
"this file has an invalid PE header\n" ));
442 face->root.num_faces = 0;
450 FT_TRACE2((
"name %.8s, va %04lx, size %04lx, offset %04lx\n",
457 goto Found_rsrc_section;
460 FT_TRACE2((
"this file doesn't contain any resources\n" ));
465 FT_TRACE2((
"found resources section %.8s\n", pe32_section.
name ));
473 for (
i = 0;
i <
root_dir.number_of_named_entries +
481 if ( !(dir_entry1.
offset & 0x80000000UL ) )
487 dir_entry1.
offset &= ~0x80000000UL;
505 if ( !(dir_entry2.
offset & 0x80000000UL ) )
511 dir_entry2.
offset &= ~0x80000000UL;
529 if ( dir_entry2.
offset & 0x80000000UL )
535 if ( dir_entry1.
name == 8 )
542 FT_TRACE2((
"found font #%lu, offset %04lx, "
543 "size %04lx, cp %lu\n",
550 if ( face_index ==
face->root.num_faces )
558 face->font->fnt_size = data_entry.
size;
563 FT_TRACE2((
"font #%lu load error 0x%x\n",
568 FT_TRACE2((
"font #%lu successfully loaded\n",
572 face->root.num_faces++;
579 if ( !
face->root.num_faces )
581 FT_TRACE2((
"this file doesn't contain any RT_FONT resources\n" ));
586 if ( face_index >=
face->root.num_faces )
625 cmap->
first = (FT_UInt32)
font->header.first_char;
626 cmap->
count = (FT_UInt32)(
font->header.last_char - cmap->
first + 1 );
634 FT_UInt32 char_code )
639 char_code -= cmap->
first;
640 if ( char_code < cmap->
count )
643 gindex = (
FT_UInt)( char_code + 1 );
650 FT_UInt32 *pchar_code )
654 FT_UInt32 char_code = *pchar_code + 1;
657 if ( char_code <= cmap->
first )
664 char_code -= cmap->
first;
665 if ( char_code < cmap->
count )
668 gindex = (
FT_UInt)( char_code + 1 );
714 FT_Int face_instance_index,
729 face_index =
FT_ABS( face_instance_index ) & 0xFFFF;
733 if ( !
error && face_instance_index < 0 )
754 if ( face_instance_index < 0 )
757 if ( face_index > 0 )
766 if ( !
face->font->header.pixel_height )
781 root->face_index = face_index;
786 if (
font->header.avg_width ==
font->header.max_width )
789 if (
font->header.italic )
792 if (
font->header.weight >= 800 )
799 root->num_fixed_sizes = 1;
808 font->header.external_leading );
809 bsize->
size =
font->header.nominal_point_size << 6;
811 x_res =
font->header.horizontal_resolution;
815 y_res =
font->header.vertical_resolution;
830 if ( bsize->
y_ppem > (
font->header.pixel_height << 6 ) )
832 FT_TRACE2((
"use pixel_height as the nominal height\n" ));
834 bsize->
y_ppem =
font->header.pixel_height << 6;
846 charmap.
encoding = FT_ENCODING_NONE;
854 charmap.
encoding = FT_ENCODING_APPLE_ROMAN;
869 if (
font->header.last_char <
font->header.first_char )
871 FT_TRACE2((
"invalid number of glyphs\n" ));
877 root->num_glyphs =
font->header.last_char -
878 font->header.first_char + 1 + 1;
880 if (
font->header.face_name_offset >=
font->header.file_size )
882 FT_TRACE2((
"invalid family name offset\n" ));
886 family_size =
font->header.file_size -
font->header.face_name_offset;
895 font->fnt_frame +
font->header.face_name_offset,
898 font->family_name[family_size] =
'\0';
905 root->family_name =
font->family_name;
906 root->style_name = (
char *)
"Regular";
911 root->style_name = (
char *)
"Bold Italic";
913 root->style_name = (
char *)
"Bold";
916 root->style_name = (
char *)
"Italic";
941 size->metrics.descender = -(
header->pixel_height -
943 size->metrics.max_advance =
header->max_width * 64;
966 if (
height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
991 FT_Int32 load_flags )
1018 FT_TRACE1((
"FNT_Load_Glyph: glyph index %d\n", glyph_index ));
1020 if ( glyph_index > 0 )
1023 glyph_index =
font->header.default_char;
1025 new_format =
FT_BOOL(
font->header.version == 0x300 );
1026 len = new_format ? 6 : 4;
1029 offset = ( new_format ? 148 : 118 ) +
len * glyph_index;
1031 if (
offset >=
font->header.file_size - 2 - ( new_format ? 4 : 2 ) )
1058 slot->bitmap_left = 0;
1059 slot->bitmap_top =
font->header.ascent;
1060 slot->format = FT_GLYPH_FORMAT_BITMAP;
1066 slot->metrics.horiBearingX = 0;
1067 slot->metrics.horiBearingY =
slot->bitmap_top << 6;
1090 FT_TRACE2((
"invalid bitmap width\n" ));
1126 *aheader =
font->header;
#define FT_CALLBACK_TABLE_DEF
_Out_opt_ UINT * code_page
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_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