ReactOS 0.4.16-dev-2332-g4cba65d
winfnt.c
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * winfnt.c
4 *
5 * FreeType font driver for Windows FNT/FON files
6 *
7 * Copyright (C) 1996-2020 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
9 * Copyright 2003 Huw D M Davies for Codeweavers
10 * Copyright 2007 Dmitry Timoshkov for Codeweavers
11 *
12 * This file is part of the FreeType project, and may only be used,
13 * modified, and distributed under the terms of the FreeType project
14 * license, LICENSE.TXT. By continuing to use, modify, or distribute
15 * this file you indicate that you have read the license and
16 * understand and accept it fully.
17 *
18 */
19
20
21#include <freetype/ftwinfnt.h>
25#include <freetype/ttnameid.h>
26
27#include "winfnt.h"
28#include "fnterrs.h"
31
32 /**************************************************************************
33 *
34 * The macro FT_COMPONENT is used in trace mode. It is an implicit
35 * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
36 * messages during execution.
37 */
38#undef FT_COMPONENT
39#define FT_COMPONENT winfnt
40
41
43 {
44#undef FT_STRUCTURE
45#define FT_STRUCTURE WinMZ_HeaderRec
46
47 FT_FRAME_START( 64 ),
48 FT_FRAME_USHORT_LE ( magic ),
49 FT_FRAME_SKIP_BYTES( 29 * 2 ),
50 FT_FRAME_ULONG_LE ( lfanew ),
52 };
53
55 {
56#undef FT_STRUCTURE
57#define FT_STRUCTURE WinNE_HeaderRec
58
59 FT_FRAME_START( 40 ),
60 FT_FRAME_USHORT_LE ( magic ),
62 FT_FRAME_USHORT_LE ( resource_tab_offset ),
63 FT_FRAME_USHORT_LE ( rname_tab_offset ),
65 };
66
68 {
69#undef FT_STRUCTURE
70#define FT_STRUCTURE WinPE32_HeaderRec
71
72 FT_FRAME_START( 248 ),
73 FT_FRAME_ULONG_LE ( magic ), /* PE00 */
74 FT_FRAME_USHORT_LE ( machine ), /* 0x014C - i386 */
75 FT_FRAME_USHORT_LE ( number_of_sections ),
77 FT_FRAME_USHORT_LE ( size_of_optional_header ),
79 FT_FRAME_USHORT_LE ( magic32 ), /* 0x10B */
81 FT_FRAME_ULONG_LE ( rsrc_virtual_address ),
82 FT_FRAME_ULONG_LE ( rsrc_size ),
85 };
86
88 {
89#undef FT_STRUCTURE
90#define FT_STRUCTURE WinPE32_SectionRec
91
92 FT_FRAME_START( 40 ),
93 FT_FRAME_BYTES ( name, 8 ),
95 FT_FRAME_ULONG_LE ( virtual_address ),
96 FT_FRAME_ULONG_LE ( size_of_raw_data ),
97 FT_FRAME_ULONG_LE ( pointer_to_raw_data ),
100 };
101
103 {
104#undef FT_STRUCTURE
105#define FT_STRUCTURE WinPE_RsrcDirRec
106
107 FT_FRAME_START( 16 ),
108 FT_FRAME_ULONG_LE ( characteristics ),
109 FT_FRAME_ULONG_LE ( time_date_stamp ),
110 FT_FRAME_USHORT_LE( major_version ),
111 FT_FRAME_USHORT_LE( minor_version ),
112 FT_FRAME_USHORT_LE( number_of_named_entries ),
113 FT_FRAME_USHORT_LE( number_of_id_entries ),
115 };
116
118 {
119#undef FT_STRUCTURE
120#define FT_STRUCTURE WinPE_RsrcDirEntryRec
121
122 FT_FRAME_START( 8 ),
126 };
127
129 {
130#undef FT_STRUCTURE
131#define FT_STRUCTURE WinPE_RsrcDataEntryRec
132
133 FT_FRAME_START( 16 ),
134 FT_FRAME_ULONG_LE( offset_to_data ),
139 };
140
142 {
143#undef FT_STRUCTURE
144#define FT_STRUCTURE FT_WinFNT_HeaderRec
145
146 FT_FRAME_START( 148 ),
151 FT_FRAME_USHORT_LE( nominal_point_size ),
152 FT_FRAME_USHORT_LE( vertical_resolution ),
153 FT_FRAME_USHORT_LE( horizontal_resolution ),
154 FT_FRAME_USHORT_LE( ascent ),
155 FT_FRAME_USHORT_LE( internal_leading ),
156 FT_FRAME_USHORT_LE( external_leading ),
157 FT_FRAME_BYTE ( italic ),
158 FT_FRAME_BYTE ( underline ),
159 FT_FRAME_BYTE ( strike_out ),
162 FT_FRAME_USHORT_LE( pixel_width ),
163 FT_FRAME_USHORT_LE( pixel_height ),
164 FT_FRAME_BYTE ( pitch_and_family ),
165 FT_FRAME_USHORT_LE( avg_width ),
166 FT_FRAME_USHORT_LE( max_width ),
167 FT_FRAME_BYTE ( first_char ),
169 FT_FRAME_BYTE ( default_char ),
170 FT_FRAME_BYTE ( break_char ),
171 FT_FRAME_USHORT_LE( bytes_per_row ),
172 FT_FRAME_ULONG_LE ( device_offset ),
173 FT_FRAME_ULONG_LE ( face_name_offset ),
174 FT_FRAME_ULONG_LE ( bits_pointer ),
175 FT_FRAME_ULONG_LE ( bits_offset ),
178 FT_FRAME_USHORT_LE( A_space ),
179 FT_FRAME_USHORT_LE( B_space ),
180 FT_FRAME_USHORT_LE( C_space ),
181 FT_FRAME_ULONG_LE ( color_table_offset ),
182 FT_FRAME_BYTES ( reserved1, 16 ),
184 };
185
186
187 static void
189 {
190 FT_Memory memory = FT_FACE( face )->memory;
191 FT_Stream stream = FT_FACE( face )->stream;
192 FNT_Font font = face->font;
193
194
195 if ( !font )
196 return;
197
198 if ( font->fnt_frame )
199 FT_FRAME_RELEASE( font->fnt_frame );
200 FT_FREE( font->family_name );
201
202 FT_FREE( font );
203 face->font = NULL;
204 }
205
206
207 static FT_Error
210 {
212 FT_WinFNT_Header header = &font->header;
213 FT_Bool new_format;
215
216
217 /* first of all, read the FNT header */
218 if ( FT_STREAM_SEEK( font->offset ) ||
220 goto Exit;
221
222 /* check header */
223 if ( header->version != 0x200 &&
224 header->version != 0x300 )
225 {
226 FT_TRACE2(( " not a Windows FNT file\n" ));
227 error = FT_THROW( Unknown_File_Format );
228 goto Exit;
229 }
230
231 new_format = FT_BOOL( font->header.version == 0x300 );
232 size = new_format ? 148 : 118;
233
234 if ( header->file_size < size )
235 {
236 FT_TRACE2(( " not a Windows FNT file\n" ));
237 error = FT_THROW( Unknown_File_Format );
238 goto Exit;
239 }
240
241 /* Version 2 doesn't have these fields */
242 if ( header->version == 0x200 )
243 {
244 header->flags = 0;
245 header->A_space = 0;
246 header->B_space = 0;
247 header->C_space = 0;
248
249 header->color_table_offset = 0;
250 }
251
252 if ( header->file_type & 1 )
253 {
254 FT_TRACE2(( "[can't handle vector FNT fonts]\n" ));
255 error = FT_THROW( Unknown_File_Format );
256 goto Exit;
257 }
258
259 /* this is a FNT file/table; extract its frame */
260 if ( FT_STREAM_SEEK( font->offset ) ||
261 FT_FRAME_EXTRACT( header->file_size, font->fnt_frame ) )
262 goto Exit;
263
264 Exit:
265 return error;
266 }
267
268
269 static FT_Error
271 FT_Int face_instance_index )
272 {
274 FT_Stream stream = FT_FACE( face )->stream;
275 FT_Memory memory = FT_FACE( face )->memory;
276 WinMZ_HeaderRec mz_header;
277 FT_Long face_index;
278
279
280 face->font = NULL;
281
282 face_index = FT_ABS( face_instance_index ) & 0xFFFF;
283
284 /* does it begin with an MZ header? */
285 if ( FT_STREAM_SEEK( 0 ) ||
287 goto Exit;
288
289 error = FT_ERR( Unknown_File_Format );
290 if ( mz_header.magic == WINFNT_MZ_MAGIC )
291 {
292 /* yes, now look for an NE header in the file */
293 WinNE_HeaderRec ne_header;
294
295
296 FT_TRACE2(( "MZ signature found\n" ));
297
298 if ( FT_STREAM_SEEK( mz_header.lfanew ) ||
300 goto Exit;
301
302 error = FT_ERR( Unknown_File_Format );
303 if ( ne_header.magic == WINFNT_NE_MAGIC )
304 {
305 /* good, now look into the resource table for each FNT resource */
306 FT_ULong res_offset = mz_header.lfanew +
307 ne_header.resource_tab_offset;
308 FT_UShort size_shift;
309 FT_UShort font_count = 0;
310 FT_ULong font_offset = 0;
311
312
313 FT_TRACE2(( "NE signature found\n" ));
314
315 if ( FT_STREAM_SEEK( res_offset ) ||
317 ne_header.resource_tab_offset ) )
318 goto Exit;
319
320 size_shift = FT_GET_USHORT_LE();
321
322 /* Microsoft's specification of the executable-file header format */
323 /* for `New Executable' (NE) doesn't give a limit for the */
324 /* alignment shift count; however, in 1985, the year of the */
325 /* specification release, only 32bit values were supported, thus */
326 /* anything larger than 16 doesn't make sense in general, given */
327 /* that file offsets are 16bit values, shifted by the alignment */
328 /* shift count */
329 if ( size_shift > 16 )
330 {
331 FT_TRACE2(( "invalid alignment shift count for resource data\n" ));
332 error = FT_THROW( Invalid_File_Format );
333 goto Exit1;
334 }
335
336
337 for (;;)
338 {
340
341
343 if ( !type_id )
344 break;
345
347
348 if ( type_id == 0x8008U )
349 {
350 font_count = count;
351 font_offset = FT_STREAM_POS() + 4 +
352 (FT_ULong)( stream->cursor - stream->limit );
353 break;
354 }
355
356 stream->cursor += 4 + count * 12;
357 }
358
360
361 if ( !font_count || !font_offset )
362 {
363 FT_TRACE2(( "this file doesn't contain any FNT resources\n" ));
364 error = FT_THROW( Invalid_File_Format );
365 goto Exit;
366 }
367
368 /* loading `winfnt_header_fields' needs at least 118 bytes; */
369 /* use this as a rough measure to check the expected font size */
370 if ( font_count * 118UL > stream->size )
371 {
372 FT_TRACE2(( "invalid number of faces\n" ));
373 error = FT_THROW( Invalid_File_Format );
374 goto Exit;
375 }
376
377 face->root.num_faces = font_count;
378
379 if ( face_instance_index < 0 )
380 goto Exit;
381
382 if ( face_index >= font_count )
383 {
384 error = FT_THROW( Invalid_Argument );
385 goto Exit;
386 }
387
388 if ( FT_NEW( face->font ) )
389 goto Exit;
390
391 if ( FT_STREAM_SEEK( font_offset + (FT_ULong)face_index * 12 ) ||
392 FT_FRAME_ENTER( 12 ) )
393 goto Fail;
394
395 face->font->offset = (FT_ULong)FT_GET_USHORT_LE() << size_shift;
396 face->font->fnt_size = (FT_ULong)FT_GET_USHORT_LE() << size_shift;
397
398 stream->cursor += 8;
399
401
402 error = fnt_font_load( face->font, stream );
403 }
404 else if ( ne_header.magic == WINFNT_PE_MAGIC )
405 {
406 WinPE32_HeaderRec pe32_header;
407 WinPE32_SectionRec pe32_section;
408 WinPE_RsrcDirRec root_dir, name_dir, lang_dir;
409 WinPE_RsrcDirEntryRec dir_entry1, dir_entry2, dir_entry3;
410 WinPE_RsrcDataEntryRec data_entry;
411
412 FT_ULong root_dir_offset, name_dir_offset, lang_dir_offset;
413 FT_UShort i, j, k;
414
415
416 FT_TRACE2(( "PE signature found\n" ));
417
418 if ( FT_STREAM_SEEK( mz_header.lfanew ) ||
420 goto Exit;
421
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, "
425 "rsrc_size %04lx\n",
426 pe32_header.magic, pe32_header.machine,
427 pe32_header.number_of_sections,
428 pe32_header.size_of_optional_header,
429 pe32_header.magic32, pe32_header.rsrc_virtual_address,
430 pe32_header.rsrc_size ));
431
432 if ( pe32_header.magic != WINFNT_PE_MAGIC /* check full signature */ ||
433 pe32_header.machine != 0x014C /* i386 */ ||
434 pe32_header.size_of_optional_header != 0xE0 /* FIXME */ ||
435 pe32_header.magic32 != 0x10B )
436 {
437 FT_TRACE2(( "this file has an invalid PE header\n" ));
438 error = FT_THROW( Invalid_File_Format );
439 goto Exit;
440 }
441
442 face->root.num_faces = 0;
443
444 for ( i = 0; i < pe32_header.number_of_sections; i++ )
445 {
447 &pe32_section ) )
448 goto Exit;
449
450 FT_TRACE2(( "name %.8s, va %04lx, size %04lx, offset %04lx\n",
451 pe32_section.name, pe32_section.virtual_address,
452 pe32_section.size_of_raw_data,
453 pe32_section.pointer_to_raw_data ));
454
455 if ( pe32_header.rsrc_virtual_address ==
456 pe32_section.virtual_address )
457 goto Found_rsrc_section;
458 }
459
460 FT_TRACE2(( "this file doesn't contain any resources\n" ));
461 error = FT_THROW( Invalid_File_Format );
462 goto Exit;
463
464 Found_rsrc_section:
465 FT_TRACE2(( "found resources section %.8s\n", pe32_section.name ));
466
467 if ( FT_STREAM_SEEK( pe32_section.pointer_to_raw_data ) ||
469 goto Exit;
470
471 root_dir_offset = pe32_section.pointer_to_raw_data;
472
473 for ( i = 0; i < root_dir.number_of_named_entries +
474 root_dir.number_of_id_entries; i++ )
475 {
476 if ( FT_STREAM_SEEK( root_dir_offset + 16 + i * 8 ) ||
478 &dir_entry1 ) )
479 goto Exit;
480
481 if ( !(dir_entry1.offset & 0x80000000UL ) /* DataIsDirectory */ )
482 {
483 error = FT_THROW( Invalid_File_Format );
484 goto Exit;
485 }
486
487 dir_entry1.offset &= ~0x80000000UL;
488
489 name_dir_offset = pe32_section.pointer_to_raw_data +
490 dir_entry1.offset;
491
492 if ( FT_STREAM_SEEK( pe32_section.pointer_to_raw_data +
493 dir_entry1.offset ) ||
495 goto Exit;
496
497 for ( j = 0; j < name_dir.number_of_named_entries +
498 name_dir.number_of_id_entries; j++ )
499 {
500 if ( FT_STREAM_SEEK( name_dir_offset + 16 + j * 8 ) ||
502 &dir_entry2 ) )
503 goto Exit;
504
505 if ( !(dir_entry2.offset & 0x80000000UL ) /* DataIsDirectory */ )
506 {
507 error = FT_THROW( Invalid_File_Format );
508 goto Exit;
509 }
510
511 dir_entry2.offset &= ~0x80000000UL;
512
513 lang_dir_offset = pe32_section.pointer_to_raw_data +
514 dir_entry2.offset;
515
516 if ( FT_STREAM_SEEK( pe32_section.pointer_to_raw_data +
517 dir_entry2.offset ) ||
519 goto Exit;
520
521 for ( k = 0; k < lang_dir.number_of_named_entries +
522 lang_dir.number_of_id_entries; k++ )
523 {
524 if ( FT_STREAM_SEEK( lang_dir_offset + 16 + k * 8 ) ||
526 &dir_entry3 ) )
527 goto Exit;
528
529 if ( dir_entry2.offset & 0x80000000UL /* DataIsDirectory */ )
530 {
531 error = FT_THROW( Invalid_File_Format );
532 goto Exit;
533 }
534
535 if ( dir_entry1.name == 8 /* RT_FONT */ )
536 {
537 if ( FT_STREAM_SEEK( root_dir_offset + dir_entry3.offset ) ||
539 &data_entry ) )
540 goto Exit;
541
542 FT_TRACE2(( "found font #%lu, offset %04lx, "
543 "size %04lx, cp %lu\n",
544 dir_entry2.name,
545 pe32_section.pointer_to_raw_data +
546 data_entry.offset_to_data -
547 pe32_section.virtual_address,
548 data_entry.size, data_entry.code_page ));
549
550 if ( face_index == face->root.num_faces )
551 {
552 if ( FT_NEW( face->font ) )
553 goto Exit;
554
555 face->font->offset = pe32_section.pointer_to_raw_data +
556 data_entry.offset_to_data -
557 pe32_section.virtual_address;
558 face->font->fnt_size = data_entry.size;
559
560 error = fnt_font_load( face->font, stream );
561 if ( error )
562 {
563 FT_TRACE2(( "font #%lu load error 0x%x\n",
564 dir_entry2.name, error ));
565 goto Fail;
566 }
567 else
568 FT_TRACE2(( "font #%lu successfully loaded\n",
569 dir_entry2.name ));
570 }
571
572 face->root.num_faces++;
573 }
574 }
575 }
576 }
577 }
578
579 if ( !face->root.num_faces )
580 {
581 FT_TRACE2(( "this file doesn't contain any RT_FONT resources\n" ));
582 error = FT_THROW( Invalid_File_Format );
583 goto Exit;
584 }
585
586 if ( face_index >= face->root.num_faces )
587 {
588 error = FT_THROW( Invalid_Argument );
589 goto Exit;
590 }
591 }
592
593 Fail:
594 if ( error )
596
597 Exit:
598 return error;
599
600 Exit1:
602 goto Exit;
603 }
604
605
606 typedef struct FNT_CMapRec_
607 {
609 FT_UInt32 first;
610 FT_UInt32 count;
611
613
614
615 static FT_Error
618 {
620 FNT_Font font = face->font;
621
623
624
625 cmap->first = (FT_UInt32) font->header.first_char;
626 cmap->count = (FT_UInt32)( font->header.last_char - cmap->first + 1 );
627
628 return 0;
629 }
630
631
632 static FT_UInt
634 FT_UInt32 char_code )
635 {
636 FT_UInt gindex = 0;
637
638
639 char_code -= cmap->first;
640 if ( char_code < cmap->count )
641 /* we artificially increase the glyph index; */
642 /* FNT_Load_Glyph reverts to the right one */
643 gindex = (FT_UInt)( char_code + 1 );
644 return gindex;
645 }
646
647
648 static FT_UInt32
650 FT_UInt32 *pchar_code )
651 {
652 FT_UInt gindex = 0;
653 FT_UInt32 result = 0;
654 FT_UInt32 char_code = *pchar_code + 1;
655
656
657 if ( char_code <= cmap->first )
658 {
659 result = cmap->first;
660 gindex = 1;
661 }
662 else
663 {
664 char_code -= cmap->first;
665 if ( char_code < cmap->count )
666 {
667 result = cmap->first + char_code;
668 gindex = (FT_UInt)( char_code + 1 );
669 }
670 }
671
672 *pchar_code = result;
673 return gindex;
674 }
675
676
678 {
679 sizeof ( FNT_CMapRec ),
680
685
687 };
688
690
691
692 static void
693 FNT_Face_Done( FT_Face fntface ) /* FNT_Face */
694 {
695 FNT_Face face = (FNT_Face)fntface;
697
698
699 if ( !face )
700 return;
701
703
705
706 FT_FREE( fntface->available_sizes );
707 fntface->num_fixed_sizes = 0;
708 }
709
710
711 static FT_Error
713 FT_Face fntface, /* FNT_Face */
714 FT_Int face_instance_index,
715 FT_Int num_params,
717 {
718 FNT_Face face = (FNT_Face)fntface;
721 FT_Int face_index;
722
723 FT_UNUSED( num_params );
724 FT_UNUSED( params );
725
726
727 FT_TRACE2(( "Windows FNT driver\n" ));
728
729 face_index = FT_ABS( face_instance_index ) & 0xFFFF;
730
731 /* try to load font from a DLL */
732 error = fnt_face_get_dll_font( face, face_instance_index );
733 if ( !error && face_instance_index < 0 )
734 goto Exit;
735
736 if ( FT_ERR_EQ( error, Unknown_File_Format ) )
737 {
738 /* this didn't work; try to load a single FNT font */
740
741 if ( FT_NEW( face->font ) )
742 goto Exit;
743
744 fntface->num_faces = 1;
745
746 font = face->font;
747 font->offset = 0;
748 font->fnt_size = stream->size;
749
751
752 if ( !error )
753 {
754 if ( face_instance_index < 0 )
755 goto Exit;
756
757 if ( face_index > 0 )
758 error = FT_THROW( Invalid_Argument );
759 }
760 }
761
762 if ( error )
763 goto Fail;
764
765 /* sanity check */
766 if ( !face->font->header.pixel_height )
767 {
768 FT_TRACE2(( "invalid pixel height\n" ));
769 error = FT_THROW( Invalid_File_Format );
770 goto Fail;
771 }
772
773 /* we now need to fill the root FT_Face fields */
774 /* with relevant information */
775 {
777 FNT_Font font = face->font;
778 FT_ULong family_size;
779
780
781 root->face_index = face_index;
782
783 root->face_flags |= FT_FACE_FLAG_FIXED_SIZES |
785
786 if ( font->header.avg_width == font->header.max_width )
787 root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
788
789 if ( font->header.italic )
790 root->style_flags |= FT_STYLE_FLAG_ITALIC;
791
792 if ( font->header.weight >= 800 )
793 root->style_flags |= FT_STYLE_FLAG_BOLD;
794
795 /* set up the `fixed_sizes' array */
796 if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )
797 goto Fail;
798
799 root->num_fixed_sizes = 1;
800
801 {
802 FT_Bitmap_Size* bsize = root->available_sizes;
803 FT_UShort x_res, y_res;
804
805
806 bsize->width = (FT_Short)font->header.avg_width;
807 bsize->height = (FT_Short)( font->header.pixel_height +
808 font->header.external_leading );
809 bsize->size = font->header.nominal_point_size << 6;
810
811 x_res = font->header.horizontal_resolution;
812 if ( !x_res )
813 x_res = 72;
814
815 y_res = font->header.vertical_resolution;
816 if ( !y_res )
817 y_res = 72;
818
819 bsize->y_ppem = FT_MulDiv( bsize->size, y_res, 72 );
820 bsize->y_ppem = FT_PIX_ROUND( bsize->y_ppem );
821
822 /*
823 * this reads:
824 *
825 * the nominal height is larger than the bbox's height
826 *
827 * => nominal_point_size contains incorrect value;
828 * use pixel_height as the nominal height
829 */
830 if ( bsize->y_ppem > ( font->header.pixel_height << 6 ) )
831 {
832 FT_TRACE2(( "use pixel_height as the nominal height\n" ));
833
834 bsize->y_ppem = font->header.pixel_height << 6;
835 bsize->size = FT_MulDiv( bsize->y_ppem, 72, y_res );
836 }
837
838 bsize->x_ppem = FT_MulDiv( bsize->size, x_res, 72 );
839 bsize->x_ppem = FT_PIX_ROUND( bsize->x_ppem );
840 }
841
842 {
843 FT_CharMapRec charmap;
844
845
846 charmap.encoding = FT_ENCODING_NONE;
847 /* initial platform/encoding should indicate unset status? */
850 charmap.face = root;
851
852 if ( font->header.charset == FT_WinFNT_ID_MAC )
853 {
854 charmap.encoding = FT_ENCODING_APPLE_ROMAN;
856/* charmap.encoding_id = TT_MAC_ID_ROMAN; */
857 }
858
860 NULL,
861 &charmap,
862 NULL );
863 if ( error )
864 goto Fail;
865 }
866
867 /* set up remaining flags */
868
869 if ( font->header.last_char < font->header.first_char )
870 {
871 FT_TRACE2(( "invalid number of glyphs\n" ));
872 error = FT_THROW( Invalid_File_Format );
873 goto Fail;
874 }
875
876 /* reserve one slot for the .notdef glyph at index 0 */
877 root->num_glyphs = font->header.last_char -
878 font->header.first_char + 1 + 1;
879
880 if ( font->header.face_name_offset >= font->header.file_size )
881 {
882 FT_TRACE2(( "invalid family name offset\n" ));
883 error = FT_THROW( Invalid_File_Format );
884 goto Fail;
885 }
886 family_size = font->header.file_size - font->header.face_name_offset;
887 /* Some broken fonts don't delimit the face name with a final */
888 /* NULL byte -- the frame is erroneously one byte too small. */
889 /* We thus allocate one more byte, setting it explicitly to */
890 /* zero. */
891 if ( FT_ALLOC( font->family_name, family_size + 1 ) )
892 goto Fail;
893
894 FT_MEM_COPY( font->family_name,
895 font->fnt_frame + font->header.face_name_offset,
896 family_size );
897
898 font->family_name[family_size] = '\0';
899
900 if ( FT_REALLOC( font->family_name,
901 family_size,
902 ft_strlen( font->family_name ) + 1 ) )
903 goto Fail;
904
905 root->family_name = font->family_name;
906 root->style_name = (char *)"Regular";
907
908 if ( root->style_flags & FT_STYLE_FLAG_BOLD )
909 {
910 if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
911 root->style_name = (char *)"Bold Italic";
912 else
913 root->style_name = (char *)"Bold";
914 }
915 else if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
916 root->style_name = (char *)"Italic";
917 }
918 goto Exit;
919
920 Fail:
921 FNT_Face_Done( fntface );
922
923 Exit:
924 return error;
925 }
926
927
928 static FT_Error
930 FT_ULong strike_index )
931 {
932 FNT_Face face = (FNT_Face)size->face;
933 FT_WinFNT_Header header = &face->font->header;
934
935 FT_UNUSED( strike_index );
936
937
938 FT_Select_Metrics( size->face, 0 );
939
940 size->metrics.ascender = header->ascent * 64;
941 size->metrics.descender = -( header->pixel_height -
942 header->ascent ) * 64;
943 size->metrics.max_advance = header->max_width * 64;
944
945 return FT_Err_Ok;
946 }
947
948
949 static FT_Error
951 FT_Size_Request req )
952 {
953 FNT_Face face = (FNT_Face)size->face;
954 FT_WinFNT_Header header = &face->font->header;
955 FT_Bitmap_Size* bsize = size->face->available_sizes;
956 FT_Error error = FT_ERR( Invalid_Pixel_Size );
958
959
960 height = FT_REQUEST_HEIGHT( req );
961 height = ( height + 32 ) >> 6;
962
963 switch ( req->type )
964 {
966 if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
968 break;
969
971 if ( height == header->pixel_height )
973 break;
974
975 default:
976 error = FT_THROW( Unimplemented_Feature );
977 break;
978 }
979
980 if ( error )
981 return error;
982 else
983 return FNT_Size_Select( size, 0 );
984 }
985
986
987 static FT_Error
990 FT_UInt glyph_index,
991 FT_Int32 load_flags )
992 {
996 FT_Byte* p;
997 FT_UInt len;
998 FT_Bitmap* bitmap = &slot->bitmap;
1000 FT_Bool new_format;
1001
1002
1003 if ( !face )
1004 {
1005 error = FT_THROW( Invalid_Face_Handle );
1006 goto Exit;
1007 }
1008
1009 font = face->font;
1010
1011 if ( !font ||
1012 glyph_index >= (FT_UInt)( FT_FACE( face )->num_glyphs ) )
1013 {
1014 error = FT_THROW( Invalid_Argument );
1015 goto Exit;
1016 }
1017
1018 FT_TRACE1(( "FNT_Load_Glyph: glyph index %d\n", glyph_index ));
1019
1020 if ( glyph_index > 0 )
1021 glyph_index--; /* revert to real index */
1022 else
1023 glyph_index = font->header.default_char; /* the `.notdef' glyph */
1024
1025 new_format = FT_BOOL( font->header.version == 0x300 );
1026 len = new_format ? 6 : 4;
1027
1028 /* get glyph width and offset */
1029 offset = ( new_format ? 148 : 118 ) + len * glyph_index;
1030
1031 if ( offset >= font->header.file_size - 2 - ( new_format ? 4 : 2 ) )
1032 {
1033 FT_TRACE2(( "invalid FNT offset\n" ));
1034 error = FT_THROW( Invalid_File_Format );
1035 goto Exit;
1036 }
1037
1038 p = font->fnt_frame + offset;
1039
1041
1042 /* jump to glyph entry */
1043 if ( new_format )
1045 else
1047
1048 if ( offset >= font->header.file_size )
1049 {
1050 FT_TRACE2(( "invalid FNT offset\n" ));
1051 error = FT_THROW( Invalid_File_Format );
1052 goto Exit;
1053 }
1054
1055 bitmap->rows = font->header.pixel_height;
1056 bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
1057
1058 slot->bitmap_left = 0;
1059 slot->bitmap_top = font->header.ascent;
1060 slot->format = FT_GLYPH_FORMAT_BITMAP;
1061
1062 /* now set up metrics */
1063 slot->metrics.width = (FT_Pos)( bitmap->width << 6 );
1064 slot->metrics.height = (FT_Pos)( bitmap->rows << 6 );
1065 slot->metrics.horiAdvance = (FT_Pos)( bitmap->width << 6 );
1066 slot->metrics.horiBearingX = 0;
1067 slot->metrics.horiBearingY = slot->bitmap_top << 6;
1068
1070 (FT_Pos)( bitmap->rows << 6 ) );
1071
1072 if ( load_flags & FT_LOAD_BITMAP_METRICS_ONLY )
1073 goto Exit;
1074
1075 /* jump to glyph data */
1076 p = font->fnt_frame + /* font->header.bits_offset */ + offset;
1077
1078 /* allocate and build bitmap */
1079 {
1081 FT_UInt pitch = ( bitmap->width + 7 ) >> 3;
1082 FT_Byte* column;
1083 FT_Byte* write;
1084
1085
1086 bitmap->pitch = (int)pitch;
1087 if ( !pitch ||
1088 offset + pitch * bitmap->rows > font->header.file_size )
1089 {
1090 FT_TRACE2(( "invalid bitmap width\n" ));
1091 error = FT_THROW( Invalid_File_Format );
1092 goto Exit;
1093 }
1094
1095 /* note: since glyphs are stored in columns and not in rows we */
1096 /* can't use ft_glyphslot_set_bitmap */
1097 if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, pitch ) )
1098 goto Exit;
1099
1100 column = (FT_Byte*)bitmap->buffer;
1101
1102 for ( ; pitch > 0; pitch--, column++ )
1103 {
1104 FT_Byte* limit = p + bitmap->rows;
1105
1106
1107 for ( write = column; p < limit; p++, write += bitmap->pitch )
1108 *write = *p;
1109 }
1110
1111 slot->internal->flags = FT_GLYPH_OWN_BITMAP;
1112 }
1113
1114 Exit:
1115 return error;
1116 }
1117
1118
1119 static FT_Error
1121 FT_WinFNT_HeaderRec *aheader )
1122 {
1123 FNT_Font font = ((FNT_Face)face)->font;
1124
1125
1126 *aheader = font->header;
1127
1128 return 0;
1129 }
1130
1131
1132 static const FT_Service_WinFntRec winfnt_service_rec =
1133 {
1134 winfnt_get_header /* get_header */
1135 };
1136
1137 /*
1138 * SERVICE LIST
1139 *
1140 */
1141
1143 {
1146 { NULL, NULL }
1147 };
1148
1149
1150 static FT_Module_Interface
1152 const FT_String* service_id )
1153 {
1154 FT_UNUSED( module );
1155
1156 return ft_service_list_lookup( winfnt_services, service_id );
1157 }
1158
1159
1160
1161
1164 {
1165 {
1168 sizeof ( FT_DriverRec ),
1169
1170 "winfonts",
1171 0x10000L,
1172 0x20000L,
1173
1174 NULL, /* module-specific interface */
1175
1176 NULL, /* FT_Module_Constructor module_init */
1177 NULL, /* FT_Module_Destructor module_done */
1178 winfnt_get_service /* FT_Module_Requester get_interface */
1179 },
1180
1181 sizeof ( FNT_FaceRec ),
1182 sizeof ( FT_SizeRec ),
1183 sizeof ( FT_GlyphSlotRec ),
1184
1185 FNT_Face_Init, /* FT_Face_InitFunc init_face */
1186 FNT_Face_Done, /* FT_Face_DoneFunc done_face */
1187 NULL, /* FT_Size_InitFunc init_size */
1188 NULL, /* FT_Size_DoneFunc done_size */
1189 NULL, /* FT_Slot_InitFunc init_slot */
1190 NULL, /* FT_Slot_DoneFunc done_slot */
1191
1192 FNT_Load_Glyph, /* FT_Slot_LoadFunc load_glyph */
1193
1194 NULL, /* FT_Face_GetKerningFunc get_kerning */
1195 NULL, /* FT_Face_AttachFunc attach_file */
1196 NULL, /* FT_Face_GetAdvancesFunc get_advances */
1197
1198 FNT_Size_Request, /* FT_Size_RequestFunc request_size */
1199 FNT_Size_Select /* FT_Size_SelectFunc select_size */
1200 };
1201
1202
1203/* END */
#define write
Definition: acwin.h:97
char copyright[]
Definition: main.c:27
struct _root root
CFF_Charset charset
Definition: cffcmap.c:137
#define FT_CALLBACK_TABLE_DEF
_Out_opt_ UINT * code_page
#define NULL
Definition: types.h:112
static const WCHAR version[]
Definition: asmname.c:66
#define TT_APPLE_ID_DEFAULT
Definition: font.c:1176
#define TT_PLATFORM_MACINTOSH
Definition: font.c:1173
#define TT_PLATFORM_APPLE_UNICODE
Definition: font.c:1172
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
r reserved
Definition: btrfs.c:3006
static const char root_dir[]
Definition: create.c:32
int Fail
Definition: ehthrow.cxx:24
#define FT_STYLE_FLAG_ITALIC
Definition: freetype.h:1475
#define FT_FACE_FLAG_FIXED_SIZES
Definition: freetype.h:1198
@ FT_SIZE_REQUEST_TYPE_NOMINAL
Definition: freetype.h:2552
@ FT_SIZE_REQUEST_TYPE_REAL_DIM
Definition: freetype.h:2553
#define FT_LOAD_BITMAP_METRICS_ONLY
Definition: freetype.h:3039
#define FT_FACE_FLAG_FIXED_WIDTH
Definition: freetype.h:1199
struct FT_GlyphSlotRec_ FT_GlyphSlotRec
#define FT_STYLE_FLAG_BOLD
Definition: freetype.h:1476
#define FT_FACE_FLAG_HORIZONTAL
Definition: freetype.h:1201
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
Definition: ftcalc.c:415
return FT_Err_Ok
Definition: ftbbox.c:526
#define FT_THROW(e)
Definition: ftdebug.h:243
#define FT_TRACE2(varformat)
Definition: ftdebug.h:189
#define FT_TRACE1(varformat)
Definition: ftdebug.h:188
@ FT_PIXEL_MODE_MONO
Definition: ftimage.h:183
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:57
#define FT_ALLOC_MULT(ptr, count, item_size)
Definition: ftmemory.h:317
#define FT_REALLOC(ptr, cursz, newsz)
Definition: ftmemory.h:314
#define FT_NEW_ARRAY(ptr, count)
Definition: ftmemory.h:341
#define FT_NEW(ptr)
Definition: ftmemory.h:339
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:311
#define FT_FREE(ptr)
Definition: ftmemory.h:337
#define FT_MEM_COPY(dest, source, count)
Definition: ftmemory.h:237
#define FT_MODULE_FONT_DRIVER
Definition: ftmodapi.h:109
#define FT_MODULE_DRIVER_NO_OUTLINES
Definition: ftmodapi.h:116
FT_UInt(* FT_CMap_CharNextFunc)(FT_CMap cmap, FT_UInt32 *achar_code)
Definition: ftobjs.h:179
#define FT_FACE(x)
Definition: ftobjs.h:597
ft_synthesize_vertical_metrics(FT_Glyph_Metrics *metrics, FT_Pos advance)
Definition: ftobjs.c:2997
#define FT_ABS(a)
Definition: ftobjs.h:73
FT_Select_Metrics(FT_Face face, FT_ULong strike_index)
Definition: ftobjs.c:3057
struct FT_DriverRec_ FT_DriverRec
#define FT_REQUEST_HEIGHT(req)
Definition: ftobjs.h:663
#define FT_FACE_MEMORY(x)
Definition: ftobjs.h:603
FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
Definition: ftobjs.c:3677
#define FT_PIX_ROUND(x)
Definition: ftobjs.h:92
#define FT_SIZE_FACE(x)
Definition: ftobjs.h:606
#define FT_GLYPH_OWN_BITMAP
Definition: ftobjs.h:421
FT_Error(* FT_CMap_InitFunc)(FT_CMap cmap, FT_Pointer init_data)
Definition: ftobjs.h:168
void(* FT_CMap_DoneFunc)(FT_CMap cmap)
Definition: ftobjs.h:172
FT_UInt(* FT_CMap_CharIndexFunc)(FT_CMap cmap, FT_UInt32 char_code)
Definition: ftobjs.h:175
#define FT_CMAP_FACE(x)
Definition: ftobjs.h:163
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
Definition: ftobjs.c:109
#define ft_strlen
Definition: ftstdlib.h:88
#define FT_FRAME_ENTER(size)
Definition: ftstream.h:548
#define FT_FRAME_END
Definition: ftstream.h:118
#define FT_NEXT_ULONG_LE(buffer)
Definition: ftstream.h:275
#define FT_NEXT_USHORT_LE(buffer)
Definition: ftstream.h:263
#define FT_FRAME_RELEASE(bytes)
Definition: ftstream.h:562
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:525
#define FT_STREAM_POS()
Definition: ftstream.h:522
#define FT_GET_USHORT_LE()
Definition: ftstream.h:319
#define FT_FRAME_BYTE(f)
Definition: ftstream.h:126
#define FT_FRAME_EXIT()
Definition: ftstream.h:553
#define FT_FRAME_SKIP_BYTES(count)
Definition: ftstream.h:147
#define FT_FRAME_USHORT_LE(f)
Definition: ftstream.h:132
#define FT_FRAME_EXTRACT(size, bytes)
Definition: ftstream.h:556
#define FT_FRAME_ULONG_LE(f)
Definition: ftstream.h:130
#define FT_STREAM_READ_FIELDS(fields, object)
Definition: ftstream.h:544
#define FT_FRAME_BYTES(field, count)
Definition: ftstream.h:140
#define FT_FRAME_START(size)
Definition: ftstream.h:117
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:64
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
unsigned long FT_ULong
Definition: fttypes.h:253
unsigned char FT_Byte
Definition: fttypes.h:154
#define FT_ERR_EQ(x, e)
Definition: fttypes.h:604
int FT_Error
Definition: fttypes.h:299
signed long FT_Long
Definition: fttypes.h:242
#define FT_ERR(e)
Definition: fttypes.h:599
unsigned short FT_UShort
Definition: fttypes.h:209
char FT_String
Definition: fttypes.h:187
signed short FT_Short
Definition: fttypes.h:198
unsigned int FT_UInt
Definition: fttypes.h:231
#define FT_BOOL(x)
Definition: fttypes.h:591
signed int FT_Int
Definition: fttypes.h:220
#define FT_WinFNT_ID_MAC
Definition: ftwinfnt.h:157
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
GLsizei const GLvoid * pointer
Definition: glext.h:5848
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLint limit
Definition: glext.h:10326
GLenum const GLfloat * params
Definition: glext.h:5645
GLbitfield flags
Definition: glext.h:7161
const GLint * first
Definition: glext.h:5794
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
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
Definition: glfuncs.h:248
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
Definition: glfuncs.h:250
type_id
#define error(str)
Definition: mkdosfs.c:1605
#define for
Definition: utility.h:88
static char memory[1024 *256]
Definition: process.c:122
static const char machine[]
Definition: profile.c:104
LONG last_char
Definition: input.c:71
int k
Definition: mpi.c:3369
Definition: mk_font.cpp:20
#define FT_UNUSED(arg)
static unsigned int file_size
Definition: regtests2xml.c:47
FD_TYPE file_type(FDSC **curr, char *fixed)
Definition: file.c:221
weight
Definition: sortkey.c:157
static void Exit(void)
Definition: sock.c:1330
FT_CMapRec cmap
Definition: winfnt.c:608
FT_UInt32 count
Definition: winfnt.c:610
FT_UInt32 first
Definition: winfnt.c:609
FT_Pos y_ppem
Definition: freetype.h:363
FT_Pos x_ppem
Definition: freetype.h:362
FT_Short width
Definition: freetype.h:358
FT_Short height
Definition: freetype.h:357
FT_Face face
Definition: freetype.h:819
FT_Encoding encoding
Definition: freetype.h:820
FT_UShort platform_id
Definition: freetype.h:821
FT_UShort encoding_id
Definition: freetype.h:822
FT_Bitmap_Size * available_sizes
Definition: freetype.h:1042
FT_Int num_fixed_sizes
Definition: freetype.h:1041
FT_Long num_faces
Definition: freetype.h:1030
FT_Size_Request_Type type
Definition: freetype.h:2604
FT_UShort rname_tab_offset
Definition: winfnt.h:45
FT_UShort resource_tab_offset
Definition: winfnt.h:44
FT_UShort magic
Definition: winfnt.h:42
FT_ULong rsrc_size
Definition: winfnt.h:61
FT_ULong magic
Definition: winfnt.h:52
FT_UShort number_of_sections
Definition: winfnt.h:54
FT_UShort machine
Definition: winfnt.h:53
FT_ULong rsrc_virtual_address
Definition: winfnt.h:60
FT_UShort size_of_optional_header
Definition: winfnt.h:56
FT_UShort magic32
Definition: winfnt.h:58
FT_ULong virtual_address
Definition: winfnt.h:71
FT_ULong size_of_raw_data
Definition: winfnt.h:72
FT_ULong pointer_to_raw_data
Definition: winfnt.h:73
FT_Byte name[8]
Definition: winfnt.h:69
FT_ULong offset_to_data
Definition: winfnt.h:101
FT_UShort number_of_id_entries
Definition: winfnt.h:86
FT_UShort number_of_named_entries
Definition: winfnt.h:85
Definition: vfat.h:185
Definition: uimain.c:89
uint32 width
Definition: uimain.c:91
Definition: name.c:39
Definition: parse.h:23
unsigned int size
Definition: parse.h:27
#define FT_SERVICE_ID_FONT_FORMAT
Definition: svfntfmt.h:34
#define FT_FONT_FORMAT_WINFNT
Definition: svfntfmt.h:44
#define FT_SERVICE_ID_WINFNT
Definition: svwinfnt.h:29
static FT_Error FNT_Load_Glyph(FT_GlyphSlot slot, FT_Size size, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: winfnt.c:988
static const FT_Frame_Field winpe_rsrc_dir_fields[]
Definition: winfnt.c:102
FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec winfnt_driver_class
Definition: winfnt.c:1163
static FT_Module_Interface winfnt_get_service(FT_Module module, const FT_String *service_id)
Definition: winfnt.c:1151
static const FT_Frame_Field winne_header_fields[]
Definition: winfnt.c:54
static FT_Error fnt_font_load(FNT_Font font, FT_Stream stream)
Definition: winfnt.c:208
struct FNT_CMapRec_ FNT_CMapRec
static const FT_Frame_Field winpe32_header_fields[]
Definition: winfnt.c:67
static FT_Error fnt_cmap_init(FNT_CMap cmap, FT_Pointer pointer)
Definition: winfnt.c:616
static void fnt_font_done(FNT_Face face)
Definition: winfnt.c:188
static FT_Error winfnt_get_header(FT_Face face, FT_WinFNT_HeaderRec *aheader)
Definition: winfnt.c:1120
static FT_UInt32 fnt_cmap_char_next(FNT_CMap cmap, FT_UInt32 *pchar_code)
Definition: winfnt.c:649
static const FT_Frame_Field winpe32_section_fields[]
Definition: winfnt.c:87
static FT_CMap_Class const fnt_cmap_class
Definition: winfnt.c:689
static const FT_Service_WinFntRec winfnt_service_rec
Definition: winfnt.c:1132
static const FT_Frame_Field winmz_header_fields[]
Definition: winfnt.c:42
static const FT_Frame_Field winfnt_header_fields[]
Definition: winfnt.c:141
static FT_Error FNT_Size_Select(FT_Size size, FT_ULong strike_index)
Definition: winfnt.c:929
static FT_Error FNT_Face_Init(FT_Stream stream, FT_Face fntface, FT_Int face_instance_index, FT_Int num_params, FT_Parameter *params)
Definition: winfnt.c:712
static FT_Error FNT_Size_Request(FT_Size size, FT_Size_Request req)
Definition: winfnt.c:950
static const FT_CMap_ClassRec fnt_cmap_class_rec
Definition: winfnt.c:677
static const FT_Frame_Field winpe_rsrc_data_entry_fields[]
Definition: winfnt.c:128
struct FNT_CMapRec_ * FNT_CMap
static const FT_Frame_Field winpe_rsrc_dir_entry_fields[]
Definition: winfnt.c:117
static FT_UInt fnt_cmap_char_index(FNT_CMap cmap, FT_UInt32 char_code)
Definition: winfnt.c:633
static void FNT_Face_Done(FT_Face fntface)
Definition: winfnt.c:693
static FT_Error fnt_face_get_dll_font(FNT_Face face, FT_Int face_instance_index)
Definition: winfnt.c:270
static const FT_ServiceDescRec winfnt_services[]
Definition: winfnt.c:1142
FT_BEGIN_HEADER struct WinMZ_HeaderRec_ WinMZ_HeaderRec
struct FNT_FaceRec_ FNT_FaceRec
#define WINFNT_PE_MAGIC
Definition: winfnt.h:131
struct FNT_FaceRec_ * FNT_Face
#define WINFNT_NE_MAGIC
Definition: winfnt.h:130
#define WINFNT_MZ_MAGIC
Definition: winfnt.h:129