Debian Codegraph @

texk/web2c/pdftexdir/writettf.h

raw
1 /*
2 Copyright 1996-2014 Han The Thanh, <[email protected]>
3
4 This file is part of pdfTeX.
5
6 pdfTeX is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 pdfTeX is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License along
17 with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 typedef signed char TTF_CHAR;
21 typedef unsigned char TTF_BYTE;
22 typedef signed short TTF_SHORT;
23 typedef unsigned short TTF_USHORT;
24 typedef int32_t TTF_LONG;
25 typedef uint32_t TTF_ULONG;
26 typedef uint32_t TTF_FIXED;
27 typedef unsigned short TTF_FUNIT;
28 typedef signed short TTF_FWORD;
29 typedef unsigned short TTF_UFWORD;
30 typedef unsigned short TTF_F2DOT14;
31
32 #define TTF_CHAR_SIZE 1
33 #define TTF_BYTE_SIZE 1
34 #define TTF_SHORT_SIZE 2
35 #define TTF_USHORT_SIZE 2
36 #define TTF_LONG_SIZE 4
37 #define TTF_ULONG_SIZE 4
38 #define TTF_FIXED_SIZE 4
39 #define TTF_FWORD_SIZE 2
40 #define TTF_UFWORD_SIZE 2
41 #define TTF_F2DOT14_SIZE 2
42
43 #define ARG_1_AND_2_ARE_WORDS (1<<0)
44 #define ARGS_ARE_XY_VALUES (1<<1)
45 #define ROUND_XY_TO_GRID (1<<2)
46 #define WE_HAVE_A_SCALE (1<<3)
47 #define RESERVED (1<<4)
48 #define MORE_COMPONENTS (1<<5)
49 #define WE_HAVE_AN_X_AND_Y_SCALE (1<<6)
50 #define WE_HAVE_A_TWO_BY_TWO (1<<7)
51 #define WE_HAVE_INSTRUCTIONS (1<<8)
52 #define USE_MY_METRICS (1<<9)
53
54 #define get_type(t) ((t)ttf_getnum(t##_SIZE))
55 #define ttf_skip(n) ttf_getnum(n)
56
57 #define get_byte() get_type(TTF_BYTE)
58 #define get_char() get_type(TTF_CHAR)
59 #define get_ushort() get_type(TTF_USHORT)
60 #define get_short() get_type(TTF_SHORT)
61 #define get_ulong() get_type(TTF_ULONG)
62 #define get_long() get_type(TTF_LONG)
63 #define get_fixed() get_type(TTF_FIXED)
64 #define get_funit() get_type(TTF_FUNIT)
65 #define get_fword() get_type(TTF_FWORD)
66 #define get_ufword() get_type(TTF_UFWORD)
67 #define get_f2dot14() get_type(TTF_F2DOT14)
68
69 #define put_num(t,n) ((t)ttf_putnum(t##_SIZE, n))
70
71 #define put_char(n) (void)put_num(TTF_CHAR, n)
72 #define put_byte(n) (void)put_num(TTF_BYTE, n)
73 #define put_short(n) put_num(TTF_SHORT, n)
74 #define put_ushort(n) put_num(TTF_USHORT, n)
75 #define put_long(n) put_num(TTF_LONG, n)
76 #define put_ulong(n) (void)put_num(TTF_ULONG, n)
77 #define put_fixed(n) (void)put_num(TTF_FIXED, n)
78 #define put_funit(n) put_num(TTF_FUNIT, n)
79 #define put_fword(n) put_num(TTF_FWORD, n)
80 #define put_ufword(n) (void)put_num(TTF_UFWORD, n)
81 #define put_f2dot14(n) put_num(TTF_F2DOT14, n)
82
83 #define copy_byte() put_byte(get_byte())
84 #define copy_char() put_char(get_char())
85 #define copy_ushort() put_ushort(get_ushort())
86 #define copy_short() put_short(get_short())
87 #define copy_ulong() put_ulong(get_ulong())
88 #define copy_long() put_long(get_long())
89 #define copy_fixed() put_fixed(get_fixed())
90 #define copy_funit() put_funit(get_funit())
91 #define copy_fword() put_fword(get_fword())
92 #define copy_ufword() put_ufword(get_ufword())
93 #define copy_f2dot14() put_f2dot14(get_f2dot14())
94
95 #define is_unicode_mapping(e) \
96 (e->platform_id == 0 || (e->platform_id == 3 || e->encoding_id == 1))
97
98
99 #define NMACGLYPHS 258
100 #define TABDIR_OFF 12
101 #define ENC_BUF_SIZE 1024
102
103 #define GLYPH_PREFIX_INDEX "index"
104 #define GLYPH_PREFIX_UNICODE "uni"
105
106 typedef struct {
107 char tag[4];
108 TTF_ULONG checksum;
109 TTF_ULONG offset;
110 TTF_ULONG length;
111 } dirtab_entry;
112
113 typedef struct {
114 TTF_USHORT platform_id;
115 TTF_USHORT encoding_id;
116 TTF_ULONG offset;
117 TTF_USHORT format;
118 } cmap_entry;
119
120 typedef struct {
121 TTF_USHORT endCode;
122 TTF_USHORT startCode;
123 TTF_USHORT idDelta;
124 TTF_USHORT idRangeOffset;
125 } seg_entry;