2 Parser and writer for truetype font files.
4 Part of the swftools package.
6 Copyright (c) 2010 Matthias Kramm <kramm@quiss.org>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
27 typedef struct _ttf_table
{
29 struct _ttf_table
*prev
;
30 struct _ttf_table
*next
;
37 typedef struct _table_maxp
{
40 U16 maxComponentPoints
;
41 U16 maxComponentContours
;
43 U16 maxTwilightPoints
;
46 U16 maxInstructionDefs
;
48 U16 maxSizeOfInstructions
;
49 U16 maxComponentElements
;
50 U16 maxComponentDepth
;
53 typedef struct _table_os2
{
59 U16 ySubscriptXOffset
;
60 U16 ySubscriptYOffset
;
61 U16 ySuperscriptXSize
;
62 U16 ySuperscriptYSize
;
63 U16 ySuperscriptXOffset
;
64 U16 ySuperscriptYOffset
;
66 U16 yStrikeoutPosition
;
73 U8 panose_StrokeVariation
;
90 /* for version >= 0x0001 */
94 /* for version >= 0x0002 */
102 typedef struct _table_hea
105 S16 minLeftSideBearing
;
106 S16 minRightSideBearing
;
113 #define GLYPH_ON_CURVE 0x01
114 #define GLYPH_CONTOUR_START 0x40
115 #define GLYPH_CONTOUR_END 0x80
117 typedef U32 unicode_t
;
119 typedef struct _ttfpoint
{
123 typedef struct _ttfglyph
{
126 S16 xmin
,ymin
,xmax
,ymax
;
133 typedef struct _table_head
{
136 S16 xmin
,ymin
,xmax
,ymax
;
138 U16 lowest_readable_size
;
142 typedef struct _table_post
{
144 U16 underline_position
;
145 U16 underline_thickness
;
148 typedef struct _table_cvt
{
153 typedef struct _table_gasp
{
161 typedef struct _table_code
{
166 typedef struct _ttf
{
167 char*family_name
; /* nameId 1 */
168 char*subfamily_name
; /* nameId 2 */
169 char*font_uid
; /* nameId 3 */
170 char*full_name
; /* nameId 4 */
171 char*version_string
; /* nameId 5 */
172 char*postscript_name
; /* nameId 6 */
190 S16 descent
; // ymin, *not* negative ymin
204 ttf_t
* ttf_open(const char*filename
);
205 void ttf_reduce(ttf_t
*ttf
);
206 ttf_t
*ttf_load(void*data
, int length
);
207 ttf_table_t
*ttf_addtable(ttf_t
*ttf
, U32 tag
);
208 void ttf_create_truetype_tables(ttf_t
*ttf
);
209 void ttf_dump(ttf_t
*ttf
);
210 void ttf_destroy(ttf_t
*ttf
);
211 void ttf_save(ttf_t
*ttf
, const char*filename
);
212 void ttf_save_eot(ttf_t
*ttf
, const char*filename
);