1
by thenlich
Initial revision |
1 |
/*
|
2 |
* see COPYRIGHT
|
|
3 |
*/
|
|
4 |
||
5 |
||
6 |
/* options */
|
|
7 |
||
8 |
extern int encode; /* encode the resulting file */ |
|
9 |
extern int pfbflag; /* produce compressed file */ |
|
10 |
extern int wantafm; /* want to see .afm instead of .t1a on stdout */ |
|
11 |
extern int correctvsize; /* try to correct the vertical size of characters */ |
|
12 |
extern int wantuid; /* user wants UniqueID entry in the font */ |
|
13 |
extern int allglyphs; /* convert all glyphs, not only 256 of them */ |
|
8
by babkin
Added control over verbosity of warnings. |
14 |
extern int warnlevel; /* the level of permitted warnings */ |
141
by babkin
Added selection of base encoding by pid/eid in the external maps. |
15 |
extern int forcemap; /* do mapping even on non-Unicode fonts */ |
6
by babkin
Modified substituted hinting: |
16 |
/* options - maximal limits */
|
17 |
extern int max_stemdepth; /* maximal depth of stem stack in interpreter */ |
|
40
by babkin
The glyphs .null and .notdef were confused, exhanged them. |
18 |
/* options - debugging */
|
19 |
extern int absolute; /* print out in absolute values */ |
|
20 |
extern int reverse; /* reverse font to Type1 path directions */ |
|
21 |
/* options - suboptions of Outline Processing */
|
|
22 |
extern int optimize; /* enables space optimization */ |
|
23 |
extern int smooth; /* enable smoothing of outlines */ |
|
24 |
extern int transform; /* enables transformation to 1000x1000 matrix */ |
|
25 |
extern int hints; /* enables autogeneration of hints */ |
|
26 |
extern int subhints; /* enables autogeneration of substituted hints */ |
|
27 |
extern int trybold; /* try to guess whether the font is bold */ |
|
28 |
extern int correctwidth; /* try to correct the character width */ |
|
193
by babkin
Work in progress on the vectorizing (tracing) of bitmaps. |
29 |
extern int vectorize; /* vectorize the bitmaps */ |
189
by babkin
Added support for use of the autotrace library on the bitmap fonts. |
30 |
extern int use_autotrace; /* use the autotrace library on bitmap */ |
180
by babkin
COmmitted the generation of dvips encoding files (by Rigel). |
31 |
/* options - suboptions of File Generation */
|
32 |
extern int gen_pfa; /* generate the font file */ |
|
33 |
extern int gen_afm; /* generate the metrics file */ |
|
34 |
extern int gen_dvienc; /* generate the dvips encoding file */ |
|
1
by thenlich
Initial revision |
35 |
|
109
by babkin
Added support to extract arbitrary plane of (almost) arbitrary TTF |
36 |
/* not quite options to select a particular source encoding */
|
37 |
extern int force_pid; /* specific platform id */ |
|
38 |
extern int force_eid; /* specific encoding id */ |
|
39 |
||
1
by thenlich
Initial revision |
40 |
/* other globals */
|
180
by babkin
COmmitted the generation of dvips encoding files (by Rigel). |
41 |
extern FILE *null_file, *pfa_file, *afm_file, *dvienc_file; |
78
by babkin
Cleaned up warnings reported by Tru64 and GNU compilers. |
42 |
extern int numglyphs; |
1
by thenlich
Initial revision |
43 |
|
8
by babkin
Added control over verbosity of warnings. |
44 |
/* warnings */
|
45 |
||
46 |
#define WARNING_1 if(warnlevel >= 1)
|
|
47 |
#define WARNING_2 if(warnlevel >= 2)
|
|
48 |
#define WARNING_3 if(warnlevel >= 3)
|
|
49 |
#define WARNING_4 if(warnlevel >= 4)
|
|
50 |
||
95
by babkin
Further cleaned up the front-end parser interface: moved printing of the |
51 |
/*
|
52 |
* Bitmap control macros
|
|
53 |
*/
|
|
54 |
||
55 |
#define BITMAP_BYTES(size) (((size)+7)>>3)
|
|
56 |
#define DEF_BITMAP(name, size) unsigned char name[BITMAP_BYTES(size)]
|
|
57 |
#define SET_BITMAP(name, bit) ( name[(bit)>>3] |= (1<<((bit)&7)) )
|
|
58 |
#define CLR_BITMAP(name, bit) ( name[(bit)>>3] &= ~(1<<((bit)&7)) )
|
|
59 |
#define IS_BITMAP(name, bit) ( name[(bit)>>3] & (1<<((bit)&7)) )
|
|
60 |
||
1
by thenlich
Initial revision |
61 |
/* debugging */
|
62 |
||
63 |
/* debug flags */
|
|
64 |
#define DEBUG_UNICODE 0x00000001 /* unicode to 8-bit code conversion */ |
|
65 |
#define DEBUG_MAINSTEMS 0x00000002 /* glyph-wide main stem generation */ |
|
66 |
#define DEBUG_SUBSTEMS 0x00000004 /* substituted stem generation */ |
|
67 |
#define DEBUG_STEMS (DEBUG_MAINSTEMS|DEBUG_SUBSTEMS)
|
|
68 |
#define DEBUG_REVERSAL 0x00000008 /* reversal of the paths */ |
|
69 |
#define DEBUG_FIXCVDIR 0x00000010 /* fixcvdir() */ |
|
70 |
#define DEBUG_STEMOVERLAP 0x00000020 /* stemoverlap() */ |
|
71 |
#define DEBUG_BLUESTEMS 0x00000040 /* markbluestems() */ |
|
3
by babkin
Added check for "can't happen" situation in straighten() in pt1.c and |
72 |
#define DEBUG_STRAIGHTEN 0x00000080 /* markbluestems() */ |
7
by babkin
Added support of arguments to the language mapping routines and |
73 |
#define DEBUG_EXTMAP 0x00000100 /* parsing of external map */ |
32
by babkin
Added feature of intermediate processing with floating point numbers. |
74 |
#define DEBUG_TOINT 0x00000200 /* conversion of path to integer */ |
75 |
#define DEBUG_BUILDG 0x00000400 /* building of glyph path */ |
|
34
by babkin
Added splitting of curves at vertical and horizontal extremums. That |
76 |
#define DEBUG_QUAD 0x00000800 /* splitting curves by quadrants */ |
77 |
#define DEBUG_SQEQ 0x00001000 /* square equation solver */ |
|
57
by babkin
Fixed the matrix calculation bug inctroduced when adding support for |
78 |
#define DEBUG_COMPOSITE 0x00002000 /* handling of composite glyphs */ |
68
by babkin
Changed the algorithm that joins curves to enfoce conciseness of contours. |
79 |
#define DEBUG_FCONCISE 0x00004000 /* normalization of curves */ |
87
by babkin
Added the FreeType-based front end parser. FreeType-2beta8 still has |
80 |
#define DEBUG_FT 0x00008000 /* FreeType front-end */ |
225
by babkin
Improvements in the auto-vectoring code. |
81 |
#define DEBUG_BITMAP 0x00010000 /* conversion from bitmap */ |
1
by thenlich
Initial revision |
82 |
#define DEBUG_DISABLED 0x80000000 /* special flag: temporary disable debugging */ |
83 |
||
84 |
/* at what we want to look now */
|
|
85 |
#ifndef DEBUG
|
|
230
by babkin
Unified the parsing of font name strings and improved the checks |
86 |
# define DEBUG (0)
|
1
by thenlich
Initial revision |
87 |
#endif
|
88 |
||
89 |
/* uncomment the next line if debugging data is wanted for one glyph only */
|
|
230
by babkin
Unified the parsing of font name strings and improved the checks |
90 |
/* #define DBG_GLYPH "C118" /* */
|
1
by thenlich
Initial revision |
91 |
|
92 |
#if DEBUG==0
|
|
93 |
# define ISDBG(name) (0)
|
|
94 |
# define ENABLEDBG(condition) (0)
|
|
95 |
# define DISABLEDBG(condition) (0)
|
|
96 |
#else
|
|
97 |
extern int debug; /* collection of the flags */ |
|
98 |
/* this ISDBG will only work on ANSI C, not K&R */
|
|
99 |
# define ISDBG(name) ( (debug & DEBUG_DISABLED) ? 0 : (debug & (DEBUG_##name)) )
|
|
100 |
# define ENABLEDBG(condition) ( (condition) ? (debug&=~DEBUG_DISABLED) : 0 )
|
|
101 |
# define DISABLEDBG(condition) ( (condition) ? (debug|=DEBUG_DISABLED) : 0 )
|
|
102 |
#endif
|
|
103 |
||
104 |
#ifdef DBG_GLYPH
|
|
105 |
# define DBG_TO_GLYPH(g) DISABLEDBG( strcmp( (g)->name, DBG_GLYPH ) )
|
|
106 |
# define DBG_FROM_GLYPH(g) ENABLEDBG(1)
|
|
107 |
#else
|
|
108 |
# define DBG_TO_GLYPH(g) (0)
|
|
109 |
# define DBG_FROM_GLYPH(g) (0)
|
|
110 |
#endif
|
|
111 |
||
112 |
/* prototypes */
|
|
32
by babkin
Added feature of intermediate processing with floating point numbers. |
113 |
int iscale( int val); |
114 |
double fscale( double val); |
|
81
by babkin
Changed the handling of encodings to accomodate the FreeType model. |
115 |
int unicode_rev_lookup( int unival); |
189
by babkin
Added support for use of the autotrace library on the bitmap fonts. |
116 |
void bmp_outline( GLYPH *g, int scale, char *bmap, |
117 |
int xsz, int ysz, int xoff, int yoff); |
|
193
by babkin
Work in progress on the vectorizing (tracing) of bitmaps. |
118 |
int isign( int x); |
119 |
int fsign( double x); |
|
230
by babkin
Unified the parsing of font name strings and improved the checks |
120 |
char *dupcnstring( unsigned char *s, int len); |
26
by babkin
Made the first approach to modularization of front-end parsers. |
121 |
|
122 |
/* global metrics for a font */
|
|
123 |
||
124 |
struct font_metrics { |
|
125 |
/* post */
|
|
126 |
double italic_angle; |
|
127 |
short underline_position; |
|
128 |
short underline_thickness; |
|
129 |
short is_fixed_pitch; |
|
130 |
||
131 |
/* hhea */
|
|
132 |
short ascender; |
|
133 |
short descender; |
|
134 |
||
135 |
/* head */
|
|
136 |
unsigned short units_per_em; |
|
137 |
short bbox[4]; |
|
138 |
||
139 |
/* name */
|
|
140 |
char *name_copyright; |
|
141 |
char *name_family; |
|
142 |
char *name_style; |
|
143 |
char *name_full; |
|
144 |
char *name_version; |
|
145 |
char *name_ps; |
|
146 |
||
147 |
/* other */
|
|
148 |
int force_bold; |
|
149 |
};
|
|
150 |
||
128
by babkin
Restored the ability to add un-encoded glyphs in the map files. |
151 |
/* size of the encoding table - glyphs beyond 255 are actually unnumbered */
|
152 |
||
153 |
#define ENCTABSZ 1024
|
|
154 |
||
26
by babkin
Made the first approach to modularization of front-end parsers. |
155 |
/* switch table structure for front-ends */
|
156 |
||
157 |
#define MAXSUFFIX 10
|
|
158 |
||
159 |
struct frontsw { |
|
160 |
char *name; /* name of the front end */ |
|
161 |
char *descr; /* description of the front end */ |
|
162 |
char *suffix[MAXSUFFIX]; /* possible file name suffixes */ |
|
163 |
||
35
by babkin
Changed closepaths() to floating arithmetic. Added option to select |
164 |
void (*open)(char *fname, char *arg); /* open font file */ |
26
by babkin
Made the first approach to modularization of front-end parsers. |
165 |
void (*close)(void); /* close font file */ |
166 |
int (*nglyphs)(void); /* get the number of glyphs */ |
|
167 |
int (*glnames)(GLYPH *glyphs); /* get the names of glyphs */ |
|
168 |
void (*glmetrics)(GLYPH *glyphs); /* get the metrics of glyphs */ |
|
81
by babkin
Changed the handling of encodings to accomodate the FreeType model. |
169 |
int (*glenc)(GLYPH *glyphs, int *enc, int *unimap); /* get the encoding */ |
26
by babkin
Made the first approach to modularization of front-end parsers. |
170 |
void (*fnmetrics)(struct font_metrics *fm); /* get the font metrics */ |
85
by babkin
Changed conting of the outline elements to count elements after |
171 |
void (*glpath)(int glyphno, GLYPH *glyphs); /* get the glyph path */ |
95
by babkin
Further cleaned up the front-end parser interface: moved printing of the |
172 |
void (*kerning)(GLYPH *glyph_list); /* extract the kerning data */ |
26
by babkin
Made the first approach to modularization of front-end parsers. |
173 |
};
|