ReactOS 0.4.16-dev-2332-g4cba65d
sfobjs.c
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * sfobjs.c
4 *
5 * SFNT object management (base).
6 *
7 * Copyright (C) 1996-2020 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
9 *
10 * This file is part of the FreeType project, and may only be used,
11 * modified, and distributed under the terms of the FreeType project
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute
13 * this file you indicate that you have read the license and
14 * understand and accept it fully.
15 *
16 */
17
18
19#include "sfobjs.h"
20#include "ttload.h"
21#include "ttcmap.h"
22#include "ttkern.h"
23#include "sfwoff.h"
24#include "sfwoff2.h"
27#include <freetype/ttnameid.h>
28#include <freetype/tttags.h>
30#include <freetype/ftsnames.h>
31
32#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
35#endif
36
37#include "sferrors.h"
38
39#ifdef TT_CONFIG_OPTION_BDF
40#include "ttbdf.h"
41#endif
42
43
44 /**************************************************************************
45 *
46 * The macro FT_COMPONENT is used in trace mode. It is an implicit
47 * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
48 * messages during execution.
49 */
50#undef FT_COMPONENT
51#define FT_COMPONENT sfobjs
52
53
54
55 /* convert a UTF-16 name entry to ASCII */
56 static FT_String*
59 {
60 FT_String* string = NULL;
61 FT_UInt len, code, n;
62 FT_Byte* read = (FT_Byte*)entry->string;
64
65
66 len = (FT_UInt)entry->stringLength / 2;
67
68 if ( FT_NEW_ARRAY( string, len + 1 ) )
69 return NULL;
70
71 for ( n = 0; n < len; n++ )
72 {
74
75 if ( code == 0 )
76 break;
77
78 if ( code < 32 || code > 127 )
79 code = '?';
80
81 string[n] = (char)code;
82 }
83
84 string[n] = 0;
85
86 return string;
87 }
88
89
90 /* convert an Apple Roman or symbol name entry to ASCII */
91 static FT_String*
94 {
95 FT_String* string = NULL;
96 FT_UInt len, code, n;
97 FT_Byte* read = (FT_Byte*)entry->string;
99
100
101 len = (FT_UInt)entry->stringLength;
102
103 if ( FT_NEW_ARRAY( string, len + 1 ) )
104 return NULL;
105
106 for ( n = 0; n < len; n++ )
107 {
108 code = *read++;
109
110 if ( code == 0 )
111 break;
112
113 if ( code < 32 || code > 127 )
114 code = '?';
115
116 string[n] = (char)code;
117 }
118
119 string[n] = 0;
120
121 return string;
122 }
123
124
125 typedef FT_String* (*TT_Name_ConvertFunc)( TT_Name entry,
127
128
129 /* documentation is in sfnt.h */
130
133 FT_UShort nameid,
134 FT_String** name )
135 {
136 FT_Memory memory = face->root.memory;
139 FT_UShort n;
140 TT_Name rec;
141
142 FT_Int found_apple = -1;
143 FT_Int found_apple_roman = -1;
144 FT_Int found_apple_english = -1;
145 FT_Int found_win = -1;
146 FT_Int found_unicode = -1;
147
149
151
152
153 FT_ASSERT( name );
154
155 rec = face->name_table.names;
156 for ( n = 0; n < face->num_names; n++, rec++ )
157 {
158 /* According to the OpenType 1.3 specification, only Microsoft or */
159 /* Apple platform IDs might be used in the `name' table. The */
160 /* `Unicode' platform is reserved for the `cmap' table, and the */
161 /* `ISO' one is deprecated. */
162 /* */
163 /* However, the Apple TrueType specification doesn't say the same */
164 /* thing and goes to suggest that all Unicode `name' table entries */
165 /* should be coded in UTF-16 (in big-endian format I suppose). */
166 /* */
167 if ( rec->nameID == nameid && rec->stringLength > 0 )
168 {
169 switch ( rec->platformID )
170 {
172 case TT_PLATFORM_ISO:
173 /* there is `languageID' to check there. We should use this */
174 /* field only as a last solution when nothing else is */
175 /* available. */
176 /* */
177 found_unicode = n;
178 break;
179
181 /* This is a bit special because some fonts will use either */
182 /* an English language id, or a Roman encoding id, to indicate */
183 /* the English version of its font name. */
184 /* */
185 if ( rec->languageID == TT_MAC_LANGID_ENGLISH )
186 found_apple_english = n;
187 else if ( rec->encodingID == TT_MAC_ID_ROMAN )
188 found_apple_roman = n;
189 break;
190
192 /* we only take a non-English name when there is nothing */
193 /* else available in the font */
194 /* */
195 if ( found_win == -1 || ( rec->languageID & 0x3FF ) == 0x009 )
196 {
197 switch ( rec->encodingID )
198 {
201 case TT_MS_ID_UCS_4:
202 is_english = FT_BOOL( ( rec->languageID & 0x3FF ) == 0x009 );
203 found_win = n;
204 break;
205
206 default:
207 ;
208 }
209 }
210 break;
211
212 default:
213 ;
214 }
215 }
216 }
217
218 found_apple = found_apple_roman;
219 if ( found_apple_english >= 0 )
220 found_apple = found_apple_english;
221
222 /* some fonts contain invalid Unicode or Macintosh formatted entries; */
223 /* we will thus favor names encoded in Windows formats if available */
224 /* (provided it is an English name) */
225 /* */
226 convert = NULL;
227 if ( found_win >= 0 && !( found_apple >= 0 && !is_english ) )
228 {
229 rec = face->name_table.names + found_win;
230 switch ( rec->encodingID )
231 {
232 /* all Unicode strings are encoded using UTF-16BE */
236 break;
237
238 case TT_MS_ID_UCS_4:
239 /* Apparently, if this value is found in a name table entry, it is */
240 /* documented as `full Unicode repertoire'. Experience with the */
241 /* MsGothic font shipped with Windows Vista shows that this really */
242 /* means UTF-16 encoded names (UCS-4 values are only used within */
243 /* charmaps). */
245 break;
246
247 default:
248 ;
249 }
250 }
251 else if ( found_apple >= 0 )
252 {
253 rec = face->name_table.names + found_apple;
255 }
256 else if ( found_unicode >= 0 )
257 {
258 rec = face->name_table.names + found_unicode;
260 }
261
262 if ( rec && convert )
263 {
264 if ( !rec->string )
265 {
266 FT_Stream stream = face->name_table.stream;
267
268
269 if ( FT_QNEW_ARRAY ( rec->string, rec->stringLength ) ||
271 FT_STREAM_READ( rec->string, rec->stringLength ) )
272 {
273 FT_FREE( rec->string );
274 rec->stringLength = 0;
275 result = NULL;
276 goto Exit;
277 }
278 }
279
280 result = convert( rec, memory );
281 }
282
283 Exit:
284 *name = result;
285 return error;
286 }
287
288
289 static FT_Encoding
290 sfnt_find_encoding( int platform_id,
291 int encoding_id )
292 {
293 typedef struct TEncoding_
294 {
295 int platform_id;
296 int encoding_id;
297 FT_Encoding encoding;
298
299 } TEncoding;
300
301 static
302 const TEncoding tt_encodings[] =
303 {
304 { TT_PLATFORM_ISO, -1, FT_ENCODING_UNICODE },
305
306 { TT_PLATFORM_APPLE_UNICODE, -1, FT_ENCODING_UNICODE },
307
308 { TT_PLATFORM_MACINTOSH, TT_MAC_ID_ROMAN, FT_ENCODING_APPLE_ROMAN },
309
310 { TT_PLATFORM_MICROSOFT, TT_MS_ID_SYMBOL_CS, FT_ENCODING_MS_SYMBOL },
311 { TT_PLATFORM_MICROSOFT, TT_MS_ID_UCS_4, FT_ENCODING_UNICODE },
312 { TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, FT_ENCODING_UNICODE },
313 { TT_PLATFORM_MICROSOFT, TT_MS_ID_SJIS, FT_ENCODING_SJIS },
314 { TT_PLATFORM_MICROSOFT, TT_MS_ID_PRC, FT_ENCODING_PRC },
315 { TT_PLATFORM_MICROSOFT, TT_MS_ID_BIG_5, FT_ENCODING_BIG5 },
316 { TT_PLATFORM_MICROSOFT, TT_MS_ID_WANSUNG, FT_ENCODING_WANSUNG },
317 { TT_PLATFORM_MICROSOFT, TT_MS_ID_JOHAB, FT_ENCODING_JOHAB }
318 };
319
320 const TEncoding *cur, *limit;
321
322
323 cur = tt_encodings;
324 limit = cur + sizeof ( tt_encodings ) / sizeof ( tt_encodings[0] );
325
326 for ( ; cur < limit; cur++ )
327 {
328 if ( cur->platform_id == platform_id )
329 {
330 if ( cur->encoding_id == encoding_id ||
331 cur->encoding_id == -1 )
332 return cur->encoding;
333 }
334 }
335
336 return FT_ENCODING_NONE;
337 }
338
339
340 /* Fill in face->ttc_header. If the font is not a TTC, it is */
341 /* synthesized into a TTC with one offset table. */
342 static FT_Error
345 FT_Int* face_instance_index,
346 FT_Long* woff2_num_faces )
347 {
348 FT_Memory memory = stream->memory;
351
352 static const FT_Frame_Field ttc_header_fields[] =
353 {
354#undef FT_STRUCTURE
355#define FT_STRUCTURE TTC_HeaderRec
356
357 FT_FRAME_START( 8 ),
359 FT_FRAME_LONG( count ), /* this is ULong in the specs */
361 };
362
363
364 face->ttc_header.tag = 0;
365 face->ttc_header.version = 0;
366 face->ttc_header.count = 0;
367
368 retry:
370
371 if ( FT_READ_ULONG( tag ) )
372 return error;
373
374 if ( tag == TTAG_wOFF )
375 {
376 FT_TRACE2(( "sfnt_open_font: file is a WOFF; synthesizing SFNT\n" ));
377
378 if ( FT_STREAM_SEEK( offset ) )
379 return error;
380
382 if ( error )
383 return error;
384
385 /* Swap out stream and retry! */
386 stream = face->root.stream;
387 goto retry;
388 }
389
390 if ( tag == TTAG_wOF2 )
391 {
392 FT_TRACE2(( "sfnt_open_font: file is a WOFF2; synthesizing SFNT\n" ));
393
394 if ( FT_STREAM_SEEK( offset ) )
395 return error;
396
398 face,
399 face_instance_index,
400 woff2_num_faces );
401 if ( error )
402 return error;
403
404 /* Swap out stream and retry! */
405 stream = face->root.stream;
406 goto retry;
407 }
408
409 if ( tag != 0x00010000UL &&
410 tag != TTAG_ttcf &&
411 tag != TTAG_OTTO &&
412 tag != TTAG_true &&
413 tag != TTAG_typ1 &&
414 tag != TTAG_0xA5kbd &&
415 tag != TTAG_0xA5lst &&
416 tag != 0x00020000UL )
417 {
418 FT_TRACE2(( " not a font using the SFNT container format\n" ));
419 return FT_THROW( Unknown_File_Format );
420 }
421
422 face->ttc_header.tag = TTAG_ttcf;
423
424 if ( tag == TTAG_ttcf )
425 {
426 FT_Int n;
427
428
429 FT_TRACE3(( "sfnt_open_font: file is a collection\n" ));
430
431 if ( FT_STREAM_READ_FIELDS( ttc_header_fields, &face->ttc_header ) )
432 return error;
433
434 FT_TRACE3(( " with %ld subfonts\n",
435 face->ttc_header.count ));
436
437 if ( face->ttc_header.count == 0 )
438 return FT_THROW( Invalid_Table );
439
440 /* a rough size estimate: let's conservatively assume that there */
441 /* is just a single table info in each subfont header (12 + 16*1 = */
442 /* 28 bytes), thus we have (at least) `12 + 4*count' bytes for the */
443 /* size of the TTC header plus `28*count' bytes for all subfont */
444 /* headers */
445 if ( (FT_ULong)face->ttc_header.count > stream->size / ( 28 + 4 ) )
446 return FT_THROW( Array_Too_Large );
447
448 /* now read the offsets of each font in the file */
449 if ( FT_NEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) )
450 return error;
451
452 if ( FT_FRAME_ENTER( face->ttc_header.count * 4L ) )
453 return error;
454
455 for ( n = 0; n < face->ttc_header.count; n++ )
456 face->ttc_header.offsets[n] = FT_GET_ULONG();
457
459 }
460 else
461 {
462 FT_TRACE3(( "sfnt_open_font: synthesize TTC\n" ));
463
464 face->ttc_header.version = 1 << 16;
465 face->ttc_header.count = 1;
466
467 if ( FT_NEW( face->ttc_header.offsets ) )
468 return error;
469
470 face->ttc_header.offsets[0] = offset;
471 }
472
473 return error;
474 }
475
476
480 FT_Int face_instance_index,
481 FT_Int num_params,
483 {
485 FT_Library library = face->root.driver->root.library;
487 FT_Int face_index;
488 FT_Long woff2_num_faces = 0;
489
490
491 /* for now, parameters are unused */
492 FT_UNUSED( num_params );
493 FT_UNUSED( params );
494
495
496 sfnt = (SFNT_Service)face->sfnt;
497 if ( !sfnt )
498 {
500 if ( !sfnt )
501 {
502 FT_ERROR(( "sfnt_init_face: cannot access `sfnt' module\n" ));
503 return FT_THROW( Missing_Module );
504 }
505
506 face->sfnt = sfnt;
508 }
509
510 FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_CMAPS );
511
512#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
513 if ( !face->mm )
514 {
515 /* we want the MM interface from the `truetype' module only */
516 FT_Module tt_module = FT_Get_Module( library, "truetype" );
517
518
519 face->mm = ft_module_get_service( tt_module,
521 0 );
522 }
523
524 if ( !face->var )
525 {
526 /* we want the metrics variations interface */
527 /* from the `truetype' module only */
528 FT_Module tt_module = FT_Get_Module( library, "truetype" );
529
530
531 face->var = ft_module_get_service( tt_module,
533 0 );
534 }
535#endif
536
537 FT_TRACE2(( "SFNT driver\n" ));
538
540 face,
541 &face_instance_index,
542 &woff2_num_faces );
543 if ( error )
544 return error;
545
546 /* Stream may have changed in sfnt_open_font. */
547 stream = face->root.stream;
548
549 FT_TRACE2(( "sfnt_init_face: %p (index %d)\n",
550 (void *)face,
551 face_instance_index ));
552
553 face_index = FT_ABS( face_instance_index ) & 0xFFFF;
554
555 /* value -(N+1) requests information on index N */
556 if ( face_instance_index < 0 )
557 face_index--;
558
559 if ( face_index >= face->ttc_header.count )
560 {
561 if ( face_instance_index >= 0 )
562 return FT_THROW( Invalid_Argument );
563 else
564 face_index = 0;
565 }
566
567 if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) )
568 return error;
569
570 /* check whether we have a valid TrueType file */
572 if ( error )
573 return error;
574
575#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
576 {
577 FT_Memory memory = face->root.memory;
578
579 FT_ULong fvar_len;
580
583
584 FT_UShort num_axes;
585 FT_UShort axis_size;
586 FT_UShort num_instances;
587 FT_UShort instance_size;
588
589 FT_Int instance_index;
590
591 FT_Byte* default_values = NULL;
592 FT_Byte* instance_values = NULL;
593
594
595 instance_index = FT_ABS( face_instance_index ) >> 16;
596
597 /* test whether current face is a GX font with named instances */
598 if ( face->goto_table( face, TTAG_fvar, stream, &fvar_len ) ||
599 fvar_len < 20 ||
602 FT_STREAM_SKIP( 2 ) /* reserved */ ||
603 FT_READ_USHORT( num_axes ) ||
604 FT_READ_USHORT( axis_size ) ||
605 FT_READ_USHORT( num_instances ) ||
606 FT_READ_USHORT( instance_size ) )
607 {
608 version = 0;
609 offset = 0;
610 num_axes = 0;
611 axis_size = 0;
612 num_instances = 0;
613 instance_size = 0;
614 }
615
616 /* check that the data is bound by the table length */
617 if ( version != 0x00010000UL ||
618 axis_size != 20 ||
619 num_axes == 0 ||
620 /* `num_axes' limit implied by 16-bit `instance_size' */
621 num_axes > 0x3FFE ||
622 !( instance_size == 4 + 4 * num_axes ||
623 instance_size == 6 + 4 * num_axes ) ||
624 /* `num_instances' limit implied by limited range of name IDs */
625 num_instances > 0x7EFF ||
626 offset +
627 axis_size * num_axes +
628 instance_size * num_instances > fvar_len )
629 num_instances = 0;
630 else
631 face->variation_support |= TT_FACE_FLAG_VAR_FVAR;
632
633 /*
634 * As documented in the OpenType specification, an entry for the
635 * default instance may be omitted in the named instance table. In
636 * particular this means that even if there is no named instance
637 * table in the font we actually do have a named instance, namely the
638 * default instance.
639 *
640 * For consistency, we always want the default instance in our list
641 * of named instances. If it is missing, we try to synthesize it
642 * later on. Here, we have to adjust `num_instances' accordingly.
643 */
644
645 if ( ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) &&
646 !( FT_ALLOC( default_values, num_axes * 4 ) ||
647 FT_ALLOC( instance_values, num_axes * 4 ) ) )
648 {
649 /* the current stream position is 16 bytes after the table start */
650 FT_ULong array_start = FT_STREAM_POS() - 16 + offset;
651 FT_ULong default_value_offset, instance_offset;
652
653 FT_Byte* p;
654 FT_UInt i;
655
656
657 default_value_offset = array_start + 8;
658 p = default_values;
659
660 for ( i = 0; i < num_axes; i++ )
661 {
662 (void)FT_STREAM_READ_AT( default_value_offset, p, 4 );
663
664 default_value_offset += axis_size;
665 p += 4;
666 }
667
668 instance_offset = array_start + axis_size * num_axes + 4;
669
670 for ( i = 0; i < num_instances; i++ )
671 {
672 (void)FT_STREAM_READ_AT( instance_offset,
673 instance_values,
674 num_axes * 4 );
675
676 if ( !ft_memcmp( default_values, instance_values, num_axes * 4 ) )
677 break;
678
679 instance_offset += instance_size;
680 }
681
682 if ( i == num_instances )
683 {
684 /* no default instance in named instance table; */
685 /* we thus have to synthesize it */
686 num_instances++;
687 }
688 }
689
690 FT_FREE( default_values );
691 FT_FREE( instance_values );
692
693 /* we don't support Multiple Master CFFs yet; */
694 /* note that `glyf' or `CFF2' have precedence */
695 if ( face->goto_table( face, TTAG_glyf, stream, 0 ) &&
696 face->goto_table( face, TTAG_CFF2, stream, 0 ) &&
697 !face->goto_table( face, TTAG_CFF, stream, 0 ) )
698 num_instances = 0;
699
700 /* instance indices in `face_instance_index' start with index 1, */
701 /* thus `>' and not `>=' */
702 if ( instance_index > num_instances )
703 {
704 if ( face_instance_index >= 0 )
705 return FT_THROW( Invalid_Argument );
706 else
707 num_instances = 0;
708 }
709
710 face->root.style_flags = (FT_Long)num_instances << 16;
711 }
712#endif
713
714 face->root.num_faces = face->ttc_header.count;
715 face->root.face_index = face_instance_index;
716
717 /* `num_faces' for a WOFF2 needs to be handled separately. */
718 if ( woff2_num_faces )
719 face->root.num_faces = woff2_num_faces;
720
721 return error;
722 }
723
724
725#define LOAD_( x ) \
726 do \
727 { \
728 FT_TRACE2(( "`" #x "' " )); \
729 FT_TRACE3(( "-->\n" )); \
730 \
731 error = sfnt->load_ ## x( face, stream ); \
732 \
733 FT_TRACE2(( "%s\n", ( !error ) \
734 ? "loaded" \
735 : FT_ERR_EQ( error, Table_Missing ) \
736 ? "missing" \
737 : "failed to load" )); \
738 FT_TRACE3(( "\n" )); \
739 } while ( 0 )
740
741#define LOADM_( x, vertical ) \
742 do \
743 { \
744 FT_TRACE2(( "`%s" #x "' ", \
745 vertical ? "vertical " : "" )); \
746 FT_TRACE3(( "-->\n" )); \
747 \
748 error = sfnt->load_ ## x( face, stream, vertical ); \
749 \
750 FT_TRACE2(( "%s\n", ( !error ) \
751 ? "loaded" \
752 : FT_ERR_EQ( error, Table_Missing ) \
753 ? "missing" \
754 : "failed to load" )); \
755 FT_TRACE3(( "\n" )); \
756 } while ( 0 )
757
758#define GET_NAME( id, field ) \
759 do \
760 { \
761 error = tt_face_get_name( face, TT_NAME_ID_ ## id, field ); \
762 if ( error ) \
763 goto Exit; \
764 } while ( 0 )
765
766
770 FT_Int face_instance_index,
771 FT_Int num_params,
773 {
775#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
776 FT_Error psnames_error;
777#endif
778 FT_Bool has_outline;
779 FT_Bool is_apple_sbit;
780 FT_Bool is_apple_sbix;
781 FT_Bool has_CBLC;
782 FT_Bool has_CBDT;
783 FT_Bool ignore_typographic_family = FALSE;
784 FT_Bool ignore_typographic_subfamily = FALSE;
785
787
788 FT_UNUSED( face_instance_index );
789
790
791 /* Check parameters */
792
793 {
794 FT_Int i;
795
796
797 for ( i = 0; i < num_params; i++ )
798 {
800 ignore_typographic_family = TRUE;
802 ignore_typographic_subfamily = TRUE;
803 }
804 }
805
806 /* Load tables */
807
808 /* We now support two SFNT-based bitmapped font formats. They */
809 /* are recognized easily as they do not include a `glyf' */
810 /* table. */
811 /* */
812 /* The first format comes from Apple, and uses a table named */
813 /* `bhed' instead of `head' to store the font header (using */
814 /* the same format). It also doesn't include horizontal and */
815 /* vertical metrics tables (i.e. `hhea' and `vhea' tables are */
816 /* missing). */
817 /* */
818 /* The other format comes from Microsoft, and is used with */
819 /* WinCE/PocketPC. It looks like a standard TTF, except that */
820 /* it doesn't contain outlines. */
821 /* */
822
823 FT_TRACE2(( "sfnt_load_face: %p\n\n", (void *)face ));
824
825 /* do we have outlines in there? */
826#ifdef FT_CONFIG_OPTION_INCREMENTAL
827 has_outline = FT_BOOL( face->root.internal->incremental_interface ||
831#else
832 has_outline = FT_BOOL( tt_face_lookup_table( face, TTAG_glyf ) ||
835#endif
836
837 is_apple_sbit = 0;
838 is_apple_sbix = !face->goto_table( face, TTAG_sbix, stream, 0 );
839
840 /* Apple 'sbix' color bitmaps are rendered scaled and then the 'glyf'
841 * outline rendered on top. We don't support that yet, so just ignore
842 * the 'glyf' outline and advertise it as a bitmap-only font. */
843 if ( is_apple_sbix )
844 has_outline = FALSE;
845
846 /* if this font doesn't contain outlines, we try to load */
847 /* a `bhed' table */
848 if ( !has_outline && sfnt->load_bhed )
849 {
850 LOAD_( bhed );
851 is_apple_sbit = FT_BOOL( !error );
852 }
853
854 /* load the font header (`head' table) if this isn't an Apple */
855 /* sbit font file */
856 if ( !is_apple_sbit || is_apple_sbix )
857 {
858 LOAD_( head );
859 if ( error )
860 goto Exit;
861 }
862
863 has_CBLC = !face->goto_table( face, TTAG_CBLC, stream, 0 );
864 has_CBDT = !face->goto_table( face, TTAG_CBDT, stream, 0 );
865
866 /* Ignore outlines for CBLC/CBDT fonts. */
867 if ( has_CBLC || has_CBDT )
868 has_outline = FALSE;
869
870 /* OpenType 1.8.2 introduced limits to this value; */
871 /* however, they make sense for older SFNT fonts also */
872 if ( face->header.Units_Per_EM < 16 ||
873 face->header.Units_Per_EM > 16384 )
874 {
875 error = FT_THROW( Invalid_Table );
876
877 goto Exit;
878 }
879
880 /* the following tables are often not present in embedded TrueType */
881 /* fonts within PDF documents, so don't check for them. */
882 LOAD_( maxp );
883 LOAD_( cmap );
884
885 /* the following tables are optional in PCL fonts -- */
886 /* don't check for errors */
887 LOAD_( name );
888 LOAD_( post );
889
890#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
891 psnames_error = error;
892#endif
893
894 /* do not load the metrics headers and tables if this is an Apple */
895 /* sbit font file */
896 if ( !is_apple_sbit )
897 {
898 /* load the `hhea' and `hmtx' tables */
899 LOADM_( hhea, 0 );
900 if ( !error )
901 {
902 LOADM_( hmtx, 0 );
903 if ( FT_ERR_EQ( error, Table_Missing ) )
904 {
905 error = FT_THROW( Hmtx_Table_Missing );
906
907#ifdef FT_CONFIG_OPTION_INCREMENTAL
908 /* If this is an incrementally loaded font and there are */
909 /* overriding metrics, tolerate a missing `hmtx' table. */
910 if ( face->root.internal->incremental_interface &&
911 face->root.internal->incremental_interface->funcs->
912 get_glyph_metrics )
913 {
914 face->horizontal.number_Of_HMetrics = 0;
916 }
917#endif
918 }
919 }
920 else if ( FT_ERR_EQ( error, Table_Missing ) )
921 {
922 /* No `hhea' table necessary for SFNT Mac fonts. */
923 if ( face->format_tag == TTAG_true )
924 {
925 FT_TRACE2(( "This is an SFNT Mac font.\n" ));
926
927 has_outline = 0;
929 }
930 else
931 {
932 error = FT_THROW( Horiz_Header_Missing );
933
934#ifdef FT_CONFIG_OPTION_INCREMENTAL
935 /* If this is an incrementally loaded font and there are */
936 /* overriding metrics, tolerate a missing `hhea' table. */
937 if ( face->root.internal->incremental_interface &&
938 face->root.internal->incremental_interface->funcs->
939 get_glyph_metrics )
940 {
941 face->horizontal.number_Of_HMetrics = 0;
943 }
944#endif
945
946 }
947 }
948
949 if ( error )
950 goto Exit;
951
952 /* try to load the `vhea' and `vmtx' tables */
953 LOADM_( hhea, 1 );
954 if ( !error )
955 {
956 LOADM_( hmtx, 1 );
957 if ( !error )
958 face->vertical_info = 1;
959 }
960
961 if ( error && FT_ERR_NEQ( error, Table_Missing ) )
962 goto Exit;
963
964 LOAD_( os2 );
965 if ( error )
966 {
967 /* we treat the table as missing if there are any errors */
968 face->os2.version = 0xFFFFU;
969 }
970 }
971
972 /* the optional tables */
973
974 /* embedded bitmap support */
975 if ( sfnt->load_eblc )
976 LOAD_( eblc );
977
978 /* colored glyph support */
979 if ( sfnt->load_cpal )
980 {
981 LOAD_( cpal );
982 LOAD_( colr );
983 }
984
985 /* consider the pclt, kerning, and gasp tables as optional */
986 LOAD_( pclt );
987 LOAD_( gasp );
988 LOAD_( kern );
989
990 face->root.num_glyphs = face->max_profile.numGlyphs;
991
992 /* Bit 8 of the `fsSelection' field in the `OS/2' table denotes */
993 /* a WWS-only font face. `WWS' stands for `weight', width', and */
994 /* `slope', a term used by Microsoft's Windows Presentation */
995 /* Foundation (WPF). This flag has been introduced in version */
996 /* 1.5 of the OpenType specification (May 2008). */
997
998 face->root.family_name = NULL;
999 face->root.style_name = NULL;
1000 if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 256 )
1001 {
1002 if ( !ignore_typographic_family )
1003 GET_NAME( TYPOGRAPHIC_FAMILY, &face->root.family_name );
1004 if ( !face->root.family_name )
1005 GET_NAME( FONT_FAMILY, &face->root.family_name );
1006
1007 if ( !ignore_typographic_subfamily )
1008 GET_NAME( TYPOGRAPHIC_SUBFAMILY, &face->root.style_name );
1009 if ( !face->root.style_name )
1010 GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
1011 }
1012 else
1013 {
1014 GET_NAME( WWS_FAMILY, &face->root.family_name );
1015 if ( !face->root.family_name && !ignore_typographic_family )
1016 GET_NAME( TYPOGRAPHIC_FAMILY, &face->root.family_name );
1017 if ( !face->root.family_name )
1018 GET_NAME( FONT_FAMILY, &face->root.family_name );
1019
1020 GET_NAME( WWS_SUBFAMILY, &face->root.style_name );
1021 if ( !face->root.style_name && !ignore_typographic_subfamily )
1022 GET_NAME( TYPOGRAPHIC_SUBFAMILY, &face->root.style_name );
1023 if ( !face->root.style_name )
1024 GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
1025 }
1026
1027 /* now set up root fields */
1028 {
1029 FT_Face root = &face->root;
1030 FT_Long flags = root->face_flags;
1031
1032
1033 /**********************************************************************
1034 *
1035 * Compute face flags.
1036 */
1037 if ( face->sbit_table_type == TT_SBIT_TABLE_TYPE_CBLC ||
1038 face->sbit_table_type == TT_SBIT_TABLE_TYPE_SBIX ||
1039 face->colr )
1040 flags |= FT_FACE_FLAG_COLOR; /* color glyphs */
1041
1042 if ( has_outline == TRUE )
1043 flags |= FT_FACE_FLAG_SCALABLE; /* scalable outlines */
1044
1045 /* The sfnt driver only supports bitmap fonts natively, thus we */
1046 /* don't set FT_FACE_FLAG_HINTER. */
1047 flags |= FT_FACE_FLAG_SFNT | /* SFNT file format */
1048 FT_FACE_FLAG_HORIZONTAL; /* horizontal data */
1049
1050#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
1051 if ( !psnames_error &&
1052 face->postscript.FormatType != 0x00030000L )
1054#endif
1055
1056 /* fixed width font? */
1057 if ( face->postscript.isFixedPitch )
1059
1060 /* vertical information? */
1061 if ( face->vertical_info )
1063
1064 /* kerning available ? */
1065 if ( TT_FACE_HAS_KERNING( face ) )
1067
1068#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
1069 /* Don't bother to load the tables unless somebody asks for them. */
1070 /* No need to do work which will (probably) not be used. */
1071 if ( face->variation_support & TT_FACE_FLAG_VAR_FVAR )
1072 {
1073 if ( tt_face_lookup_table( face, TTAG_glyf ) != 0 &&
1076 if ( tt_face_lookup_table( face, TTAG_CFF2 ) != 0 )
1078 }
1079#endif
1080
1081 root->face_flags = flags;
1082
1083 /**********************************************************************
1084 *
1085 * Compute style flags.
1086 */
1087
1088 flags = 0;
1089 if ( has_outline == TRUE && face->os2.version != 0xFFFFU )
1090 {
1091 /* We have an OS/2 table; use the `fsSelection' field. Bit 9 */
1092 /* indicates an oblique font face. This flag has been */
1093 /* introduced in version 1.5 of the OpenType specification. */
1094
1095 if ( face->os2.fsSelection & 512 ) /* bit 9 */
1097 else if ( face->os2.fsSelection & 1 ) /* bit 0 */
1099
1100 if ( face->os2.fsSelection & 32 ) /* bit 5 */
1102 }
1103 else
1104 {
1105 /* this is an old Mac font, use the header field */
1106
1107 if ( face->header.Mac_Style & 1 )
1109
1110 if ( face->header.Mac_Style & 2 )
1112 }
1113
1114 root->style_flags |= flags;
1115
1116 /**********************************************************************
1117 *
1118 * Polish the charmaps.
1119 *
1120 * Try to set the charmap encoding according to the platform &
1121 * encoding ID of each charmap. Emulate Unicode charmap if one
1122 * is missing.
1123 */
1124
1125 tt_face_build_cmaps( face ); /* ignore errors */
1126
1127
1128 /* set the encoding fields */
1129 {
1130 FT_Int m;
1131#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
1132 FT_Bool has_unicode = FALSE;
1133#endif
1134
1135
1136 for ( m = 0; m < root->num_charmaps; m++ )
1137 {
1138 FT_CharMap charmap = root->charmaps[m];
1139
1140
1141 charmap->encoding = sfnt_find_encoding( charmap->platform_id,
1142 charmap->encoding_id );
1143
1144#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
1145
1146 if ( charmap->encoding == FT_ENCODING_UNICODE ||
1147 charmap->encoding == FT_ENCODING_MS_SYMBOL ) /* PUA */
1148 has_unicode = TRUE;
1149 }
1150
1151 /* synthesize Unicode charmap if one is missing */
1152 if ( !has_unicode )
1153 {
1154 FT_CharMapRec cmaprec;
1155
1156
1157 cmaprec.face = root;
1160 cmaprec.encoding = FT_ENCODING_UNICODE;
1161
1162
1164 NULL, &cmaprec, NULL );
1165 if ( error &&
1166 FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) &&
1167 FT_ERR_NEQ( error, Unimplemented_Feature ) )
1168 goto Exit;
1169 error = FT_Err_Ok;
1170
1171#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */
1172
1173 }
1174 }
1175
1176#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
1177
1178 /*
1179 * Now allocate the root array of FT_Bitmap_Size records and
1180 * populate them. Unfortunately, it isn't possible to indicate bit
1181 * depths in the FT_Bitmap_Size record. This is a design error.
1182 */
1183 {
1184 FT_UInt count;
1185
1186
1187 count = face->sbit_num_strikes;
1188
1189 if ( count > 0 )
1190 {
1191 FT_Memory memory = face->root.stream->memory;
1192 FT_UShort em_size = face->header.Units_Per_EM;
1193 FT_Short avgwidth = face->os2.xAvgCharWidth;
1195
1196 FT_UInt* sbit_strike_map = NULL;
1197 FT_UInt strike_idx, bsize_idx;
1198
1199
1200 if ( em_size == 0 || face->os2.version == 0xFFFFU )
1201 {
1202 avgwidth = 1;
1203 em_size = 1;
1204 }
1205
1206 /* to avoid invalid strike data in the `available_sizes' field */
1207 /* of `FT_Face', we map `available_sizes' indices to strike */
1208 /* indices */
1209 if ( FT_NEW_ARRAY( root->available_sizes, count ) ||
1210 FT_NEW_ARRAY( sbit_strike_map, count ) )
1211 goto Exit;
1212
1213 bsize_idx = 0;
1214 for ( strike_idx = 0; strike_idx < count; strike_idx++ )
1215 {
1216 FT_Bitmap_Size* bsize = root->available_sizes + bsize_idx;
1217
1218
1219 error = sfnt->load_strike_metrics( face, strike_idx, &metrics );
1220 if ( error )
1221 continue;
1222
1223 bsize->height = (FT_Short)( metrics.height >> 6 );
1224 bsize->width = (FT_Short)(
1225 ( avgwidth * metrics.x_ppem + em_size / 2 ) / em_size );
1226
1227 bsize->x_ppem = metrics.x_ppem << 6;
1228 bsize->y_ppem = metrics.y_ppem << 6;
1229
1230 /* assume 72dpi */
1231 bsize->size = metrics.y_ppem << 6;
1232
1233 /* only use strikes with valid PPEM values */
1234 if ( bsize->x_ppem && bsize->y_ppem )
1235 sbit_strike_map[bsize_idx++] = strike_idx;
1236 }
1237
1238 /* reduce array size to the actually used elements */
1239 (void)FT_RENEW_ARRAY( sbit_strike_map, count, bsize_idx );
1240
1241 /* from now on, all strike indices are mapped */
1242 /* using `sbit_strike_map' */
1243 if ( bsize_idx )
1244 {
1245 face->sbit_strike_map = sbit_strike_map;
1246
1247 root->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
1248 root->num_fixed_sizes = (FT_Int)bsize_idx;
1249 }
1250 }
1251 }
1252
1253#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
1254
1255 /* a font with no bitmaps and no outlines is scalable; */
1256 /* it has only empty glyphs then */
1257 if ( !FT_HAS_FIXED_SIZES( root ) && !FT_IS_SCALABLE( root ) )
1258 root->face_flags |= FT_FACE_FLAG_SCALABLE;
1259
1260
1261 /**********************************************************************
1262 *
1263 * Set up metrics.
1264 */
1265 if ( FT_IS_SCALABLE( root ) )
1266 {
1267 /* XXX What about if outline header is missing */
1268 /* (e.g. sfnt wrapped bitmap)? */
1269 root->bbox.xMin = face->header.xMin;
1270 root->bbox.yMin = face->header.yMin;
1271 root->bbox.xMax = face->header.xMax;
1272 root->bbox.yMax = face->header.yMax;
1273 root->units_per_EM = face->header.Units_Per_EM;
1274
1275
1276 /*
1277 * Computing the ascender/descender/height is tricky.
1278 *
1279 * The OpenType specification v1.8.3 says:
1280 *
1281 * [OS/2's] sTypoAscender, sTypoDescender and sTypoLineGap fields
1282 * are intended to allow applications to lay out documents in a
1283 * typographically-correct and portable fashion.
1284 *
1285 * This is somewhat at odds with the decades of backwards
1286 * compatibility, operating systems and applications doing whatever
1287 * they want, not to mention broken fonts.
1288 *
1289 * Not all fonts have an OS/2 table; in this case, we take the values
1290 * in the horizontal header, although there is nothing stopping the
1291 * values from being unreliable. Even with a OS/2 table, certain fonts
1292 * set the sTypoAscender, sTypoDescender and sTypoLineGap fields to 0
1293 * and instead correctly set usWinAscent and usWinDescent.
1294 *
1295 * As an example, Arial Narrow is shipped as four files ARIALN.TTF,
1296 * ARIALNI.TTF, ARIALNB.TTF and ARIALNBI.TTF. Strangely, all fonts have
1297 * the same values in their sTypo* fields, except ARIALNB.ttf which
1298 * sets them to 0. All of them have different usWinAscent/Descent
1299 * values. The OS/2 table therefore cannot be trusted for computing the
1300 * text height reliably.
1301 *
1302 * As a compromise, do the following:
1303 *
1304 * 1. If the OS/2 table exists and the fsSelection bit 7 is set
1305 * (USE_TYPO_METRICS), trust the font and use the sTypo* metrics.
1306 * 2. Otherwise, use the `hhea' table's metrics.
1307 * 3. If they are zero and the OS/2 table exists,
1308 * 1. use the OS/2 table's sTypo* metrics if they are non-zero.
1309 * 2. Otherwise, use the OS/2 table's usWin* metrics.
1310 */
1311
1312 if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 128 )
1313 {
1314 root->ascender = face->os2.sTypoAscender;
1315 root->descender = face->os2.sTypoDescender;
1316 root->height = root->ascender - root->descender +
1317 face->os2.sTypoLineGap;
1318 }
1319 else
1320 {
1321 root->ascender = face->horizontal.Ascender;
1322 root->descender = face->horizontal.Descender;
1323 root->height = root->ascender - root->descender +
1324 face->horizontal.Line_Gap;
1325
1326 if ( !( root->ascender || root->descender ) )
1327 {
1328 if ( face->os2.version != 0xFFFFU )
1329 {
1330 if ( face->os2.sTypoAscender || face->os2.sTypoDescender )
1331 {
1332 root->ascender = face->os2.sTypoAscender;
1333 root->descender = face->os2.sTypoDescender;
1334 root->height = root->ascender - root->descender +
1335 face->os2.sTypoLineGap;
1336 }
1337 else
1338 {
1339 root->ascender = (FT_Short)face->os2.usWinAscent;
1340 root->descender = -(FT_Short)face->os2.usWinDescent;
1341 root->height = root->ascender - root->descender;
1342 }
1343 }
1344 }
1345 }
1346
1347 root->max_advance_width =
1348 (FT_Short)face->horizontal.advance_Width_Max;
1349 root->max_advance_height =
1350 (FT_Short)( face->vertical_info ? face->vertical.advance_Height_Max
1351 : root->height );
1352
1353 /* See https://www.microsoft.com/typography/otspec/post.htm -- */
1354 /* Adjust underline position from top edge to centre of */
1355 /* stroke to convert TrueType meaning to FreeType meaning. */
1356 root->underline_position = face->postscript.underlinePosition -
1357 face->postscript.underlineThickness / 2;
1358 root->underline_thickness = face->postscript.underlineThickness;
1359 }
1360
1361 }
1362
1363 Exit:
1364 FT_TRACE2(( "sfnt_load_face: done\n" ));
1365
1366 return error;
1367 }
1368
1369
1370#undef LOAD_
1371#undef LOADM_
1372#undef GET_NAME
1373
1374
1375 FT_LOCAL_DEF( void )
1377 {
1380
1381
1382 if ( !face )
1383 return;
1384
1385 memory = face->root.memory;
1386 sfnt = (SFNT_Service)face->sfnt;
1387
1388 if ( sfnt )
1389 {
1390 /* destroy the postscript names table if it is loaded */
1391 if ( sfnt->free_psnames )
1393
1394 /* destroy the embedded bitmaps table if it is loaded */
1395 if ( sfnt->free_eblc )
1396 sfnt->free_eblc( face );
1397
1398 /* destroy color table data if it is loaded */
1399 if ( sfnt->free_cpal )
1400 {
1401 sfnt->free_cpal( face );
1402 sfnt->free_colr( face );
1403 }
1404 }
1405
1406#ifdef TT_CONFIG_OPTION_BDF
1407 /* freeing the embedded BDF properties */
1408 tt_face_free_bdf_props( face );
1409#endif
1410
1411 /* freeing the kerning table */
1413
1414 /* freeing the collection table */
1415 FT_FREE( face->ttc_header.offsets );
1416 face->ttc_header.count = 0;
1417
1418 /* freeing table directory */
1419 FT_FREE( face->dir_tables );
1420 face->num_tables = 0;
1421
1422 {
1424
1425
1426 /* simply release the 'cmap' table frame */
1427 FT_FRAME_RELEASE( face->cmap_table );
1428 face->cmap_size = 0;
1429 }
1430
1431 face->horz_metrics_size = 0;
1432 face->vert_metrics_size = 0;
1433
1434 /* freeing vertical metrics, if any */
1435 if ( face->vertical_info )
1436 {
1437 FT_FREE( face->vertical.long_metrics );
1438 FT_FREE( face->vertical.short_metrics );
1439 face->vertical_info = 0;
1440 }
1441
1442 /* freeing the gasp table */
1443 FT_FREE( face->gasp.gaspRanges );
1444 face->gasp.numRanges = 0;
1445
1446 /* freeing the name table */
1447 if ( sfnt )
1448 sfnt->free_name( face );
1449
1450 /* freeing family and style name */
1451 FT_FREE( face->root.family_name );
1452 FT_FREE( face->root.style_name );
1453
1454 /* freeing sbit size table */
1455 FT_FREE( face->root.available_sizes );
1456 FT_FREE( face->sbit_strike_map );
1457 face->root.num_fixed_sizes = 0;
1458
1459 FT_FREE( face->postscript_name );
1460
1461#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
1462 FT_FREE( face->var_postscript_prefix );
1463#endif
1464
1465 /* freeing glyph color palette data */
1466 FT_FREE( face->palette_data.palette_name_ids );
1467 FT_FREE( face->palette_data.palette_flags );
1468 FT_FREE( face->palette_data.palette_entry_name_ids );
1469 FT_FREE( face->palette );
1470
1471 face->sfnt = NULL;
1472 }
1473
1474
1475/* END */
#define read
Definition: acwin.h:96
struct outqueuenode * head
Definition: adnsresfilter.c:66
struct _root root
FT_Library library
Definition: cffdrivr.c:660
#define FT_LOCAL_DEF(x)
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR version[]
Definition: asmname.c:66
#define TT_MS_ID_UNICODE_CS
Definition: font.c:1181
#define TT_PLATFORM_MICROSOFT
Definition: font.c:1174
#define TT_PLATFORM_MACINTOSH
Definition: font.c:1173
#define TT_MS_ID_SYMBOL_CS
Definition: font.c:1180
#define TT_PLATFORM_APPLE_UNICODE
Definition: font.c:1172
unsigned char
Definition: typeof.h:29
#define FT_FACE_FLAG_KERNING
Definition: freetype.h:1203
#define FT_FACE_FLAG_SFNT
Definition: freetype.h:1200
#define FT_STYLE_FLAG_ITALIC
Definition: freetype.h:1475
#define FT_FACE_FLAG_FIXED_SIZES
Definition: freetype.h:1198
#define FT_FACE_FLAG_SCALABLE
Definition: freetype.h:1197
#define FT_FACE_FLAG_FIXED_WIDTH
Definition: freetype.h:1199
#define FT_HAS_FIXED_SIZES(face)
Definition: freetype.h:1320
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1271
#define FT_FACE_FLAG_VERTICAL
Definition: freetype.h:1202
#define FT_FACE_FLAG_GLYPH_NAMES
Definition: freetype.h:1206
enum FT_Encoding_ FT_Encoding
#define FT_FACE_FLAG_COLOR
Definition: freetype.h:1211
#define FT_FACE_FLAG_MULTIPLE_MASTERS
Definition: freetype.h:1205
#define FT_STYLE_FLAG_BOLD
Definition: freetype.h:1476
#define FT_FACE_FLAG_HORIZONTAL
Definition: freetype.h:1201
return FT_Err_Ok
Definition: ftbbox.c:526
#define FT_ASSERT(condition)
Definition: ftdebug.h:241
#define FT_ERROR(varformat)
Definition: ftdebug.h:211
#define FT_TRACE3(varformat)
Definition: ftdebug.h:190
#define FT_THROW(e)
Definition: ftdebug.h:243
#define FT_TRACE2(varformat)
Definition: ftdebug.h:189
#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_RENEW_ARRAY(ptr, curcnt, newcnt)
Definition: ftmemory.h:344
#define FT_QNEW_ARRAY(ptr, count)
Definition: ftmemory.h:350
FT_Get_Module(FT_Library library, const char *module_name)
Definition: ftobjs.c:4984
#define FT_ABS(a)
Definition: ftobjs.h:73
ft_module_get_service(FT_Module module, const char *service_id, FT_Bool global)
Definition: ftobjs.c:5027
#define FT_FACE_STREAM(x)
Definition: ftobjs.h:604
FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
Definition: ftobjs.c:3677
FT_Get_Module_Interface(FT_Library library, const char *mod_name)
Definition: ftobjs.c:5012
#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY
Definition: ftparams.h:68
#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY
Definition: ftparams.h:92
#define FT_FACE_FIND_GLOBAL_SERVICE(face, ptr, id)
Definition: ftserv.h:128
#define ft_memcmp
Definition: ftstdlib.h:81
#define FT_FRAME_ENTER(size)
Definition: ftstream.h:548
#define FT_READ_USHORT(var)
Definition: ftstream.h:339
#define FT_FRAME_END
Definition: ftstream.h:118
#define FT_GET_ULONG()
Definition: ftstream.h:315
#define FT_FRAME_RELEASE(bytes)
Definition: ftstream.h:562
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:525
#define FT_READ_ULONG(var)
Definition: ftstream.h:343
#define FT_NEXT_USHORT(buffer)
Definition: ftstream.h:244
#define FT_STREAM_POS()
Definition: ftstream.h:522
#define FT_FRAME_EXIT()
Definition: ftstream.h:553
#define FT_STREAM_READ_FIELDS(fields, object)
Definition: ftstream.h:544
#define FT_STREAM_SKIP(distance)
Definition: ftstream.h:529
#define FT_STREAM_READ_AT(position, buffer, count)
Definition: ftstream.h:538
#define FT_STREAM_READ(buffer, count)
Definition: ftstream.h:533
#define FT_FRAME_START(size)
Definition: ftstream.h:117
#define FT_FRAME_LONG(f)
Definition: ftstream.h:120
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_NEQ(x, e)
Definition: fttypes.h:606
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
FxCollectionEntry * cur
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble n
Definition: glext.h:7729
GLintptr offset
Definition: glext.h:5920
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:11745
GLint limit
Definition: glext.h:10326
GLenum const GLfloat * params
Definition: glext.h:5645
GLbitfield flags
Definition: glext.h:7161
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
const GLfloat * m
Definition: glext.h:10848
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
uint32_t entry
Definition: isohybrid.c:63
if(dx< 0)
Definition: linetemp.h:194
#define error(str)
Definition: mkdosfs.c:1605
char string[160]
Definition: util.h:11
static char memory[1024 *256]
Definition: process.c:122
static BOOL is_english
Definition: run.c:155
int convert
Definition: msacm.c:1374
#define FT_UNUSED(arg)
SFNT_Interface * SFNT_Service
Definition: sfnt.h:784
#define LOADM_(x, vertical)
Definition: sfobjs.c:741
FT_String *(* TT_Name_ConvertFunc)(TT_Name entry, FT_Memory memory)
Definition: sfobjs.c:125
#define GET_NAME(id, field)
Definition: sfobjs.c:758
tt_face_get_name(TT_Face face, FT_UShort nameid, FT_String **name)
Definition: sfobjs.c:132
static FT_String * tt_name_ascii_from_utf16(TT_Name entry, FT_Memory memory)
Definition: sfobjs.c:57
#define LOAD_(x)
Definition: sfobjs.c:725
sfnt_init_face(FT_Stream stream, TT_Face face, FT_Int face_instance_index, FT_Int num_params, FT_Parameter *params)
Definition: sfobjs.c:478
sfnt_load_face(FT_Stream stream, TT_Face face, FT_Int face_instance_index, FT_Int num_params, FT_Parameter *params)
Definition: sfobjs.c:768
static FT_Error sfnt_open_font(FT_Stream stream, TT_Face face, FT_Int *face_instance_index, FT_Long *woff2_num_faces)
Definition: sfobjs.c:343
sfnt_done_face(TT_Face face)
Definition: sfobjs.c:1376
static FT_Encoding sfnt_find_encoding(int platform_id, int encoding_id)
Definition: sfobjs.c:290
static FT_String * tt_name_ascii_from_other(TT_Name entry, FT_Memory memory)
Definition: sfobjs.c:92
woff2_open_font(FT_Stream stream, TT_Face face, FT_Int *face_instance_index, FT_Long *num_faces)
Definition: sfwoff2.c:1750
woff_open_font(FT_Stream stream, TT_Face face)
Definition: sfwoff.c:93
static void Exit(void)
Definition: sock.c:1330
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
TT_Free_Table_Func free_eblc
Definition: sfnt.h:762
TT_Free_Table_Func free_name
Definition: sfnt.h:731
TT_Load_Strike_Metrics_Func load_strike_metrics
Definition: sfnt.h:765
TT_Load_Table_Func load_eblc
Definition: sfnt.h:761
TT_Free_Table_Func free_cpal
Definition: sfnt.h:769
TT_Load_Table_Func load_font_dir
Definition: sfnt.h:758
TT_Free_Table_Func free_psnames
Definition: sfnt.h:747
TT_Load_Table_Func load_bhed
Definition: sfnt.h:741
TT_Free_Table_Func free_colr
Definition: sfnt.h:770
TT_Loader_GotoTableFunc goto_table
Definition: sfnt.h:712
TT_Load_Table_Func load_cpal
Definition: sfnt.h:767
FT_ULong stringOffset
Definition: tttypes.h:228
FT_Byte * string
Definition: tttypes.h:233
FT_UShort languageID
Definition: tttypes.h:225
FT_UShort stringLength
Definition: tttypes.h:227
FT_UShort encodingID
Definition: tttypes.h:224
FT_UShort platformID
Definition: tttypes.h:223
FT_UShort nameID
Definition: tttypes.h:226
Definition: inflate.c:139
Definition: name.c:39
Definition: parse.h:23
unsigned int size
Definition: parse.h:27
Definition: ecma_167.h:138
#define FT_SERVICE_ID_METRICS_VARIATIONS
Definition: svmetric.h:33
#define FT_SERVICE_ID_MULTI_MASTERS
Definition: svmm.h:35
tt_face_build_cmaps(TT_Face face)
Definition: ttcmap.c:3780
FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap_unicode_class_rec
Definition: ttcmap.h:110
SFNT_Service sfnt
Definition: ttdriver.c:208
tt_face_done_kern(TT_Face face)
Definition: ttkern.c:172
#define TT_FACE_HAS_KERNING(face)
Definition: ttkern.h:43
tt_face_lookup_table(TT_Face face, FT_ULong tag)
Definition: ttload.c:57
#define TT_MS_ID_WANSUNG
Definition: ttnameid.h:252
#define TT_MS_ID_PRC
Definition: ttnameid.h:250
#define TT_MS_ID_SJIS
Definition: ttnameid.h:249
#define TT_MAC_LANGID_ENGLISH
Definition: ttnameid.h:302
#define TT_MAC_ID_ROMAN
Definition: ttnameid.h:147
#define TT_MS_ID_BIG_5
Definition: ttnameid.h:251
#define TT_PLATFORM_ISO
Definition: ttnameid.h:88
#define TT_MS_ID_UCS_4
Definition: ttnameid.h:254
#define TT_MS_ID_JOHAB
Definition: ttnameid.h:253
#define TTAG_true
Definition: tttags.h:99
#define TTAG_0xA5kbd
Definition: tttags.h:112
#define TTAG_0xA5lst
Definition: tttags.h:115
#define TTAG_fvar
Definition: tttags.h:59
#define TTAG_OTTO
Definition: tttags.h:89
#define TTAG_wOFF
Definition: tttags.h:108
#define TTAG_CBDT
Definition: tttags.h:42
#define TTAG_typ1
Definition: tttags.h:103
#define TTAG_CBLC
Definition: tttags.h:43
#define TTAG_gvar
Definition: tttags.h:65
#define TTAG_sbix
Definition: tttags.h:95
#define TTAG_ttcf
Definition: tttags.h:101
#define TTAG_CFF2
Definition: tttags.h:45
#define TTAG_glyf
Definition: tttags.h:62
#define TTAG_wOF2
Definition: tttags.h:109
#define TTAG_CFF
Definition: tttags.h:44
@ TT_SBIT_TABLE_TYPE_CBLC
Definition: tttypes.h:1112
@ TT_SBIT_TABLE_TYPE_SBIX
Definition: tttypes.h:1113
#define TT_FACE_FLAG_VAR_FVAR
Definition: tttypes.h:1132