1
/* cairo - a vector graphics library with display and print output
3
* Copyright © 2006 Red Hat, Inc
5
* This library is free software; you can redistribute it and/or
6
* modify it either under the terms of the GNU Lesser General Public
7
* License version 2.1 as published by the Free Software Foundation
8
* (the "LGPL") or, at your option, under the terms of the Mozilla
9
* Public License Version 1.1 (the "MPL"). If you do not alter this
10
* notice, a recipient may use your version of this file under either
11
* the MPL or the LGPL.
13
* You should have received a copy of the LGPL along with this library
14
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
* You should have received a copy of the MPL along with this library
17
* in the file COPYING-MPL-1.1
19
* The contents of this file are subject to the Mozilla Public License
20
* Version 1.1 (the "License"); you may not use this file except in
21
* compliance with the License. You may obtain a copy of the License at
22
* http://www.mozilla.org/MPL/
24
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
25
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
26
* the specific language governing rights and limitations.
28
* The Original Code is the cairo graphics library.
30
* The Initial Developer of the Original Code is Red Hat, Inc.
33
* Kristian Høgsberg <krh@redhat.com>
34
* Adrian Johnson <ajohnson@redneon.com>
37
#ifndef CAIRO_TRUETYPE_SUBSET_PRIVATE_H
38
#define CAIRO_TRUETYPE_SUBSET_PRIVATE_H
42
#if CAIRO_HAS_FONT_SUBSET
44
/* The structs defined here should strictly follow the TrueType
45
* specification and not be padded. We use only 16-bit integer
46
* in their definition to guarantee that. The fields of type
47
* "FIXED" in the TT spec are broken into two *_1 and *_2 16-bit
48
* parts, and 64-bit members are broken into four.
50
* The test truetype-tables in the test suite makes sure that
51
* these tables have the right size. Please update that test
52
* if you add new tables/structs that should be packed.
55
#define MAKE_TT_TAG(a, b, c, d) (a<<24 | b<<16 | c<<8 | d)
56
#define TT_TAG_CFF MAKE_TT_TAG('C','F','F',' ')
57
#define TT_TAG_cmap MAKE_TT_TAG('c','m','a','p')
58
#define TT_TAG_cvt MAKE_TT_TAG('c','v','t',' ')
59
#define TT_TAG_fpgm MAKE_TT_TAG('f','p','g','m')
60
#define TT_TAG_glyf MAKE_TT_TAG('g','l','y','f')
61
#define TT_TAG_head MAKE_TT_TAG('h','e','a','d')
62
#define TT_TAG_hhea MAKE_TT_TAG('h','h','e','a')
63
#define TT_TAG_hmtx MAKE_TT_TAG('h','m','t','x')
64
#define TT_TAG_loca MAKE_TT_TAG('l','o','c','a')
65
#define TT_TAG_maxp MAKE_TT_TAG('m','a','x','p')
66
#define TT_TAG_name MAKE_TT_TAG('n','a','m','e')
67
#define TT_TAG_post MAKE_TT_TAG('p','o','s','t')
68
#define TT_TAG_prep MAKE_TT_TAG('p','r','e','p')
70
/* All tt_* structs are big-endian */
71
typedef struct _tt_cmap_index {
77
typedef struct _tt_cmap {
80
tt_cmap_index_t index[1];
83
typedef struct _segment_map {
89
uint16_t entrySelector;
94
typedef struct _tt_head {
104
uint16_t units_per_em;
113
int16_t x_min; /* FWORD */
114
int16_t y_min; /* FWORD */
115
int16_t x_max; /* FWORD */
116
int16_t y_max; /* FWORD */
118
uint16_t lowest_rec_pppem;
119
int16_t font_direction_hint;
120
int16_t index_to_loc_format;
121
int16_t glyph_data_format;
124
typedef struct _tt_hhea {
127
int16_t ascender; /* FWORD */
128
int16_t descender; /* FWORD */
129
int16_t line_gap; /* FWORD */
130
uint16_t advance_max_width; /* UFWORD */
131
int16_t min_left_side_bearing; /* FWORD */
132
int16_t min_right_side_bearing; /* FWORD */
133
int16_t x_max_extent; /* FWORD */
134
int16_t caret_slope_rise;
135
int16_t caret_slope_run;
137
int16_t metric_data_format;
138
uint16_t num_hmetrics;
141
typedef struct _tt_maxp {
146
uint16_t max_contours;
147
uint16_t max_composite_points;
148
uint16_t max_composite_contours;
150
uint16_t max_twilight_points;
151
uint16_t max_storage;
152
uint16_t max_function_defs;
153
uint16_t max_instruction_defs;
154
uint16_t max_stack_elements;
155
uint16_t max_size_of_instructions;
156
uint16_t max_component_elements;
157
uint16_t max_component_depth;
160
typedef struct _tt_name_record {
169
typedef struct _tt_name {
171
uint16_t num_records;
172
uint16_t strings_offset;
173
tt_name_record_t records[1];
178
/* composite_glyph_t flags */
179
#define TT_ARG_1_AND_2_ARE_WORDS 0x0001
180
#define TT_WE_HAVE_A_SCALE 0x0008
181
#define TT_MORE_COMPONENTS 0x0020
182
#define TT_WE_HAVE_AN_X_AND_Y_SCALE 0x0040
183
#define TT_WE_HAVE_A_TWO_BY_TWO 0x0080
185
typedef struct _tt_composite_glyph {
188
uint16_t args[7]; /* 1 to 7 arguments depending on value of flags */
189
} tt_composite_glyph_t;
191
typedef struct _tt_glyph_data {
192
int16_t num_contours;
194
tt_composite_glyph_t glyph;
197
#endif /* CAIRO_HAS_FONT_SUBSET */
199
#endif /* CAIRO_TRUETYPE_SUBSET_PRIVATE_H */