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