ReactOS 0.4.16-dev-2332-g4cba65d
afmparse.c
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * afmparse.c
4 *
5 * AFM parser (body).
6 *
7 * Copyright (C) 2006-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#include <freetype/freetype.h>
21
22#ifndef T1_CONFIG_OPTION_NO_AFM
23
24#include "afmparse.h"
25#include "psconv.h"
26
27#include "psauxerr.h"
28
29
30 /**************************************************************************
31 *
32 * AFM_Stream
33 *
34 * The use of AFM_Stream is largely inspired by parseAFM.[ch] from t1lib.
35 *
36 */
37
38 enum
39 {
44 };
45
46
47 typedef struct AFM_StreamRec_
48 {
52
54
56
57
58#ifndef EOF
59#define EOF -1
60#endif
61
62
63 /* this works because empty lines are ignored */
64#define AFM_IS_NEWLINE( ch ) ( (ch) == '\r' || (ch) == '\n' )
65
66#define AFM_IS_EOF( ch ) ( (ch) == EOF || (ch) == '\x1a' )
67#define AFM_IS_SPACE( ch ) ( (ch) == ' ' || (ch) == '\t' )
68
69 /* column separator; there is no `column' in the spec actually */
70#define AFM_IS_SEP( ch ) ( (ch) == ';' )
71
72#define AFM_GETC() \
73 ( ( (stream)->cursor < (stream)->limit ) ? *(stream)->cursor++ \
74 : EOF )
75
76#define AFM_STREAM_KEY_BEGIN( stream ) \
77 (char*)( (stream)->cursor - 1 )
78
79#define AFM_STREAM_KEY_LEN( stream, key ) \
80 (FT_Offset)( (char*)(stream)->cursor - key - 1 )
81
82#define AFM_STATUS_EOC( stream ) \
83 ( (stream)->status >= AFM_STREAM_STATUS_EOC )
84
85#define AFM_STATUS_EOL( stream ) \
86 ( (stream)->status >= AFM_STREAM_STATUS_EOL )
87
88#define AFM_STATUS_EOF( stream ) \
89 ( (stream)->status >= AFM_STREAM_STATUS_EOF )
90
91
92 static int
94 {
95 int ch = 0; /* make stupid compiler happy */
96
97
98 if ( AFM_STATUS_EOC( stream ) )
99 return ';';
100
101 while ( 1 )
102 {
103 ch = AFM_GETC();
104 if ( !AFM_IS_SPACE( ch ) )
105 break;
106 }
107
108 if ( AFM_IS_NEWLINE( ch ) )
110 else if ( AFM_IS_SEP( ch ) )
112 else if ( AFM_IS_EOF( ch ) )
114
115 return ch;
116 }
117
118
119 /* read a key or value in current column */
120 static char*
122 {
123 char* str;
124
125
127 if ( AFM_STATUS_EOC( stream ) )
128 return NULL;
129
131
132 while ( 1 )
133 {
134 int ch = AFM_GETC();
135
136
137 if ( AFM_IS_SPACE( ch ) )
138 break;
139 else if ( AFM_IS_NEWLINE( ch ) )
140 {
142 break;
143 }
144 else if ( AFM_IS_SEP( ch ) )
145 {
147 break;
148 }
149 else if ( AFM_IS_EOF( ch ) )
150 {
152 break;
153 }
154 }
155
156 return str;
157 }
158
159
160 /* read a string (i.e., read to EOL) */
161 static char*
163 {
164 char* str;
165
166
168 if ( AFM_STATUS_EOL( stream ) )
169 return NULL;
170
172
173 /* scan to eol */
174 while ( 1 )
175 {
176 int ch = AFM_GETC();
177
178
179 if ( AFM_IS_NEWLINE( ch ) )
180 {
182 break;
183 }
184 else if ( AFM_IS_EOF( ch ) )
185 {
187 break;
188 }
189 }
190
191 return str;
192 }
193
194
195 /**************************************************************************
196 *
197 * AFM_Parser
198 *
199 */
200
201 /* all keys defined in Ch. 7-10 of 5004.AFM_Spec.pdf */
202 typedef enum AFM_Token_
203 {
280
282
283
284 static const char* const afm_key_table[N_AFM_TOKENS] =
285 {
286 "Ascender",
287 "AxisLabel",
288 "AxisType",
289 "B",
290 "BlendAxisTypes",
291 "BlendDesignMap",
292 "BlendDesignPositions",
293 "C",
294 "CC",
295 "CH",
296 "CapHeight",
297 "CharWidth",
298 "CharacterSet",
299 "Characters",
300 "Descender",
301 "EncodingScheme",
302 "EndAxis",
303 "EndCharMetrics",
304 "EndComposites",
305 "EndDirection",
306 "EndFontMetrics",
307 "EndKernData",
308 "EndKernPairs",
309 "EndTrackKern",
310 "EscChar",
311 "FamilyName",
312 "FontBBox",
313 "FontName",
314 "FullName",
315 "IsBaseFont",
316 "IsCIDFont",
317 "IsFixedPitch",
318 "IsFixedV",
319 "ItalicAngle",
320 "KP",
321 "KPH",
322 "KPX",
323 "KPY",
324 "L",
325 "MappingScheme",
326 "MetricsSets",
327 "N",
328 "Notice",
329 "PCC",
330 "StartAxis",
331 "StartCharMetrics",
332 "StartComposites",
333 "StartDirection",
334 "StartFontMetrics",
335 "StartKernData",
336 "StartKernPairs",
337 "StartKernPairs0",
338 "StartKernPairs1",
339 "StartTrackKern",
340 "StdHW",
341 "StdVW",
342 "TrackKern",
343 "UnderlinePosition",
344 "UnderlineThickness",
345 "VV",
346 "VVector",
347 "Version",
348 "W",
349 "W0",
350 "W0X",
351 "W0Y",
352 "W1",
353 "W1X",
354 "W1Y",
355 "WX",
356 "WY",
357 "Weight",
358 "WeightVector",
359 "XHeight"
360 };
361
362
363 /*
364 * `afm_parser_read_vals' and `afm_parser_next_key' provide
365 * high-level operations to an AFM_Stream. The rest of the
366 * parser functions should use them without accessing the
367 * AFM_Stream directly.
368 */
369
372 AFM_Value vals,
373 FT_Int n )
374 {
375 AFM_Stream stream = parser->stream;
376 char* str;
377 FT_Int i;
378
379
380 if ( n > AFM_MAX_ARGUMENTS )
381 return 0;
382
383 for ( i = 0; i < n; i++ )
384 {
386 AFM_Value val = vals + i;
387
388
389 if ( val->type == AFM_VALUE_TYPE_STRING )
391 else
393
394 if ( !str )
395 break;
396
398
399 switch ( val->type )
400 {
403 {
404 FT_Memory memory = parser->memory;
406
407
408 if ( !FT_QALLOC( val->u.s, len + 1 ) )
409 {
410 ft_memcpy( val->u.s, str, len );
411 val->u.s[len] = '\0';
412 }
413 }
414 break;
415
417 val->u.f = PS_Conv_ToFixed( (FT_Byte**)(void*)&str,
418 (FT_Byte*)str + len, 0 );
419 break;
420
422 val->u.i = PS_Conv_ToInt( (FT_Byte**)(void*)&str,
423 (FT_Byte*)str + len );
424 break;
425
427 val->u.b = FT_BOOL( len == 4 &&
428 !ft_strncmp( str, "true", 4 ) );
429 break;
430
432 if ( parser->get_index )
433 val->u.i = parser->get_index( str, len, parser->user_data );
434 else
435 val->u.i = 0;
436 break;
437 }
438 }
439
440 return i;
441 }
442
443
444 FT_LOCAL_DEF( char* )
447 FT_Offset* len )
448 {
449 AFM_Stream stream = parser->stream;
450 char* key = NULL; /* make stupid compiler happy */
451
452
453 if ( line )
454 {
455 while ( 1 )
456 {
457 /* skip current line */
458 if ( !AFM_STATUS_EOL( stream ) )
460
463
464 /* skip empty line */
465 if ( !key &&
468 continue;
469
470 break;
471 }
472 }
473 else
474 {
475 while ( 1 )
476 {
477 /* skip current column */
478 while ( !AFM_STATUS_EOC( stream ) )
480
483
484 /* skip empty column */
485 if ( !key &&
488 continue;
489
490 break;
491 }
492 }
493
494 if ( len )
496 : 0;
497
498 return key;
499 }
500
501
502 static AFM_Token
503 afm_tokenize( const char* key,
504 FT_Offset len )
505 {
506 int n;
507
508
509 for ( n = 0; n < N_AFM_TOKENS; n++ )
510 {
511 if ( *( afm_key_table[n] ) == *key )
512 {
513 for ( ; n < N_AFM_TOKENS; n++ )
514 {
515 if ( *( afm_key_table[n] ) != *key )
516 return AFM_TOKEN_UNKNOWN;
517
518 if ( ft_strncmp( afm_key_table[n], key, len ) == 0 )
519 return (AFM_Token) n;
520 }
521 }
522 }
523
524 return AFM_TOKEN_UNKNOWN;
525 }
526
527
531 FT_Byte* base,
532 FT_Byte* limit )
533 {
536
537
538 if ( FT_NEW( stream ) )
539 return error;
540
541 stream->cursor = stream->base = base;
542 stream->limit = limit;
543
544 /* don't skip the first line during the first call */
546
547 parser->memory = memory;
548 parser->stream = stream;
549 parser->FontInfo = NULL;
550 parser->get_index = NULL;
551
552 return FT_Err_Ok;
553 }
554
555
556 FT_LOCAL( void )
558 {
559 FT_Memory memory = parser->memory;
560
561
562 FT_FREE( parser->stream );
563 }
564
565
566 static FT_Error
568 FT_Int* aint )
569 {
571
572
574
575 if ( afm_parser_read_vals( parser, &val, 1 ) == 1 )
576 {
577 *aint = val.u.i;
578
579 return FT_Err_Ok;
580 }
581 else
582 return FT_THROW( Syntax_Error );
583 }
584
585
586 static FT_Error
588 {
589 AFM_FontInfo fi = parser->FontInfo;
590 AFM_TrackKern tk;
591 char* key;
593 int n = -1;
594 FT_Int tmp;
595
596
597 if ( afm_parser_read_int( parser, &tmp ) )
598 goto Fail;
599
600 if ( tmp < 0 )
601 goto Fail;
602
603 fi->NumTrackKern = (FT_UInt)tmp;
604
605 if ( fi->NumTrackKern )
606 {
607 FT_Memory memory = parser->memory;
609
610
611 if ( FT_QNEW_ARRAY( fi->TrackKerns, fi->NumTrackKern ) )
612 return error;
613 }
614
615 while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
616 {
617 AFM_ValueRec shared_vals[5];
618
619
620 switch ( afm_tokenize( key, len ) )
621 {
623 n++;
624
625 if ( n >= (int)fi->NumTrackKern )
626 goto Fail;
627
628 tk = fi->TrackKerns + n;
629
630 shared_vals[0].type = AFM_VALUE_TYPE_INTEGER;
631 shared_vals[1].type = AFM_VALUE_TYPE_FIXED;
632 shared_vals[2].type = AFM_VALUE_TYPE_FIXED;
633 shared_vals[3].type = AFM_VALUE_TYPE_FIXED;
634 shared_vals[4].type = AFM_VALUE_TYPE_FIXED;
635 if ( afm_parser_read_vals( parser, shared_vals, 5 ) != 5 )
636 goto Fail;
637
638 tk->degree = shared_vals[0].u.i;
639 tk->min_ptsize = shared_vals[1].u.f;
640 tk->min_kern = shared_vals[2].u.f;
641 tk->max_ptsize = shared_vals[3].u.f;
642 tk->max_kern = shared_vals[4].u.f;
643
644 break;
645
649 fi->NumTrackKern = (FT_UInt)( n + 1 );
650 return FT_Err_Ok;
651
653 break;
654
655 default:
656 goto Fail;
657 }
658 }
659
660 Fail:
661 return FT_THROW( Syntax_Error );
662 }
663
664
665#undef KERN_INDEX
666#define KERN_INDEX( g1, g2 ) ( ( (FT_ULong)g1 << 16 ) | g2 )
667
668
669 /* compare two kerning pairs */
670 FT_CALLBACK_DEF( int )
672 const void* b )
673 {
676
677 FT_ULong index1 = KERN_INDEX( kp1->index1, kp1->index2 );
678 FT_ULong index2 = KERN_INDEX( kp2->index1, kp2->index2 );
679
680
681 if ( index1 > index2 )
682 return 1;
683 else if ( index1 < index2 )
684 return -1;
685 else
686 return 0;
687 }
688
689
690 static FT_Error
692 {
693 AFM_FontInfo fi = parser->FontInfo;
694 AFM_KernPair kp;
695 char* key;
697 int n = -1;
698 FT_Int tmp;
699
700
701 if ( afm_parser_read_int( parser, &tmp ) )
702 goto Fail;
703
704 if ( tmp < 0 )
705 goto Fail;
706
707 fi->NumKernPair = (FT_UInt)tmp;
708
709 if ( fi->NumKernPair )
710 {
711 FT_Memory memory = parser->memory;
713
714
715 if ( FT_QNEW_ARRAY( fi->KernPairs, fi->NumKernPair ) )
716 return error;
717 }
718
719 while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
720 {
722
723
724 switch ( token )
725 {
726 case AFM_TOKEN_KP:
727 case AFM_TOKEN_KPX:
728 case AFM_TOKEN_KPY:
729 {
730 FT_Int r;
731 AFM_ValueRec shared_vals[4];
732
733
734 n++;
735
736 if ( n >= (int)fi->NumKernPair )
737 goto Fail;
738
739 kp = fi->KernPairs + n;
740
741 shared_vals[0].type = AFM_VALUE_TYPE_INDEX;
742 shared_vals[1].type = AFM_VALUE_TYPE_INDEX;
743 shared_vals[2].type = AFM_VALUE_TYPE_INTEGER;
744 shared_vals[3].type = AFM_VALUE_TYPE_INTEGER;
745 r = afm_parser_read_vals( parser, shared_vals, 4 );
746 if ( r < 3 )
747 goto Fail;
748
749 /* index values can't be negative */
750 kp->index1 = shared_vals[0].u.u;
751 kp->index2 = shared_vals[1].u.u;
752 if ( token == AFM_TOKEN_KPY )
753 {
754 kp->x = 0;
755 kp->y = shared_vals[2].u.i;
756 }
757 else
758 {
759 kp->x = shared_vals[2].u.i;
760 kp->y = ( token == AFM_TOKEN_KP && r == 4 )
761 ? shared_vals[3].u.i : 0;
762 }
763 }
764 break;
765
769 fi->NumKernPair = (FT_UInt)( n + 1 );
773 return FT_Err_Ok;
774
776 break;
777
778 default:
779 goto Fail;
780 }
781 }
782
783 Fail:
784 return FT_THROW( Syntax_Error );
785 }
786
787
788 static FT_Error
790 {
792 char* key;
794
795
796 while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
797 {
798 switch ( afm_tokenize( key, len ) )
799 {
802 if ( error )
803 return error;
804 break;
805
809 if ( error )
810 return error;
811 break;
812
815 return FT_Err_Ok;
816
818 break;
819
820 default:
821 goto Fail;
822 }
823 }
824
825 Fail:
826 return FT_THROW( Syntax_Error );
827 }
828
829
830 static FT_Error
832 FT_Int n,
833 AFM_Token end_section )
834 {
835 char* key;
837
838
839 while ( n-- > 0 )
840 {
842 if ( !key )
843 goto Fail;
844 }
845
846 while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
847 {
849
850
851 if ( token == end_section || token == AFM_TOKEN_ENDFONTMETRICS )
852 return FT_Err_Ok;
853 }
854
855 Fail:
856 return FT_THROW( Syntax_Error );
857 }
858
859
862 {
863 FT_Memory memory = parser->memory;
864 AFM_FontInfo fi = parser->FontInfo;
865 FT_Error error = FT_ERR( Syntax_Error );
866 char* key;
868 FT_Int metrics_sets = 0;
869
870
871 if ( !fi )
872 return FT_THROW( Invalid_Argument );
873
875 if ( !key || len != 16 ||
876 ft_strncmp( key, "StartFontMetrics", 16 ) != 0 )
877 return FT_THROW( Unknown_File_Format );
878
879 while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
880 {
881 AFM_ValueRec shared_vals[4];
882
883
884 switch ( afm_tokenize( key, len ) )
885 {
887 if ( afm_parser_read_int( parser, &metrics_sets ) )
888 goto Fail;
889
890 if ( metrics_sets != 0 && metrics_sets != 2 )
891 {
892 error = FT_THROW( Unimplemented_Feature );
893
894 goto Fail;
895 }
896 break;
897
899 shared_vals[0].type = AFM_VALUE_TYPE_BOOL;
900 if ( afm_parser_read_vals( parser, shared_vals, 1 ) != 1 )
901 goto Fail;
902
903 fi->IsCIDFont = shared_vals[0].u.b;
904 break;
905
907 shared_vals[0].type = AFM_VALUE_TYPE_FIXED;
908 shared_vals[1].type = AFM_VALUE_TYPE_FIXED;
909 shared_vals[2].type = AFM_VALUE_TYPE_FIXED;
910 shared_vals[3].type = AFM_VALUE_TYPE_FIXED;
911 if ( afm_parser_read_vals( parser, shared_vals, 4 ) != 4 )
912 goto Fail;
913
914 fi->FontBBox.xMin = shared_vals[0].u.f;
915 fi->FontBBox.yMin = shared_vals[1].u.f;
916 fi->FontBBox.xMax = shared_vals[2].u.f;
917 fi->FontBBox.yMax = shared_vals[3].u.f;
918 break;
919
921 shared_vals[0].type = AFM_VALUE_TYPE_FIXED;
922 if ( afm_parser_read_vals( parser, shared_vals, 1 ) != 1 )
923 goto Fail;
924
925 fi->Ascender = shared_vals[0].u.f;
926 break;
927
929 shared_vals[0].type = AFM_VALUE_TYPE_FIXED;
930 if ( afm_parser_read_vals( parser, shared_vals, 1 ) != 1 )
931 goto Fail;
932
933 fi->Descender = shared_vals[0].u.f;
934 break;
935
937 {
938 FT_Int n = 0;
939
940
941 if ( afm_parser_read_int( parser, &n ) )
942 goto Fail;
943
946 if ( error )
947 return error;
948 }
949 break;
950
953 if ( error )
954 goto Fail;
955 /* we only support kern data, so ... */
956 /* fall through */
957
959 return FT_Err_Ok;
960
961 default:
962 break;
963 }
964 }
965
966 Fail:
967 FT_FREE( fi->TrackKerns );
968 fi->NumTrackKern = 0;
969
970 FT_FREE( fi->KernPairs );
971 fi->NumKernPair = 0;
972
973 fi->IsCIDFont = 0;
974
975 return error;
976 }
977
978#else /* T1_CONFIG_OPTION_NO_AFM */
979
980 /* ANSI C doesn't like empty source files */
981 typedef int _afm_parse_dummy;
982
983#endif /* T1_CONFIG_OPTION_NO_AFM */
984
985
986/* END */
#define AFM_STREAM_KEY_BEGIN(stream)
Definition: afmparse.c:76
afm_parser_init(AFM_Parser parser, FT_Memory memory, FT_Byte *base, FT_Byte *limit)
Definition: afmparse.c:529
#define AFM_STREAM_KEY_LEN(stream, key)
Definition: afmparse.c:79
#define AFM_IS_SPACE(ch)
Definition: afmparse.c:67
#define AFM_STATUS_EOC(stream)
Definition: afmparse.c:82
enum AFM_Token_ AFM_Token
#define AFM_STATUS_EOF(stream)
Definition: afmparse.c:88
static FT_Error afm_parse_kern_pairs(AFM_Parser parser)
Definition: afmparse.c:691
static FT_Error afm_parse_track_kern(AFM_Parser parser)
Definition: afmparse.c:587
static FT_Error afm_parser_skip_section(AFM_Parser parser, FT_Int n, AFM_Token end_section)
Definition: afmparse.c:831
afm_compare_kern_pairs(const void *a, const void *b)
Definition: afmparse.c:671
#define AFM_STATUS_EOL(stream)
Definition: afmparse.c:85
static const char *const afm_key_table[N_AFM_TOKENS]
Definition: afmparse.c:284
static char * afm_stream_read_one(AFM_Stream stream)
Definition: afmparse.c:121
static FT_Error afm_parse_kern_data(AFM_Parser parser)
Definition: afmparse.c:789
@ AFM_STREAM_STATUS_NORMAL
Definition: afmparse.c:40
@ AFM_STREAM_STATUS_EOL
Definition: afmparse.c:42
@ AFM_STREAM_STATUS_EOF
Definition: afmparse.c:43
@ AFM_STREAM_STATUS_EOC
Definition: afmparse.c:41
#define AFM_IS_SEP(ch)
Definition: afmparse.c:70
afm_parser_read_vals(AFM_Parser parser, AFM_Value vals, FT_Int n)
Definition: afmparse.c:371
static int afm_stream_skip_spaces(AFM_Stream stream)
Definition: afmparse.c:93
static FT_Error afm_parser_read_int(AFM_Parser parser, FT_Int *aint)
Definition: afmparse.c:567
#define AFM_IS_NEWLINE(ch)
Definition: afmparse.c:64
struct AFM_StreamRec_ AFM_StreamRec
#define AFM_IS_EOF(ch)
Definition: afmparse.c:66
afm_parser_parse(AFM_Parser parser)
Definition: afmparse.c:861
AFM_Token_
Definition: afmparse.c:203
@ AFM_TOKEN_UNDERLINEPOSITION
Definition: afmparse.c:261
@ AFM_TOKEN_W0X
Definition: afmparse.c:268
@ AFM_TOKEN_W1
Definition: afmparse.c:270
@ AFM_TOKEN_KP
Definition: afmparse.c:238
@ AFM_TOKEN_ENCODINGSCHEME
Definition: afmparse.c:219
@ AFM_TOKEN_STARTTRACKKERN
Definition: afmparse.c:257
@ AFM_TOKEN_STARTKERNDATA
Definition: afmparse.c:253
@ AFM_TOKEN_W0Y
Definition: afmparse.c:269
@ AFM_TOKEN_ENDCOMPOSITES
Definition: afmparse.c:222
@ AFM_TOKEN_BLENDAXISTYPES
Definition: afmparse.c:208
@ AFM_TOKEN_CC
Definition: afmparse.c:212
@ AFM_TOKEN_KPH
Definition: afmparse.c:239
@ AFM_TOKEN_STARTFONTMETRICS
Definition: afmparse.c:252
@ AFM_TOKEN_STARTCOMPOSITES
Definition: afmparse.c:250
@ N_AFM_TOKENS
Definition: afmparse.c:278
@ AFM_TOKEN_STDVW
Definition: afmparse.c:259
@ AFM_TOKEN_VERSION
Definition: afmparse.c:265
@ AFM_TOKEN_UNDERLINETHICKNESS
Definition: afmparse.c:262
@ AFM_TOKEN_W
Definition: afmparse.c:266
@ AFM_TOKEN_ASCENDER
Definition: afmparse.c:204
@ AFM_TOKEN_W1Y
Definition: afmparse.c:272
@ AFM_TOKEN_NOTICE
Definition: afmparse.c:246
@ AFM_TOKEN_ENDKERNPAIRS
Definition: afmparse.c:226
@ AFM_TOKEN_STARTKERNPAIRS0
Definition: afmparse.c:255
@ AFM_TOKEN_ISBASEFONT
Definition: afmparse.c:233
@ AFM_TOKEN_FAMILYNAME
Definition: afmparse.c:229
@ AFM_TOKEN_XHEIGHT
Definition: afmparse.c:277
@ AFM_TOKEN_L
Definition: afmparse.c:242
@ AFM_TOKEN_STARTAXIS
Definition: afmparse.c:248
@ AFM_TOKEN_ENDKERNDATA
Definition: afmparse.c:225
@ AFM_TOKEN_AXISTYPE
Definition: afmparse.c:206
@ AFM_TOKEN_FULLNAME
Definition: afmparse.c:232
@ AFM_TOKEN_KPX
Definition: afmparse.c:240
@ AFM_TOKEN_FONTBBOX
Definition: afmparse.c:230
@ AFM_TOKEN_CH
Definition: afmparse.c:213
@ AFM_TOKEN_ENDDIRECTION
Definition: afmparse.c:223
@ AFM_TOKEN_KPY
Definition: afmparse.c:241
@ AFM_TOKEN_C
Definition: afmparse.c:211
@ AFM_TOKEN_FONTNAME
Definition: afmparse.c:231
@ AFM_TOKEN_ENDTRACKKERN
Definition: afmparse.c:227
@ AFM_TOKEN_TRACKKERN
Definition: afmparse.c:260
@ AFM_TOKEN_CHARACTERS
Definition: afmparse.c:217
@ AFM_TOKEN_MAPPINGSCHEME
Definition: afmparse.c:243
@ AFM_TOKEN_WX
Definition: afmparse.c:273
@ AFM_TOKEN_STARTCHARMETRICS
Definition: afmparse.c:249
@ AFM_TOKEN_STDHW
Definition: afmparse.c:258
@ AFM_TOKEN_N
Definition: afmparse.c:245
@ AFM_TOKEN_WEIGHTVECTOR
Definition: afmparse.c:276
@ AFM_TOKEN_CHARACTERSET
Definition: afmparse.c:216
@ AFM_TOKEN_AXISLABEL
Definition: afmparse.c:205
@ AFM_TOKEN_DESCENDER
Definition: afmparse.c:218
@ AFM_TOKEN_STARTKERNPAIRS
Definition: afmparse.c:254
@ AFM_TOKEN_ENDCHARMETRICS
Definition: afmparse.c:221
@ AFM_TOKEN_VVECTOR
Definition: afmparse.c:264
@ AFM_TOKEN_W0
Definition: afmparse.c:267
@ AFM_TOKEN_ITALICANGLE
Definition: afmparse.c:237
@ AFM_TOKEN_ISFIXEDPITCH
Definition: afmparse.c:235
@ AFM_TOKEN_W1X
Definition: afmparse.c:271
@ AFM_TOKEN_UNKNOWN
Definition: afmparse.c:279
@ AFM_TOKEN_B
Definition: afmparse.c:207
@ AFM_TOKEN_BLENDDESIGNPOSITIONS
Definition: afmparse.c:210
@ AFM_TOKEN_ENDAXIS
Definition: afmparse.c:220
@ AFM_TOKEN_ESCCHAR
Definition: afmparse.c:228
@ AFM_TOKEN_CAPHEIGHT
Definition: afmparse.c:214
@ AFM_TOKEN_WY
Definition: afmparse.c:274
@ AFM_TOKEN_STARTKERNPAIRS1
Definition: afmparse.c:256
@ AFM_TOKEN_ENDFONTMETRICS
Definition: afmparse.c:224
@ AFM_TOKEN_WEIGHT
Definition: afmparse.c:275
@ AFM_TOKEN_ISCIDFONT
Definition: afmparse.c:234
@ AFM_TOKEN_PCC
Definition: afmparse.c:247
@ AFM_TOKEN_VV
Definition: afmparse.c:263
@ AFM_TOKEN_CHARWIDTH
Definition: afmparse.c:215
@ AFM_TOKEN_METRICSSETS
Definition: afmparse.c:244
@ AFM_TOKEN_BLENDDESIGNMAP
Definition: afmparse.c:209
@ AFM_TOKEN_ISFIXEDV
Definition: afmparse.c:236
@ AFM_TOKEN_STARTDIRECTION
Definition: afmparse.c:251
static char * afm_stream_read_string(AFM_Stream stream)
Definition: afmparse.c:162
afm_parser_next_key(AFM_Parser parser, FT_Bool line, FT_Offset *len)
Definition: afmparse.c:445
#define AFM_GETC()
Definition: afmparse.c:72
static AFM_Token afm_tokenize(const char *key, FT_Offset len)
Definition: afmparse.c:503
afm_parser_done(AFM_Parser parser)
Definition: afmparse.c:557
#define KERN_INDEX(g1, g2)
Definition: afmparse.c:666
#define AFM_MAX_ARGUMENTS
Definition: afmparse.h:70
@ AFM_VALUE_TYPE_NAME
Definition: afmparse.h:47
@ AFM_VALUE_TYPE_STRING
Definition: afmparse.h:46
@ AFM_VALUE_TYPE_INDEX
Definition: afmparse.h:51
@ AFM_VALUE_TYPE_INTEGER
Definition: afmparse.h:49
@ AFM_VALUE_TYPE_BOOL
Definition: afmparse.h:50
@ AFM_VALUE_TYPE_FIXED
Definition: afmparse.h:48
#define FT_CALLBACK_DEF(x)
#define FT_LOCAL_DEF(x)
#define FT_LOCAL(x)
#define NULL
Definition: types.h:112
unsigned char ch[4][2]
Definition: console.c:118
int Fail
Definition: ehthrow.cxx:24
return FT_Err_Ok
Definition: ftbbox.c:526
#define FT_THROW(e)
Definition: ftdebug.h:243
#define FT_NEW(ptr)
Definition: ftmemory.h:339
#define FT_FREE(ptr)
Definition: ftmemory.h:337
#define FT_QALLOC(ptr, size)
Definition: ftmemory.h:324
#define FT_QNEW_ARRAY(ptr, count)
Definition: ftmemory.h:350
#define ft_memcpy
Definition: ftstdlib.h:82
#define ft_strncmp
Definition: ftstdlib.h:89
#define ft_qsort
Definition: ftstdlib.h:122
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
int FT_Error
Definition: fttypes.h:299
#define FT_ERR(e)
Definition: fttypes.h:599
unsigned int FT_UInt
Definition: fttypes.h:231
#define FT_BOOL(x)
Definition: fttypes.h:591
size_t FT_Offset
Definition: fttypes.h:323
signed int FT_Int
Definition: fttypes.h:220
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLint limit
Definition: glext.h:10326
GLuint GLfloat * val
Definition: glext.h:7180
GLenum GLsizei len
Definition: glext.h:6722
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
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 token
Definition: glfuncs.h:210
#define error(str)
Definition: mkdosfs.c:1605
static char memory[1024 *256]
Definition: process.c:122
PS_Conv_ToInt(FT_Byte **cursor, FT_Byte *limit)
Definition: psconv.c:161
PS_Conv_ToFixed(FT_Byte **cursor, FT_Byte *limit, FT_Long power_ten)
Definition: psconv.c:195
const WCHAR * str
FT_Fixed Ascender
Definition: t1types.h:175
AFM_KernPair KernPairs
Definition: t1types.h:179
FT_Fixed Descender
Definition: t1types.h:176
FT_Bool IsCIDFont
Definition: t1types.h:173
FT_UInt NumKernPair
Definition: t1types.h:180
AFM_TrackKern TrackKerns
Definition: t1types.h:177
FT_UInt NumTrackKern
Definition: t1types.h:178
FT_BBox FontBBox
Definition: t1types.h:174
FT_UInt index2
Definition: t1types.h:165
FT_UInt index1
Definition: t1types.h:164
FT_Byte * limit
Definition: afmparse.c:51
FT_Int status
Definition: afmparse.c:53
FT_Byte * cursor
Definition: afmparse.c:49
FT_Byte * base
Definition: afmparse.c:50
FT_Fixed max_ptsize
Definition: t1types.h:157
FT_Fixed min_ptsize
Definition: t1types.h:155
FT_Fixed max_kern
Definition: t1types.h:158
FT_Fixed min_kern
Definition: t1types.h:156
FT_UInt u
Definition: afmparse.h:63
enum AFM_ValueType_ type
Definition: afmparse.h:57
FT_Pos xMin
Definition: ftimage.h:120
FT_Pos yMax
Definition: ftimage.h:121
FT_Pos yMin
Definition: ftimage.h:120
FT_Pos xMax
Definition: ftimage.h:121
Definition: copy.c:22
Definition: parser.c:49
Definition: import.c:81
Definition: parse.h:23
struct AFM_KernPairRec_ * AFM_KernPair
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define const
Definition: zconf.h:233