-
Notifications
You must be signed in to change notification settings - Fork 178
/
tttypes.h
1582 lines (1362 loc) · 82 KB
/
tttypes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***************************************************************************/
/* */
/* tttypes.h */
/* */
/* Basic SFNT/TrueType type definitions and interface (specification */
/* only). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef TTTYPES_H
#define TTTYPES_H
#include "tttables.h"
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* TTC_Header */
/* */
/* <Description> */
/* TrueType collection header. This table contains the offsets of */
/* the font headers of each distinct TrueType face in the file. */
/* */
/* <Fields> */
/* tag :: Must be `ttc ' to indicate a TrueType collection. */
/* */
/* version :: The version number. */
/* */
/* count :: The number of faces in the collection. The */
/* specification says this should be an unsigned long, but */
/* we use a signed long since we need the value -1 for */
/* specific purposes. */
/* */
/* offsets :: The offsets of the font headers, one per face. */
/* */
typedef struct TTC_Header_
{
FT_ULong tag;
FT_Fixed version;
FT_Long count;
FT_ULong* offsets;
} TTC_Header;
/*************************************************************************/
/* */
/* <Struct> */
/* SFNT_Header */
/* */
/* <Description> */
/* SFNT file format header. */
/* */
/* <Fields> */
/* format_tag :: The font format tag. */
/* */
/* num_tables :: The number of tables in file. */
/* */
/* search_range :: Must be 16*(max power of 2 <= num_tables). */
/* */
/* entry_selector :: Must be log2 of search_range/16. */
/* */
/* range_shift :: Must be num_tables*16 - search_range. */
/* */
typedef struct SFNT_Header_
{
FT_ULong format_tag;
FT_UShort num_tables;
FT_UShort search_range;
FT_UShort entry_selector;
FT_UShort range_shift;
} SFNT_Header;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_TableDir */
/* */
/* <Description> */
/* This structure models a TrueType table directory. It is used to */
/* access the various tables of the font face. */
/* */
/* <Fields> */
/* version :: The version number; starts with 0x00010000. */
/* */
/* numTables :: The number of tables. */
/* */
/* searchRange :: Unused. */
/* */
/* entrySelector :: Unused. */
/* */
/* rangeShift :: Unused. */
/* */
/* <Note> */
/* This structure is only used during font opening. */
/* */
typedef struct TT_TableDir_
{
FT_Fixed version; /* should be 0x10000 */
FT_UShort numTables; /* number of tables */
FT_UShort searchRange; /* These parameters are only used */
FT_UShort entrySelector; /* for a dichotomy search in the */
FT_UShort rangeShift; /* directory. We ignore them. */
} TT_TableDir;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_Table */
/* */
/* <Description> */
/* This structure describes a given table of a TrueType font. */
/* */
/* <Fields> */
/* Tag :: A four-bytes tag describing the table. */
/* */
/* CheckSum :: The table checksum. This value can be ignored. */
/* */
/* Offset :: The offset of the table from the start of the TrueType */
/* font in its resource. */
/* */
/* Length :: The table length (in bytes). */
/* */
typedef struct TT_Table_
{
FT_ULong Tag; /* table type */
FT_ULong CheckSum; /* table checksum */
FT_ULong Offset; /* table file offset */
FT_ULong Length; /* table length */
} TT_Table;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_CMapDir */
/* */
/* <Description> */
/* This structure describes the directory of the `cmap' table, */
/* containing the font's character mappings table. */
/* */
/* <Fields> */
/* tableVersionNumber :: The version number. */
/* */
/* numCMaps :: The number of charmaps in the font. */
/* */
/* <Note> */
/* This structure is only used during font loading. */
/* */
typedef struct TT_CMapDir_
{
FT_UShort tableVersionNumber;
FT_UShort numCMaps;
} TT_CMapDir;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_CMapDirEntry */
/* */
/* <Description> */
/* This structure describes a charmap in a TrueType font. */
/* */
/* <Fields> */
/* platformID :: An ID used to specify for which platform this */
/* charmap is defined (FreeType manages all platforms). */
/* */
/* encodingID :: A platform-specific ID used to indicate which source */
/* encoding is used in this charmap. */
/* */
/* offset :: The offset of the charmap relative to the start of */
/* the `cmap' table. */
/* */
/* <Note> */
/* This structure is only used during font loading. */
/* */
typedef struct TT_CMapDirEntry_
{
FT_UShort platformID;
FT_UShort platformEncodingID;
FT_Long offset;
} TT_CMapDirEntry;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_LongMetrics */
/* */
/* <Description> */
/* A structure modeling the long metrics of the `hmtx' and `vmtx' */
/* TrueType tables. The values are expressed in font units. */
/* */
/* <Fields> */
/* advance :: The advance width or height for the glyph. */
/* */
/* bearing :: The left-side or top-side bearing for the glyph. */
/* */
typedef struct TT_LongMetrics_
{
FT_UShort advance;
FT_Short bearing;
} TT_LongMetrics;
/*************************************************************************/
/* */
/* <Type> TT_ShortMetrics */
/* */
/* <Description> */
/* A simple type to model the short metrics of the `hmtx' and `vmtx' */
/* tables. */
/* */
typedef FT_Short TT_ShortMetrics;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_NameRec */
/* */
/* <Description> */
/* A structure modeling TrueType name records. Name records are used */
/* to store important strings like family name, style name, */
/* copyright, etc. in _localized_ versions (i.e., language, encoding, */
/* etc). */
/* */
/* <Fields> */
/* platformID :: The ID of the name's encoding platform. */
/* */
/* encodingID :: The platform-specific ID for the name's encoding. */
/* */
/* languageID :: The platform-specific ID for the name's language. */
/* */
/* nameID :: The ID specifying what kind of name this is. */
/* */
/* stringLength :: The length of the string in bytes. */
/* */
/* stringOffset :: The offset to the string in the `name' table. */
/* */
/* string :: A pointer to the string's bytes. Note that these */
/* are usually UTF-16 encoded characters. */
/* */
typedef struct TT_NameRec_
{
FT_UShort platformID;
FT_UShort encodingID;
FT_UShort languageID;
FT_UShort nameID;
FT_UShort stringLength;
FT_UShort stringOffset;
/* this last field is not defined in the spec */
/* but used by the FreeType engine */
FT_Byte* string;
} TT_NameRec;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_NameTable */
/* */
/* <Description> */
/* A structure modeling the TrueType name table. */
/* */
/* <Fields> */
/* format :: The format of the name table. */
/* */
/* numNameRecords :: The number of names in table. */
/* */
/* storageOffset :: The offset of the name table in the `name' */
/* TrueType table. */
/* */
/* names :: An array of name records. */
/* */
/* storage :: The names storage area. */
/* */
typedef struct TT_NameTable_
{
FT_UShort format;
FT_UShort numNameRecords;
FT_UShort storageOffset;
TT_NameRec* names;
FT_Byte* storage;
} TT_NameTable;
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* TT_GaspRange */
/* */
/* <Description> */
/* A tiny structure used to model a gasp range according to the */
/* TrueType specification. */
/* */
/* <Fields> */
/* maxPPEM :: The maximum ppem value to which `gaspFlag' applies. */
/* */
/* gaspFlag :: A flag describing the grid-fitting and anti-aliasing */
/* modes to be used. */
/* */
typedef struct TT_GaspRange_
{
FT_UShort maxPPEM;
FT_UShort gaspFlag;
} TT_GaspRange;
#define TT_GASP_GRIDFIT 0x01
#define TT_GASP_DOGRAY 0x02
/*************************************************************************/
/* */
/* <Struct> */
/* TT_Gasp */
/* */
/* <Description> */
/* A structure modeling the TrueType `gasp' table used to specify */
/* grid-fitting and anti-aliasing behaviour. */
/* */
/* <Fields> */
/* version :: The version number. */
/* */
/* numRanges :: The number of gasp ranges in table. */
/* */
/* gaspRanges :: An array of gasp ranges. */
/* */
typedef struct TT_Gasp_
{
FT_UShort version;
FT_UShort numRanges;
TT_GaspRange* gaspRanges;
} TT_Gasp;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_HdmxRec */
/* */
/* <Description> */
/* A small structure used to model the pre-computed widths of a given */
/* size. They are found in the `hdmx' table. */
/* */
/* <Fields> */
/* ppem :: The pixels per EM value at which these metrics apply. */
/* */
/* max_width :: The maximum advance width for this metric. */
/* */
/* widths :: An array of widths. Note: These are 8-bit bytes. */
/* */
typedef struct TT_HdmxRec_
{
FT_Byte ppem;
FT_Byte max_width;
FT_Byte* widths;
} TT_HdmxRec;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_Hdmx */
/* */
/* <Description> */
/* A structure used to model the `hdmx' table, which contains */
/* pre-computed widths for a set of given sizes/dimensions. */
/* */
/* <Fields> */
/* version :: The version number. */
/* */
/* num_records :: The number of hdmx records. */
/* */
/* records :: An array of hdmx records. */
/* */
typedef struct TT_Hdmx_
{
FT_UShort version;
FT_Short num_records;
TT_HdmxRec* records;
} TT_Hdmx;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_Kern_0_Pair */
/* */
/* <Description> */
/* A structure used to model a kerning pair for the kerning table */
/* format 0. The engine now loads this table if it finds one in the */
/* font file. */
/* */
/* <Fields> */
/* left :: The index of the left glyph in pair. */
/* */
/* right :: The index of the right glyph in pair. */
/* */
/* value :: The kerning distance. A positive value spaces the */
/* glyphs, a negative one makes them closer. */
/* */
typedef struct TT_Kern_0_Pair_
{
FT_UShort left; /* index of left glyph in pair */
FT_UShort right; /* index of right glyph in pair */
FT_FWord value; /* kerning value */
} TT_Kern_0_Pair;
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** EMBEDDED BITMAPS SUPPORT ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* TT_SBit_Metrics */
/* */
/* <Description> */
/* A structure used to hold the big metrics of a given glyph bitmap */
/* in a TrueType or OpenType font. These are usually found in the */
/* `EBDT' (Microsoft) or `bdat' (Apple) table. */
/* */
/* <Fields> */
/* height :: The glyph height in pixels. */
/* */
/* width :: The glyph width in pixels. */
/* */
/* horiBearingX :: The horizontal left bearing. */
/* */
/* horiBearingY :: The horizontal top bearing. */
/* */
/* horiAdvance :: The horizontal advance. */
/* */
/* vertBearingX :: The vertical left bearing. */
/* */
/* vertBearingY :: The vertical top bearing. */
/* */
/* vertAdvance :: The vertical advance. */
/* */
typedef struct TT_SBit_Metrics_
{
FT_Byte height;
FT_Byte width;
FT_Char horiBearingX;
FT_Char horiBearingY;
FT_Byte horiAdvance;
FT_Char vertBearingX;
FT_Char vertBearingY;
FT_Byte vertAdvance;
} TT_SBit_Metrics;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_SBit_Small_Metrics */
/* */
/* <Description> */
/* A structure used to hold the small metrics of a given glyph bitmap */
/* in a TrueType or OpenType font. These are usually found in the */
/* `EBDT' (Microsoft) or the `bdat' (Apple) table. */
/* */
/* <Fields> */
/* height :: The glyph height in pixels. */
/* */
/* width :: The glyph width in pixels. */
/* */
/* bearingX :: The left-side bearing. */
/* */
/* bearingY :: The top-side bearing. */
/* */
/* advance :: The advance width or height. */
/* */
typedef struct TT_SBit_Small_Metrics_
{
FT_Byte height;
FT_Byte width;
FT_Char bearingX;
FT_Char bearingY;
FT_Byte advance;
} TT_SBit_Small_Metrics;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_SBit_Line_Metrics */
/* */
/* <Description> */
/* A structure used to describe the text line metrics of a given */
/* bitmap strike, for either a horizontal or vertical layout. */
/* */
/* <Fields> */
/* ascender :: The ascender in pixels. */
/* */
/* descender :: The descender in pixels. */
/* */
/* max_width :: The maximum glyph width in pixels. */
/* */
/* caret_slope_enumerator :: Rise of the caret slope, typically set */
/* to 1 for non-italic fonts. */
/* */
/* caret_slope_denominator :: Rise of the caret slope, typically set */
/* to 0 for non-italic fonts. */
/* */
/* caret_offset :: Offset in pixels to move the caret for */
/* proper positioning. */
/* */
/* min_origin_SB :: Minimum of horiBearingX (resp. */
/* vertBearingY). */
/* min_advance_SB :: Minimum of */
/* */
/* horizontal advance - */
/* ( horiBearingX + width ) */
/* */
/* resp. */
/* */
/* vertical advance - */
/* ( vertBearingY + height ) */
/* */
/* max_before_BL :: Maximum of horiBearingY (resp. */
/* vertBearingY). */
/* */
/* min_after_BL :: Minimum of */
/* */
/* horiBearingY - height */
/* */
/* resp. */
/* */
/* vertBearingX - width */
/* */
/* pads :: Unused (to make the size of the record */
/* a multiple of 32 bits. */
/* */
typedef struct TT_SBit_Line_Metrics_
{
FT_Char ascender;
FT_Char descender;
FT_Byte max_width;
FT_Char caret_slope_numerator;
FT_Char caret_slope_denominator;
FT_Char caret_offset;
FT_Char min_origin_SB;
FT_Char min_advance_SB;
FT_Char max_before_BL;
FT_Char min_after_BL;
FT_Char pads[2];
} TT_SBit_Line_Metrics;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_SBit_Range */
/* */
/* <Description> */
/* A TrueType/OpenType subIndexTable as defined in the `EBLC' */
/* (Microsoft) or `bloc' (Apple) tables. */
/* */
/* <Fields> */
/* first_glyph :: The first glyph index in the range. */
/* */
/* last_glyph :: The last glyph index in the range. */
/* */
/* index_format :: The format of index table. Valid values are 1 */
/* to 5. */
/* */
/* image_format :: The format of `EBDT' image data. */
/* */
/* image_offset :: The offset to image data in `EBDT'. */
/* */
/* image_size :: For index formats 2 and 5. This is the size in */
/* bytes of each glyph bitmap. */
/* */
/* big_metrics :: For index formats 2 and 5. This is the big */
/* metrics for each glyph bitmap. */
/* */
/* num_glyphs :: For index formats 4 and 5. This is the number of */
/* glyphs in the code array. */
/* */
/* glyph_offsets :: For index formats 1 and 3. */
/* */
/* glyph_codes :: For index formats 4 and 5. */
/* */
/* table_offset :: The offset of the index table in the `EBLC' */
/* table. Only used during strike loading. */
/* */
typedef struct TT_SBit_Range
{
FT_UShort first_glyph;
FT_UShort last_glyph;
FT_UShort index_format;
FT_UShort image_format;
FT_ULong image_offset;
FT_ULong image_size;
TT_SBit_Metrics metrics;
FT_ULong num_glyphs;
FT_ULong* glyph_offsets;
FT_UShort* glyph_codes;
FT_ULong table_offset;
} TT_SBit_Range;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_SBit_Strike */
/* */
/* <Description> */
/* A structure used describe a given bitmap strike in the `EBLC' */
/* (Microsoft) or `bloc' (Apple) tables. */
/* */
/* <Fields> */
/* num_index_ranges :: The number of index ranges. */
/* */
/* index_ranges :: An array of glyph index ranges. */
/* */
/* color_ref :: Unused. A color reference? */
/* */
/* hori :: The line metrics for horizontal layouts. */
/* */
/* vert :: The line metrics for vertical layouts. */
/* */
/* start_glyph :: The lowest glyph index for this strike. */
/* */
/* end_glyph :: The highest glyph index for this strike. */
/* */
/* x_ppem :: The number of horizontal pixels per EM. */
/* */
/* y_ppem :: The number of vertical pixels per EM. */
/* */
/* bit_depth :: The bit depth. Valid values are 1, 2, 4, */
/* and 8. */
/* */
/* flags :: Is this a vertical or horizontal strike? */
/* */
typedef struct TT_SBit_Strike_
{
FT_Int num_ranges;
TT_SBit_Range* sbit_ranges;
FT_ULong ranges_offset;
FT_ULong color_ref;
TT_SBit_Line_Metrics hori;
TT_SBit_Line_Metrics vert;
FT_UShort start_glyph;
FT_UShort end_glyph;
FT_Byte x_ppem;
FT_Byte y_ppem;
FT_Byte bit_depth;
FT_Char flags;
} TT_SBit_Strike;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_SBit_Component */
/* */
/* <Description> */
/* A simple structure to describe a compound sbit element. */
/* */
/* <Fields> */
/* glyph_code :: The element's glyph index. */
/* */
/* x_offset :: The element's left bearing. */
/* */
/* y_offset :: The element's top bearing. */
/* */
typedef struct TT_SBit_Component_
{
FT_UShort glyph_code;
FT_Char x_offset;
FT_Char y_offset;
} TT_SBit_Component;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_SBit_Scale */
/* */
/* <Description> */
/* A structure used describe a given bitmap scaling table, as defined */
/* in the `EBSC' table. */
/* */
/* <Fields> */
/* hori :: The horizontal line metrics. */
/* */
/* vert :: The vertical line metrics. */
/* */
/* x_ppem :: The number of horizontal pixels per EM. */
/* */
/* y_ppem :: The number of vertical pixels per EM. */
/* */
/* x_ppem_substitute :: Substitution x_ppem value. */
/* */
/* y_ppem_substitute :: Substitution y_ppem value. */
/* */
typedef struct TT_SBit_Scale_
{
TT_SBit_Line_Metrics hori;
TT_SBit_Line_Metrics vert;
FT_Byte x_ppem;
FT_Byte y_ppem;
FT_Byte x_ppem_substitute;
FT_Byte y_ppem_substitute;
} TT_SBit_Scale;
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** POSTSCRIPT GLYPH NAMES SUPPORT ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* TT_Post_20 */
/* */
/* <Description> */
/* Postscript names sub-table, format 2.0. Stores the PS name of */
/* each glyph in the font face. */
/* */
/* <Fields> */
/* num_glyphs :: The number of named glyphs in the table. */
/* */
/* num_names :: The number of PS names stored in the table. */
/* */
/* glyph_indices :: The indices of the glyphs in the names arrays. */
/* */
/* glyph_names :: The PS names not in Mac Encoding. */
/* */
typedef struct TT_Post_20_
{
FT_UShort num_glyphs;
FT_UShort num_names;
FT_UShort* glyph_indices;
FT_Char** glyph_names;
} TT_Post_20;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_Post_25 */
/* */
/* <Description> */
/* Postscript names sub-table, format 2.5. Stores the PS name of */
/* each glyph in the font face. */
/* */
/* <Fields> */
/* num_glyphs :: The number of glyphs in the table. */
/* */
/* offsets :: An array of signed offsets in a normal Mac */
/* Postscript name encoding. */
/* */
typedef struct TT_Post_25_
{
FT_UShort num_glyphs;
FT_Char* offsets;
} TT_Post_25;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_Post_Names */
/* */
/* <Description> */
/* Postscript names table, either format 2.0 or 2.5. */
/* */
/* <Fields> */
/* loaded :: A flag to indicate whether the PS names are loaded. */
/* */
/* format_20 :: The sub-table used for format 2.0. */
/* */
/* format_25 :: The sub-table used for format 2.5. */
/* */
typedef struct TT_Post_Names_
{
FT_Bool loaded;
union
{
TT_Post_20 format_20;
TT_Post_25 format_25;
} names;
} TT_Post_Names;
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** TRUETYPE CHARMAPS SUPPORT ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* format 0 */
typedef struct TT_CMap0_
{
FT_Byte* glyphIdArray;
} TT_CMap0;
/* format 2 */
typedef struct TT_CMap2SubHeader_
{
FT_UShort firstCode; /* first valid low byte */
FT_UShort entryCount; /* number of valid low bytes */
FT_Short idDelta; /* delta value to glyphIndex */
FT_UShort idRangeOffset; /* offset from here to 1st code */
} TT_CMap2SubHeader;
typedef struct TT_CMap2_
{
FT_UShort* subHeaderKeys;
/* high byte mapping table */
/* value = subHeader index * 8 */
TT_CMap2SubHeader* subHeaders;
FT_UShort* glyphIdArray;
FT_UShort numGlyphId; /* control value */
} TT_CMap2;
/* format 4 */
typedef struct TT_CMap4Segment_
{
FT_UShort endCount;
FT_UShort startCount;
FT_Short idDelta;
FT_UShort idRangeOffset;
} TT_CMap4Segment;
typedef struct TT_CMap4_
{
FT_UShort segCountX2; /* number of segments * 2 */
FT_UShort searchRange; /* these parameters can be used */
FT_UShort entrySelector; /* for a binary search */
FT_UShort rangeShift;
TT_CMap4Segment* segments;
FT_UShort* glyphIdArray;
FT_UShort numGlyphId; /* control value */
TT_CMap4Segment* last_segment; /* last used segment; this is a small */
/* cache to potentially increase speed */
} TT_CMap4;
/* format 6 */
typedef struct TT_CMap6_
{
FT_UShort firstCode; /* first character code of subrange */
FT_UShort entryCount; /* number of character codes in subrange */
FT_UShort* glyphIdArray;
} TT_CMap6;
typedef struct TT_CMapTable_ TT_CMapTable;
typedef
FT_UInt ( *TT_CharMap_Func )( TT_CMapTable* charmap,
FT_ULong char_code );
/* charmap table */
struct TT_CMapTable_
{
FT_UShort platformID;
FT_UShort platformEncodingID;
FT_UShort format;
FT_UShort length;
FT_UShort version;
FT_Bool loaded;
FT_ULong offset;