w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

splinefont.h
Go to the documentation of this file.
1 /* Copyright (C) 2000-2008 by George Williams */
2 /*
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are met:
5 
6  * Redistributions of source code must retain the above copyright notice, this
7  * list of conditions and the following disclaimer.
8 
9  * Redistributions in binary form must reproduce the above copyright notice,
10  * this list of conditions and the following disclaimer in the documentation
11  * and/or other materials provided with the distribution.
12 
13  * The name of the author may not be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15 
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 #ifndef _SPLINEFONT_H
28 #define _SPLINEFONT_H
29 
30 #include "basics.h"
31 #include "configure-pfaedit.h"
32 #ifdef HAVE_ICONV_H
33 # include <iconv.h>
34 /* libiconv.h defines iconv as taking a const pointer for inbuf. iconv doesn't*/
35 # ifdef _LIBICONV_VERSION
36 # define ICONV_CONST const
37 # else
38 # define ICONV_CONST
39 # endif
40 #else
41 # include <gwwiconv.h>
42 # define ICONV_CONST
43 #endif
44 
45 #if defined( FONTFORGE_CONFIG_USE_LONGDOUBLE )
46 # define real long double
47 # define bigreal long double
48 #elif defined( FONTFORGE_CONFIG_USE_DOUBLE )
49 # define real double
50 # define bigreal double
51 #else
52 # define real float
53 # define bigreal double
54 #endif
55 
56 #if defined( HAVE_LONG_DOUBLE ) && defined( This_does_not_seem_to_make_a_difference )
57 # define extended long double
58 # define CheckExtremaForSingleBitErrors(sp,t) (t)
59 # define EXTENDED_IS_LONG_DOUBLE 1
60 #else
61 # define extended double
62 #endif
63  /* Solaris wants to define extended to be unsigned [3] unless we do this*/
64 #define _EXTENDED
65 
66 #define CHR(ch1,ch2,ch3,ch4) (((ch1)<<24)|((ch2)<<16)|((ch3)<<8)|(ch4))
67 
68 #define MmMax 16 /* PS says at most this many instances for type1/2 mm fonts */
69 
70 typedef struct ipoint {
71  int x;
72  int y;
74 
75 typedef struct basepoint {
79 
80 typedef struct dbasepoint {
81  bigreal x;
82  bigreal y;
84 
85 typedef struct tpoint {
90 
91 typedef struct dbounds {
95 
96 typedef struct ibounds {
97  int minx, maxx;
98  int miny, maxy;
100 
101 typedef struct val {
104  union {
105  int ival;
107  char *sval;
108  struct val *lval;
109  struct array *aval;
110  uint32 *u32ptval;
111  uint16 *u16ptval;
112  uint8 *u8ptval;
113  } u;
114 } Val; /* Used by scripting */
115 
116 struct psdict {
117  int cnt, next;
118  char **keys;
119  char **values;
120 };
121 
122 struct pschars {
123  int cnt, next;
124  char **keys;
125  uint8 **values;
126  int *lens;
127  int bias; /* for type2 strings */
128 };
129 
130 enum linejoin {
131  lj_miter, /* Extend lines until they meet */
132  lj_round, /* circle centered at the join of expand radius */
133  lj_bevel, /* Straight line between the ends of next and prev */
135 };
136 enum linecap {
137  lc_butt, /* equiv to lj_bevel, straight line extends from one side to other */
138  lc_round, /* semi-circle */
139  lc_square, /* Extend lines by radius, then join them */
141 };
144 };
145 #define COLOR_INHERITED 0xfffffffe
146 struct gradient {
147  BasePoint start; /* focal of a radial gradient, start of a linear */
148  BasePoint stop; /* center of a radial gradient, end of a linear */
149  real radius; /* 0=>linear gradient, else radius of a radial gradient */
150  enum spreadMethod sm;
151  int stop_cnt;
152  struct grad_stops {
157 };
158 
159 struct pattern {
160  char *pattern;
161  real width, height; /* Pattern is scaled to be repeated every width/height (in user coordinates) */
163  /* Used during rasterization process */
164  struct bdfchar *pat;
166  int bminx, bminy, bwidth, bheight; /* of the pattern at bdfchar scale */
167 };
168 
169 struct brush {
170  uint32 col;
171  float opacity; /* number between [0,1], only for svg/pdf */
172  struct pattern *pattern; /* A pattern to be tiled */
173  struct gradient *gradient; /* A gradient fill */
174 };
175 #define WIDTH_INHERITED (-1)
176 #define DASH_INHERITED 255 /* if the dashes[0]==0 && dashes[1]==DASH_INHERITED */
177 #define DASH_MAX 8
178 typedef unsigned char DashType;
179 struct pen {
180  struct brush brush;
181  uint8 linejoin;
182  uint8 linecap;
183  float width;
186 };
187 
188 struct spline;
190 /* If you change this structure you may need to update MakeStrokeDlg */
191 /* and cvpalettes.c both contain statically initialized StrokeInfos */
192 typedef struct strokeinfo {
193  real radius; /* or major axis of pen */
194  enum linejoin join;
195  enum linecap cap;
196  enum si_type stroke_type;
197  unsigned int toobigwarn: 1;
198  unsigned int removeinternal: 1;
199  unsigned int removeexternal: 1;
200  unsigned int removeoverlapifneeded: 1;
201  unsigned int gottoobig: 1;
202  unsigned int gottoobiglocal: 1;
204  real ratio; /* ratio of minor pen axis to major */
205 /* For eplipse */
207 /* For freehand tool */
209  int pressure1, pressure2;
210 /* End freehand tool */
212  real xoff[8], yoff[8];
213  void *data;
214  bigreal (*factor)(void *data,struct spline *spline,real t);
216 
219 
225 struct simplifyinfo {
226  int flags;
230  bigreal linelenmax; /* Don't simplify any straight lines longer than this */
233 };
234 
235 typedef struct italicinfo {
236  double italic_angle;
237  double xheight_percent;
241  /* | | (flat) | | (simple) | | (complex) */
242  /* | | | / | / */
243  /* | | | / | / */
244  /* +----+ |/ \ / */
245 
246  unsigned int transform_bottom_serifs: 1;
247  unsigned int transform_top_xh_serifs: 1; /* Those at x-height */
248  unsigned int transform_top_as_serifs: 1; /* Those at ascender-height */
249  unsigned int transform_diagon_serifs: 1; /* Those at baseline/xheight */
250 
251  unsigned int a_from_d: 1; /* replace the "a" glyph with the variant which looks like a "d" without an ascender */
252  /* When I say "f" I also mean "f_f" ligature, "longs", cyrillic phi and other things shaped like "f" */
253  unsigned int f_long_tail: 1; /* Some Italic fonts have the "f" grow an extension of the main stem below the baseline */
254  unsigned int f_rotate_top: 1; /* Most Italic fonts take the top curve of the "f", rotate it 180 and attach to the bottom */
255  unsigned int pq_deserif: 1; /* Remove a serif from the descender of p or q and replace with a secondary serif as above */
256 
257  /* Unsupported */
258  /* e becomes rounder, cross bar slightly slanted */
259  /* g closed counter at bottom */
260  /* k closed counter at top */
261  /* v-z diagonal stems become more curvatious */
262 
263  unsigned int cyrl_phi: 1; /* Gains an "f" like top, bottom treated like "f" */
264  unsigned int cyrl_i: 1; /* Turns into a latin u */
265  unsigned int cyrl_pi: 1; /* Turns into a latin n */
266  unsigned int cyrl_te: 1; /* Turns into a latin m */
267  unsigned int cyrl_sha: 1; /* Turns into a latin m rotated 180 */
268  unsigned int cyrl_dje: 1; /* Turns into a latin smallcaps T */
269  unsigned int cyrl_dzhe: 1; /* Turns into a latin u */
270  /* Is there a difference between dzhe and i? both look like u to me */
271 
272  /* Unsupported */
273  /* u432 curved B */
274  /* u433 strange gamma */
275  /* u434 normal delta */
276  /* u436 */
277  /* u43b lambda ? */
278  /* u43c */
279  /* u446 */
280  /* u449 */
281  /* u449 */
282  /* u44a */
283 
284 /* This half of the structure gets filled in later */
285  double tan_ia;
286  double x_height;
287  double pq_depth;
288  double ascender_height;
289  double emsize;
290  int order2;
291  struct splinefont *sf;
292  int layer;
293  double serif_extent, serif_height;
294  struct splinepoint *f_start, *f_end; /* start has next pointing into the f head and up */
296  double f_height, ff_height;
298 
299 typedef struct bluedata {
300  real xheight, xheighttop; /* height of "x" and "o" (u,v,w,x,y,z) */
301  real caph, caphtop; /* height of "I" and "O" */
302  real base, basebelow; /* bottom of "I" and "O" */
303  real ascent; /* height of "l" */
304  real descent; /* depth of "p" */
305  real numh, numhtop; /* height of "7" and "8" */ /* numbers with ascenders */
306  int bluecnt; /* If the private dica contains bluevalues... */
307  real blues[12][2]; /* 7 pairs from bluevalues, 5 from otherblues */
309 
310 typedef struct bdffloat {
313  unsigned int byte_data:1;
314  uint8 depth;
315  uint8 *bitmap;
317 
318 /* OpenType does not document 'dflt' as a language, but we'll use it anyway. */
319 /* (Adobe uses it too) we'll turn it into a default entry when we output it. */
320 #define DEFAULT_LANG CHR('d','f','l','t')
321 /* The OpenType spec says in one place that the default script is 'dflt' and */
322 /* in another that it is 'DFLT'. 'DFLT' is correct */
323 #define DEFAULT_SCRIPT CHR('D','F','L','T')
324 #define REQUIRED_FEATURE CHR(' ','R','Q','D')
325 
327  ot_undef = 0, /* Not a lookup type */
328  gsub_start = 0x000, /* Not a lookup type */
329  gsub_single = 0x001,
330  gsub_multiple = 0x002,
331  gsub_alternate = 0x003,
332  gsub_ligature = 0x004,
333  gsub_context = 0x005,
335  /* GSUB extension 7 */
337  /* ********************* */
338  gpos_start = 0x100, /* Not a lookup type */
339 
340  gpos_single = 0x101,
341  gpos_pair = 0x102,
342  gpos_cursive = 0x103,
343  gpos_mark2base = 0x104,
345  gpos_mark2mark = 0x106,
346  gpos_context = 0x107,
348  /* GPOS extension 9 */
349 
350  /* otlookup&0xff == lookup type for the appropriate table */
351  /* otlookup>>8: 0=>GSUB, 1=>GPOS */
352 };
353 
355  gsub_single_mask = 0x00001,
359  gsub_context_mask = 0x00010,
362  /* ********************* */
363  gpos_single_mask = 0x00400,
364  gpos_pair_mask = 0x00800,
365  gpos_cursive_mask = 0x01000,
369  gpos_context_mask = 0x10000,
371 };
372 
373 #define MAX_LANG 4 /* If more than this we allocate more_langs in chunks of MAX_LANG */
374 struct scriptlanglist {
375  uint32 script;
377  uint32 *morelangs;
378  int lang_cnt;
379  struct scriptlanglist *next;
380 };
381 
384  char *tagstr;
386  int masks;
388 
389 typedef struct featurescriptlanglist {
391  struct scriptlanglist *scripts;
392  struct featurescriptlanglist *next;
394 
397 
398 typedef struct otlookup {
399  struct otlookup *next;
402  char *lookup_name;
406  char *suffix; /* for gsub_single, used to find a default replacement */
407  struct otlookup *lookup;
408  unsigned int unused: 1;
409  unsigned int per_glyph_pst_or_kern: 1;
410  unsigned int anchor_classes: 1;
411  unsigned int vertical_kerning: 1;
412  unsigned int ticked: 1;
413  struct kernclass *kc;
415  /* Each time an item is added to a lookup we must place it into a */
416  /* subtable. If it's a kerning class, fpst or state machine it has */
417  /* a subtable all to itself. If it's an anchor class it can share */
418  /* a subtable with other anchor classes (merge with). If it's a glyph */
419  /* PST it may share a subtable with other PSTs */
420  /* Note items may only be placed in lookups in which they fit. Can't */
421  /* put kerning data in a gpos_single lookup, etc. */
425  /* If a kerning subtable has too much stuff in it, we are prepared to */
426  /* break it up into several smaller subtables, each of which has */
427  /* an offset in this list (extra-subtables[0]==subtable_offset) */
428  /* the list is terminated by an entry of -1 */
430  unsigned int unused: 1; /* No subtable is used (call SFFindUnusedLookups before examining) */
431  unsigned int empty: 1; /* No subtable is used, and no anchor classes are used */
432  unsigned int store_in_afm: 1; /* Used for ligatures, some get stored */
433  /* 'liga' generally does, but 'frac' doesn't */
434  unsigned int needs_extension: 1; /* Used during opentype generation */
435  unsigned int temporary_kern: 1; /* Used when decomposing kerning classes into kern pairs for older formats */
436  unsigned int def_lang_checked: 1;
437  unsigned int def_lang_found: 1;
438  unsigned int ticked: 1;
439  int16 subcnt; /* Actual number of subtables we will output */
440  /* Some of our subtables may contain no data */
441  /* Some may be too big and need to be broken up.*/
442  /* So this field may be different than just counting the subtables */
443  int lookup_index; /* used during opentype generation */
446  char *tempname;
448 
449 #ifdef FONTFORGE_CONFIG_DEVICETABLES
450 typedef struct devicetab {
451  uint16 first_pixel_size, last_pixel_size; /* A range of point sizes to which this table applies */
452  int8 *corrections; /* a set of pixel corrections, one for each point size */
453 } DeviceTable;
454 
455 typedef struct valdev { /* Value records can have four associated device tables */
460 } ValDevTab;
461 #endif
462 
464 typedef struct anchorclass {
465  char *name; /* in utf8 */
466  struct lookup_subtable *subtable;
467  uint8 type; /* anchorclass_type */
468  uint8 has_base;
470  uint8 ticked;
471  struct anchorclass *next;
473 
475 typedef struct anchorpoint {
477  BasePoint me;
478 #ifdef FONTFORGE_CONFIG_DEVICETABLES
480 #endif
481  unsigned int type: 4;
482  unsigned int selected: 1;
483  unsigned int ticked: 1;
484  unsigned int has_ttf_pt: 1;
487  struct anchorpoint *next;
489 
490 typedef struct kernpair {
491  struct lookup_subtable *subtable;
492  struct splinechar *sc;
493  int16 off;
494  uint16 kcid; /* temporary value */
495 #ifdef FONTFORGE_CONFIG_DEVICETABLES
496  DeviceTable *adjust; /* Only adjustment in one dimen, if more needed use pst */
497 #endif
498  struct kernpair *next;
500 
501 typedef struct kernclass {
502  int first_cnt, second_cnt; /* Count of classes for first and second chars */
503  char **firsts; /* list of a space seperated list of char names */
504  char **seconds; /* one entry for each class. Entry 0 is null */
505  /* and means everything not specified elsewhere */
506  struct lookup_subtable *subtable;
507  uint16 kcid; /* Temporary value, used for many things briefly */
508  int16 *offsets; /* array of first_cnt*second_cnt entries */
509 #ifdef FONTFORGE_CONFIG_DEVICETABLES
510  DeviceTable *adjusts; /* array of first_cnt*second_cnt entries */
511 #endif
512  struct kernclass *next;
514 
518  pst_lcaret /* must be pst_max-1, see charinfo.c*/,
520  /* These are not psts but are related so it's handly to have values for them */
522  /* And these are fpsts */
525  /* And these are used to specify a kerning pair where the current */
526  /* char is the final glyph rather than the initial one */
527  /* A kludge used when cutting and pasting features */
529  };
530 
531 struct vr {
533 #ifdef FONTFORGE_CONFIG_DEVICETABLES
534  ValDevTab *adjust;
535 #endif
536 };
537 
538 typedef struct generic_pst {
539  unsigned int ticked: 1;
540  unsigned int temporary: 1; /* Used in afm ligature closure */
541  /* enum possub_type*/ uint8 type;
542  struct lookup_subtable *subtable;
543  struct generic_pst *next;
544  union {
545  struct vr pos;
546  struct { char *paired; struct vr *vr; } pair;
547  struct { char *variant; } subs;
548  struct { char *components; } mult, alt;
549  struct { char *components; struct splinechar *lig; } lig;
550  struct { int16 *carets; int cnt; } lcaret; /* Ligature caret positions */
551  } u;
552 } PST;
553 
554 typedef struct liglist {
555  PST *lig;
556  struct splinechar *first; /* First component */
557  struct splinecharlist *components; /* Other than the first */
558  struct liglist *next;
559  int ccnt; /* Component count. (includes first component) */
561 
564 
565 typedef struct generic_fpst {
566  uint16 /*enum sfpossub_type*/ type;
567  uint16 /*enum fpossub_format*/ format;
568  struct lookup_subtable *subtable;
569  struct generic_fpst *next;
572  char **nclass, **bclass, **fclass;
573  struct fpst_rule {
574  union {
575  struct fpg { char *names, *back, *fore; } glyph;
576  struct fpc { int ncnt, bcnt, fcnt; uint16 *nclasses, *bclasses, *fclasses, *allclasses; } class;
577  struct fpv { int ncnt, bcnt, fcnt; char **ncovers, **bcovers, **fcovers; } coverage;
578  struct fpr { int always1, bcnt, fcnt; char **ncovers, **bcovers, **fcovers; char *replacements; } rcoverage;
579  } u;
581  struct seqlookup {
582  int seq;
583  struct otlookup *lookup;
585  } *rules;
586  uint8 ticked;
589 
590 struct opentype_str {
591  struct splinechar *sc;
592  struct vr vr; /* Scaled and rounded gpos modifications (device table info included in xoff, etc. not in adjusts) */
593  struct kernpair *kp;
594  struct kernclass *kc;
595  int16 advance_width; /* Basic advance, modifications in vr, scaled and rounded */
597  int16 lig_pos; /* when skipping marks to form a ligature keep track of what ligature element a mark was attached to */
598  int16 context_pos; /* When doing a contextual match remember which glyphs are used, and where in the match they occur. Skipped glyphs have -1 */
600  void *fl;
601  unsigned int line_break_after: 1;
602  unsigned int r2l: 1;
604 };
605 
606 /* Wow, the GPOS 'size' feature stores a string in the name table just as mac */
607 /* features do */
608 struct otfname {
609  struct otfname *next;
610  uint16 lang; /* windows language code */
611  char *name; /* utf8 */
612 };
613 
614 typedef struct undoes {
615  struct undoes *next;
622  unsigned int was_modified: 1;
623  unsigned int was_order2: 1;
624  union {
625  struct {
628  int unicodeenc; /* only for ut_statename */
629  char *charname; /* only for ut_statename */
630  char *comment; /* in utf8 */
631  PST *possub; /* only for ut_statename */
633  struct refchar *refs;
634 
635  struct imagelist *images;
636  void *hints; /* ut_statehint, ut_statename */
640 #ifdef FONTFORGE_CONFIG_TYPE3
641  struct brush fill_brush;
642  struct pen stroke_pen;
643  unsigned int dofill: 1;
644  unsigned int dostroke: 1;
645  unsigned int fillfirst: 1;
646 #endif
647  } state;
648  int width; /* used by both ut_width and ut_vwidth */
649  int lbearing; /* used by ut_lbearing */
650  int rbearing; /* used by ut_rbearing */
651  struct {
652  int16 width; /* width should be controled by postscript, but people don't like that */
660  struct { /* copy contains an outline state and a set of bitmap states */
661  struct undoes *state;
662  struct undoes *bitmaps;
664  struct {
665  struct undoes *mult; /* copy contains several sub copies (composits, or states or widths or...) */
666  /* Also used for ut_layers, each sub copy is a state (first is ly_fore, next ly_fore+1...) */
668  struct {
669  enum possub_type pst;
670  char **data; /* First 4 bytes is tag, then space then data */
671  struct undoes *more_pst;
672  short cnt,max; /* Not always set */
674  uint8 *bitmap;
675  } u;
678 
679 typedef struct bdfchar {
680  struct splinechar *sc;
682  int16 width;
684  uint8 *bitmap;
685  int orig_pos;
686  struct bitmapview *views;
689  unsigned int changed: 1;
690  unsigned int byte_data: 1; /* for anti-aliased chars entries are grey-scale bytes not bw bits */
691  unsigned int widthgroup: 1; /* for ttf bitmap output */
692  unsigned int isreference: 1; /* for ttf bitmap input, */
693  unsigned int ticked: 1;
694  uint8 depth; /* for ttf bitmap output */
695  uint16 vwidth;
698 
699 typedef struct enc {
700  char *enc_name;
701  int char_cnt; /* Size of the next two arrays */
702  int32 *unicode; /* unicode value for each encoding point */
703  char **psnames; /* optional postscript name for each encoding point */
704  struct enc *next;
705  unsigned int builtin: 1;
706  unsigned int hidden: 1;
707  unsigned int only_1byte: 1;
708  unsigned int has_1byte: 1;
709  unsigned int has_2byte: 1;
710  unsigned int is_unicodebmp: 1;
711  unsigned int is_unicodefull: 1;
712  unsigned int is_custom: 1;
713  unsigned int is_original: 1;
714  unsigned int is_compact: 1;
715  unsigned int is_japanese: 1;
716  unsigned int is_korean: 1;
717  unsigned int is_tradchinese: 1;
718  unsigned int is_simplechinese: 1;
719  char iso_2022_escape[8];
721  int low_page, high_page;
722  char *iconv_name; /* For compatibility to old versions we might use a different name from that used by iconv. */
725  int (*tounicode_func)(int);
727  unsigned int is_temporary: 1; /* freed when the map gets freed */
728  int char_max; /* Used by temporary encodings */
730 
731 typedef struct namelist {
732  struct namelist *basedon;
733  char *title;
734  const char ***unicode[17];
735  struct namelist *next;
736  struct renames { char *from; char *to; } *renames;
737  int uses_unicode;
738  char *a_utf8_name;
740 
743 
744 struct remap { uint32 firstenc, lastenc; int32 infont; };
745 
746 typedef struct encmap { /* A per-font map of encoding to glyph id */
747  int32 *map; /* Map from encoding to glyphid */
748  int32 *backmap; /* Map from glyphid to encoding */
749  int enccount; /* used size of the map array */
750  /* strictly speaking this might include */
751  /* glyphs that are not encoded, but which */
752  /* are displayed after the proper encoding */
753  int encmax; /* allocated size of the map array */
754  int backmax; /* allocated size of the backmap array */
755  struct remap *remap;
756  Encoding *enc;
757  unsigned int ticked: 1;
759 
761 
762 typedef struct bdfprops {
763  char *name; /* These include both properties (like SLANT) and non-properties (like FONT) */
764  int type;
765  union {
766  char *str;
767  char *atom;
768  int val;
769  } u;
771 
772 typedef struct bdffont {
773  struct splinefont *sf;
774  int glyphcnt, glyphmax,glyphmin; /* used & allocated sizes of glyphs array */
775  BDFChar **glyphs; /* an array of charcnt entries */
778  int16 layer; /* for piecemeal fonts */
779  unsigned int piecemeal: 1;
780  unsigned int bbsized: 1;
781  unsigned int ticked: 1;
782  unsigned int unhinted_freetype: 1;
783  struct bdffont *next;
784  struct clut *clut;
785  char *foundry;
786  int res;
787  void *freetype_context;
788  uint16 truesize; /* for bbsized fonts */
789  int16 prop_cnt;
790  int16 prop_max; /* only used within bdfinfo dlg */
793 
794 #define HntMax 96 /* PS says at most 96 hints */
795 typedef uint8 HintMask[HntMax/8];
796 
798 typedef struct splinepoint {
799  BasePoint me;
800  BasePoint nextcp; /* control point */
801  BasePoint prevcp; /* control point */
802  unsigned int nonextcp:1;
803  unsigned int noprevcp:1;
804  unsigned int nextcpdef:1;
805  unsigned int prevcpdef:1;
806  unsigned int selected:1; /* for UI */
807  unsigned int pointtype:2;
808  unsigned int isintersection: 1;
809  unsigned int flexy: 1;
810  unsigned int flexx: 1;
811  unsigned int roundx: 1; /* For true type hinting */
812  unsigned int roundy: 1; /* For true type hinting */
813  unsigned int dontinterpolate: 1; /* in ttf, don't imply point by interpolating between cps */
814  unsigned int ticked: 1;
815  unsigned int watched: 1;
816  /* 1 bits left... */
817  uint16 ptindex; /* Temporary value used by metafont routine */
818  uint16 ttfindex; /* Truetype point index */
819  /* Special values 0xffff => point implied by averaging control points */
820  /* 0xfffe => point created with no real number yet */
821  /* (or perhaps point in context where no number is possible as in a glyph with points & refs) */
822  uint16 nextcpindex; /* Truetype point index */
823  struct spline *next;
824  struct spline *prev;
827 
828 typedef struct linelist {
829  IPoint here;
830  struct linelist *next;
831  /* The first two fields are constant for the linelist, the next ones */
832  /* refer to a particular screen. If some portion of the line from */
833  /* this point to the next one is on the screen then set cvli_onscreen */
834  /* if this point needs to be clipped then set cvli_clipped */
835  /* asend and asstart are the actual screen locations where this point */
836  /* intersects the clip edge. */
837  enum { cvli_onscreen=0x1, cvli_clipped=0x2 } flags;
840 
841 typedef struct linearapprox {
843  unsigned int oneline: 1;
844  unsigned int onepoint: 1;
845  unsigned int any: 1; /* refers to a particular screen */
846  struct linelist *lines;
847  struct linearapprox *next;
849 
850 typedef struct spline1d {
851  real a, b, c, d;
853 
854 typedef struct spline {
855  unsigned int islinear: 1; /* No control points */
856  unsigned int isquadratic: 1; /* probably read in from ttf */
857  unsigned int isticked: 1;
858  unsigned int isneeded: 1; /* Used in remove overlap */
859  unsigned int isunneeded: 1; /* Used in remove overlap */
860  unsigned int exclude: 1; /* Used in remove overlap varient: exclude */
861  unsigned int ishorvert: 1;
862  unsigned int knowncurved: 1; /* We know that it curves */
863  unsigned int knownlinear: 1; /* it might have control points, but still traces out a line */
864  /* If neither knownlinear nor curved then we haven't checked */
865  unsigned int order2: 1; /* It's a bezier curve with only one cp */
866  unsigned int touched: 1;
867  unsigned int leftedge: 1;
868  unsigned int rightedge: 1;
869  unsigned int acceptableextrema: 1; /* This spline has extrema, but we don't care */
870  SplinePoint *from, *to;
871  Spline1D splines[2]; /* splines[0] is the x spline, splines[1] is y */
872  struct linearapprox *approx;
873  /* Posible optimizations:
874  Precalculate bounding box
875  Precalculate min/max/ points of inflection
876  */
878 
879 
880 typedef struct splinepointlist {
882  struct splinepointlist *next;
883  uint8 ticked;
884  uint8 beziers_need_optimizer; /* If the spiros have changed in spiro mode, then reverting to bezier mode might, someday, run a simplifier */
885  uint8 is_clip_path; /* In type3/svg fonts */
886  char *contour_name;
888 
889 typedef struct imagelist {
890  struct gimage *image;
891  real xoff, yoff; /* position in character space of upper left corner of image */
892  real xscale, yscale; /* scale to convert one pixel of image to one unit of character space */
894  struct imagelist *next;
895  unsigned int selected: 1;
897 
898 typedef struct refchar {
899  unsigned int checked: 1;
900  unsigned int selected: 1;
901  unsigned int point_match: 1; /* match_pt* are point indexes */
902  /* and need to be converted to a */
903  /* translation after truetype readin */
904  unsigned int encoded: 1; /* orig_pos is actually an encoded value, used for old sfd files */
905  unsigned int justtranslated: 1; /* The transformation matrix specifies a translation (or is identity) */
906  unsigned int use_my_metrics: 1; /* Retain the ttf "use_my_metrics" info. */
907  /* important for glyphs with instructions which change the width used */
908  /* inside composites */
909  unsigned int round_translation_to_grid: 1; /* Retain the ttf "round_to_grid" info. */
910  unsigned int point_match_out_of_date: 1; /* Someone has edited a base glyph */
912  int orig_pos;
913  int unicode_enc; /* used by paste */
914  real transform[6]; /* transformation matrix (first 2 rows of a 3x3 matrix, missing row is 0,0,1) */
915  struct reflayer {
916  unsigned int background: 1;
917  unsigned int order2: 1;
918  unsigned int anyflexes: 1;
919 #ifdef FONTFORGE_CONFIG_TYPE3
920  unsigned int dofill: 1;
921  unsigned int dostroke: 1;
922  unsigned int fillfirst: 1;
923  struct brush fill_brush;
924  struct pen stroke_pen;
925 #endif
927  ImageList *images; /* Only in background or type3 layer(s) */
928  } *layers;
929  int layer_cnt;
930  struct refchar *next;
931  DBounds bb;
932  struct splinechar *sc;
933  BasePoint top;
936 
937 /* Some stems may appear, disappear, reapear several times */
938 /* Serif stems on I which appear at 0, disappear, reappear at top */
939 /* Or the major vertical stems on H which disappear at the cross bar */
940 typedef struct hintinstance {
941  real begin; /* location in the non-major direction*/
942  real end; /* width/height in non-major direction*/
943  unsigned int closed: 1;
944  short int counternumber;
945  struct hintinstance *next;
947 
949 typedef real _MMArray[2][MmMax];
950 
951 typedef struct steminfo {
952  struct steminfo *next;
953  unsigned int hinttype: 2; /* Only used by undoes */
954  unsigned int ghost: 1; /* this is a ghost stem hint. As such truetype should ignore it, type2 output should negate it, and type1 should use as is */
955  /* stored width will be either 20 or 21 */
956  /* Type2 says: -20 is "width" of top edge, -21 is "width" of bottom edge, type1 accepts either */
957  unsigned int haspointleft:1;
958  unsigned int haspointright:1;
959  unsigned int hasconflicts:1;/* Does this stem have conflicts within its cluster? */
960  unsigned int used: 1; /* Temporary for counter hints or hint substitution */
961  unsigned int tobeused: 1; /* Temporary for counter hints or hint substitution */
962  unsigned int active: 1; /* Currently active hint in Review Hints dlg */
963  /* displayed differently in char display */
964  unsigned int enddone: 1; /* Used by ttf instructing, indicates a prev */
965  /* hint had the same end as this one (so */
966  /* the points on the end line have been */
967  /* instructed already */
968  unsigned int startdone: 1; /* Used by ttf instructing */
969  /*unsigned int backwards: 1;*/ /* If we think this hint is better done with a negative width */
970  unsigned int reordered: 1; /* In AutoHinting. Means we changed the start of the hint, need to test for out of order */
971  unsigned int pendingpt: 1; /* A pending stem creation, not a true stem */
972  unsigned int linearedges: 1;/* If we have a nice rectangle then we aren't */
973  /* interested in the orientation which is */
974  /* wider than long */
975  int16 hintnumber; /* when dumping out hintmasks we need to know */
976  /* what bit to set for this hint */
977  union {
978  int mask; /* Mask of all references that use this hint */
979  /* in type2 output */
980  _MMArray *unblended /*[2][MmMax]*/; /* Used when reading in type1 mm hints */
981  } u;
982  real start; /* location at which the stem starts */
983  real width; /* or height */
984  HintInstance *where; /* location(s) in the other coord */
986 
987 typedef struct dsteminfo {
988  struct dsteminfo *next; /* First two fields match those in steminfo */
989  unsigned int hinttype: 2; /* Only used by undoes */
990  unsigned int used: 1; /* used only by tottf.c:gendinstrs, metafont.c to mark a hint that has been dealt with */
992  HintInstance *where; /* location(s) along the unit vector */
994 
995 typedef struct minimumdistance {
996  /* If either point is NULL it will be assumed to mean either the origin */
997  /* or the width point (depending on which is closer). This allows user */
998  /* to control metrics... */
999  SplinePoint *sp1, *sp2;
1000  unsigned int x: 1;
1001  unsigned int done: 1;
1002  struct minimumdistance *next;
1004 
1005 typedef struct layer /* : reflayer */{
1006  unsigned int background: 1;
1007  unsigned int order2: 1;
1008  unsigned int anyflexes: 1;
1009 #ifdef FONTFORGE_CONFIG_TYPE3
1010  unsigned int dofill: 1;
1011  unsigned int dostroke: 1;
1012  unsigned int fillfirst: 1;
1013  struct brush fill_brush;
1014  struct pen stroke_pen;
1015 #endif
1017  ImageList *images; /* Only in background or type3 layer(s) */
1018  RefChar *refs; /* Only in foreground layer(s) */
1022  uint32 old_vs;
1024 
1025 enum layer_type { ly_all=-2, ly_grid= -1, ly_back=0, ly_fore=1,
1026  /* Possibly other foreground layers for type3 things */
1027  /* Possibly other background layers for normal fonts */
1028  ly_none = -3
1029  };
1030 
1031 /* For the 'MATH' table (and for TeX) */
1032 struct glyphvariants {
1033  char *variants; /* Space separated list of glyph names */
1034 /* Glyph assembly */
1035  int16 italic_correction; /* Of the composed glyph */
1036 #ifdef FONTFORGE_CONFIG_DEVICETABLES
1038 #endif
1039  int part_cnt;
1040  struct gv_part {
1041  char *component;
1042  unsigned int is_extender: 1; /* This component may be skipped or repeated */
1046  } *parts;
1047 };
1048 
1049 /* For the 'MATH' table */
1050 struct mathkernvertex {
1051  int cnt; /* There is one more kern entry than height entry */
1052  /* So the last mkd should have its height ignored */
1053  /* The MATH table stores the height count, I think the kern count */
1054  /* is more useful. They differ by 1 */
1055  struct mathkerndata {
1057 #ifdef FONTFORGE_CONFIG_DEVICETABLES
1058  DeviceTable *height_adjusts;
1059  DeviceTable *kern_adjusts;
1060 #endif
1061  } *mkd;
1062 };
1063 
1064 struct mathkern {
1065  struct mathkernvertex top_right;
1066  struct mathkernvertex top_left;
1068  struct mathkernvertex bottom_left;
1069 };
1070 
1072  pds_odd = 0x1, /* Odd number of entries */
1073  pds_outoforder = 0x2, /* Bluevalues should be listed in order */
1074  pds_toomany = 0x4, /* arrays are of limited sizes */
1075  pds_tooclose = 0x8, /* adjacent zones must not be within 2*bluefuzz+1 (or 3, if bluefuzz omitted) */
1076  pds_notintegral= 0x10, /* Must be integers */
1077  pds_toobig = 0x20, /* within pair difference have some relation to BlueScale but the docs make no sense to me */
1078  pds_shift = 8, /* BlueValues/OtherBlues, unshifted, FamilyBlues/FamilyOtherBlues shifted once */
1079 
1080  pds_missingblue = 0x010000,
1081  pds_badbluefuzz = 0x020000,
1082  pds_badbluescale = 0x040000,
1083  pds_badstdhw = 0x080000,
1084  pds_badstdvw = 0x100000,
1085  pds_badstemsnaph = 0x200000,
1086  pds_badstemsnapv = 0x400000,
1087  pds_stemsnapnostdh = 0x0800000,
1088  pds_stemsnapnostdv = 0x1000000,
1089  pds_badblueshift = 0x2000000
1090 
1091 };
1092 
1094  vs_known=0x01, /* It has been validated */
1098  vs_flippedreferences=0x10, /* special case of wrong direction */
1101  /* Next few are postscript only */
1105  /* Next few are only for fontlint */
1106  /* These are relative to maxp values which ff would fix on generating a font */
1114  /* vs_maxp_prepfpgmtoolong=0x20000, */ /* I think I was wrong about this "error" */
1115  /* Oops, we need another one, two, for the glyphs */
1117  vs_nonintegral = 0x80000, /* This will never be interesting in a real font, but might be in an sfd file */
1118  vs_missinganchor = 0x100000,
1119  vs_dupname = 0x200000,
1120  vs_dupunicode = 0x400000,
1121 
1127  };
1128 
1129 typedef struct splinechar {
1130  char *name;
1131  int unicodeenc;
1132  int orig_pos; /* Original position in the glyph list */
1135  int16 lsidebearing; /* only used when reading in a type1 font */
1136  /* Or an otf font where it is the subr number of a refered character */
1137  /* or a ttf font without bit 1 of head.flags set */
1138  /* or (once upon a time, but no longer) a ttf font with vert metrics where it is the ymax value when we had a font-wide vertical offset */
1139  /* Always a temporary value */
1140  int ttf_glyph; /* only used when writing out a ttf or otf font */
1141  Layer *layers; /* layer[0] is background, layer[1] foreground */
1142  /* In type3 fonts 2-n are also foreground, otherwise also background */
1143  int layer_cnt;
1144  StemInfo *hstem; /* hstem hints have a vertical offset but run horizontally */
1145  StemInfo *vstem; /* vstem hints have a horizontal offset but run vertically */
1146  DStemInfo *dstem; /* diagonal hints for ttf */
1149  struct charinfo *charinfo;
1150  struct splinefont *parent;
1151  unsigned int changed: 1;
1152  unsigned int changedsincelasthinted: 1;
1153  unsigned int manualhints: 1;
1154  unsigned int ticked: 1; /* For reference character processing */
1155  /* And fontview processing */
1156  unsigned int changed_since_autosave: 1;
1157  unsigned int widthset: 1; /* needed so an emspace char doesn't disappear */
1158  unsigned int vconflicts: 1; /* Any hint overlaps in the vstem list? */
1159  unsigned int hconflicts: 1; /* Any hint overlaps in the hstem list? */
1160  unsigned int searcherdummy: 1;
1161  unsigned int changed_since_search: 1;
1162  unsigned int wasopen: 1;
1163  unsigned int namechanged: 1;
1164  unsigned int blended: 1; /* An MM blended character */
1165  unsigned int ticked2: 1;
1166  unsigned int glyph_class: 3; /* 0=> fontforge determines class automagically, else one more than the class value in gdef so 2+1=>lig, 3+1=>mark */
1167  unsigned int numberpointsbackards: 1;
1168  unsigned int instructions_out_of_date: 1;
1169  unsigned int complained_about_ptnums: 1;
1170  unsigned int vs_open: 1;
1171  unsigned int unlink_rm_ovrlp_save_undo: 1;
1172  unsigned int inspiro: 1;
1173  unsigned int lig_caret_cnt_fixed: 1;
1174  /* 6 bits left (one more if we ignore compositionunit below) */
1175 #if HANYANG
1176  unsigned int compositionunit: 1;
1177  int16 jamo, varient;
1178 #endif
1180  /* The dependents list is a list of all characters which refenence*/
1181  /* the current character directly */
1182  KernPair *kerns;
1183  KernPair *vkerns;
1184  PST *possub; /* If we are a ligature then this tells us what */
1185  /* It may also contain a bunch of other stuff now */
1186  LigList *ligofme; /* If this is the first character of a ligature then this gives us the list of possible ones */
1187  /* this field must be regenerated before the font is saved */
1188  char *comment; /* in utf8 */
1189  uint32 /*Color*/ color;
1191  uint8 *ttf_instrs;
1195  struct altuni { struct altuni *next; int unienc, vs, fid; } *altuni;
1196  /* vs is the "variation selector" a unicode codepoint which modifieds */
1197  /* the code point before it. If vs is -1 then unienc is just an */
1198  /* alternate encoding (greek Alpha and latin A), but if vs is one */
1199  /* of unicode's variation selectors then this glyph is somehow a */
1200  /* variant shape. The specifics depend on the selector and script */
1201  /* fid is currently unused, but may, someday, be used to do ttcs */
1202  /* NOTE: GlyphInfo displays vs==-1 as vs==0, and fixes things up */
1203 /* for TeX */
1205 /* TeX also uses italic_correction and glyph variants below */
1206 /* For the 'MATH' table (and for TeX) */
1207  unsigned int is_extended_shape: 1;
1209  int16 top_accent_horiz; /* MATH table allows you to specific a*/
1210  /* horizontal anchor for accent attachments, vertical */
1211  /* positioning is done elsewhere */
1212 #ifdef FONTFORGE_CONFIG_DEVICETABLES
1215 #endif
1216  struct glyphvariants *vert_variants;
1217  struct glyphvariants *horiz_variants;
1218  struct mathkern *mathkern;
1219 /* End of MATH/TeX fields */
1220 #ifndef _NO_PYTHON
1223 #endif
1224  void *python_persistent; /* If python this will hold a python object, if not python this will hold a string containing a pickled object. We do nothing with it (if not python) except save it back out unchanged */
1225 #ifdef FONTFORGE_CONFIG_TYPE3
1226  /* If the glyph is used as a tile pattern, then the next two values */
1227  /* determine the amount of white space around the tile. If extra is*/
1228  /* non-zero then we add it to the max components of the bbox and */
1229  /* subtract it from the min components. If extra is 0 then tile_bounds*/
1230  /* will be used. If tile_bounds is all zeros then the glyph's bbox */
1231  /* will be used. */
1232  real tile_margin; /* If the glyph is used as a tile */
1234 #endif
1236 
1237 #define TEX_UNDEF 0x7fff
1238 
1245 struct ttflangname {
1246  int lang;
1247  char *names[ttf_namemax]; /* in utf8 */
1248  int frommac[(ttf_namemax+31)/32]; /* Used when parsing the 'name' table */
1249  struct ttflangname *next;
1250 };
1251 
1252 #ifdef FONTFORGE_CONFIG_DEVICETABLES
1253 struct MATH {
1254 /* From the MATH Constants subtable (constants for positioning glyphs. Not PI)*/
1261  int16 AxisHeight;
1362 /* Global constants from other subtables */
1363  uint16 MinConnectorOverlap; /* in the math variants sub-table */
1364 };
1365 #else
1366 struct MATH {
1367 /* From the MATH Constants subtable (constants for positioning glyphs. Not PI)*/
1373  int16 AxisHeight;
1424 /* Global constants from other subtables */
1425  uint16 MinConnectorOverlap; /* in the math variants sub-table */
1426 };
1427 #endif
1428 
1440  lvs_bad_sfnt_header = 0x200
1441  };
1442 
1443 typedef struct layerinfo {
1444  char *name;
1445  unsigned int background: 1; /* Layer is to be treated as background: No width, images, not worth outputting */
1446  unsigned int order2: 1; /* Layer's data are order 2 bezier splines (truetype) rather than order 3 (postscript) */
1447  /* In all glyphs in the font */
1448  unsigned int ticked: 1;
1450 
1451 /* Baseline data from the 'BASE' table */
1452 struct baselangextent {
1453  uint32 lang; /* also used for feature tag */
1454  struct baselangextent *next;
1455  int16 ascent, descent;
1456  struct baselangextent *features;
1457 };
1458 
1459 struct basescript {
1460  uint32 script;
1461  struct basescript *next;
1462  int def_baseline; /* index [0-baseline_cnt) */
1463  int16 *baseline_pos; /* baseline_cnt of these */
1464  struct baselangextent *langs; /* Language specific extents (may be NULL) */
1465  /* The default one has the tag DEFAULT_LANG */
1466 };
1467 
1468 struct Base {
1469  int baseline_cnt;
1471  /* A font does not need to provide info on all baselines, but if one script */
1472  /* talks about a baseline, then all must. So the set of baselines is global*/
1473  struct basescript *scripts;
1474 };
1475 
1476 typedef struct splinefont {
1477  char *fontname, *fullname, *familyname, *weight;
1478  char *copyright;
1479  char *filename; /* sfd name. NULL if we open a font, that's origname */
1480  char *defbasefilename;
1481  char *version;
1482  real italicangle, upos, uwidth; /* In font info */
1484  struct splinefont *next;
1485  int ascent, descent;
1486  int uniqueid; /* Not copied when reading in!!!! */
1487  int glyphcnt, glyphmax,glyphmin; /* allocated size of glyphs array */
1488  SplineChar **glyphs;
1489  unsigned int changed: 1;
1490  unsigned int changed_since_autosave: 1;
1491  unsigned int changed_since_xuidchanged: 1;
1492  unsigned int display_antialias: 1;
1493  unsigned int display_bbsized: 1;
1494  unsigned int dotlesswarn: 1; /* User warned that font doesn't have a dotless i character */
1495  unsigned int onlybitmaps: 1; /* it's a bdf editor, not a postscript editor */
1496  unsigned int serifcheck: 1; /* Have we checked to see if we have serifs? */
1497  unsigned int issans: 1; /* We have no serifs */
1498  unsigned int isserif: 1; /* We have serifs. If neither set then we don't know. */
1499  unsigned int hasvmetrics: 1; /* We've got vertical metric data and should output vhea/vmtx/VORG tables */
1500  unsigned int loading_cid_map: 1;
1501  unsigned int dupnamewarn: 1; /* Warn about duplicate names when loading bdf font */
1502  unsigned int encodingchanged: 1; /* Font's encoding has changed since it was loaded */
1503  unsigned int multilayer: 1; /* only applies if TYPE3 is set, means this font can contain strokes & fills */
1504  /* I leave it in so as to avoid cluttering up code with #ifdefs */
1505  unsigned int strokedfont: 1;
1506  unsigned int new: 1; /* A new and unsaved font */
1507  unsigned int compacted: 1; /* only used when opening a font */
1508  unsigned int backedup: 2; /* 0=>don't know, 1=>no, 2=>yes */
1509  unsigned int use_typo_metrics: 1; /* The standard says to. But MS */
1510  /* seems to feel that isn't good */
1511  /* enough and has created a bit */
1512  /* to mean "really use them" */
1513  unsigned int weight_width_slope_only: 1; /* This bit seems stupid to me */
1514  unsigned int save_to_dir: 1; /* Loaded from an sfdir collection rather than a simple sfd file */
1515  unsigned int head_optimized_for_cleartype: 1;/* Bit in the 'head' flags field, if unset "East Asian fonts in the Windows Presentation Framework (Avalon) will not be hinted" */
1516  unsigned int ticked: 1;
1517  unsigned int internal_temp: 1; /* Internal temporary font to be passed to freetype for rasterizing. Don't complain about oddities */
1518  unsigned int complained_about_spiros: 1;
1519  unsigned int use_xuid: 1; /* Adobe has deprecated these two */
1520  unsigned int use_uniqueid: 1; /* fields. Mostly we don't want to use them */
1521  /* 2 bits left */
1522  struct fontviewbase *fv;
1523  struct metricsview *metrics;
1524  enum uni_interp uni_interp;
1526  EncMap *map; /* only used when opening a font to provide original default encoding */
1527  Layer grid;
1529  char *origname; /* filename of font file (ie. if not an sfd) */
1530  char *autosavename;
1531  int display_size; /* a val <0 => Generate our own images from splines, a value >0 => find a bdf font of that size */
1532  struct psdict *private; /* read in from type1 file or provided by user */
1533  char *xuid;
1534  struct pfminfo { /* A misnomer now. OS/2 info would be more accurate, but that's stuff in here from all over ttf files */
1535  unsigned int pfmset: 1;
1536  unsigned int winascent_add: 1;
1537  unsigned int windescent_add: 1;
1538  unsigned int hheadascent_add: 1;
1539  unsigned int hheaddescent_add: 1;
1540  unsigned int typoascent_add: 1;
1541  unsigned int typodescent_add: 1;
1542  unsigned int subsuper_set: 1;
1543  unsigned int panose_set: 1;
1544  unsigned int hheadset: 1;
1545  unsigned int vheadset: 1;
1546  unsigned int hascodepages: 1;
1547  unsigned int hasunicoderanges: 1;
1548  unsigned char pfmfamily;
1551  char panose[10];
1553  int16 linegap; /* from hhea */
1554  int16 vlinegap; /* from vhea */
1561  char os2_vendor[4];
1573  struct ttflangname *names;
1574  char *cidregistry, *ordering;
1575  int supplement;
1576  int subfontcnt;
1577  struct splinefont **subfonts;
1578  struct splinefont *cidmaster; /* Top level cid font */
1579  float cidversion;
1580 #if HANYANG
1581  struct compositionrules *rules;
1582 #endif
1583  char *comments; /* Used to be restricted to ASCII, now utf8 */
1584  char *fontlog;
1585  int tempuniqueid;
1586  int top_enc;
1588  struct glyphnamehash *glyphnames;
1589  struct ttf_table {
1593  struct ttf_table *next;
1594  FILE *temp; /* Temporary storage used during generation */
1596  /* We copy: fpgm, prep, cvt, maxp (into ttf_tables) user can ask for others, into saved*/
1597  char **cvt_names;
1598  /* The end of this array is marked by a special entry: */
1599 #define END_CVT_NAMES ((char *) (~(intpt) 0))
1600  struct instrdata *instr_dlgs; /* Pointer to all table and character instruction dlgs in this font */
1601  struct shortview *cvt_dlg;
1602  struct kernclasslistdlg *kcld, *vkcld;
1603  struct kernclassdlg *kcd;
1604  struct texdata {
1606  int32 params[22]; /* param[6] has different meanings in normal and math fonts */
1610  KernClass *kerns, *vkerns;
1611  FPST *possub;
1612  char *chosenname; /* Set for files with multiple fonts in them */
1613  struct mmset *mm; /* If part of a multiple master set */
1614  int16 macstyle;
1615  char *fondname; /* For use in generating mac families */
1616  /* from the GPOS 'size' feature. design_size, etc. are measured in tenths of a point */
1617  /* bottom is exclusive, top is inclusive */
1618  /* if any field is 0, it is undefined. All may be undefined, All may be */
1619  /* defined, or design_size may be defined without any of the others */
1620  /* but we can't define the range without defining the other junk */
1621  /* Name must contain an English language name, may contain others */
1624  struct otfname *fontstyle_name;
1627 /* For GDEF Mark Attachment Class -- used in lookup flags */
1628 /* As usual, class 0 is unused */
1629  int mark_class_cnt;
1630  char **mark_classes; /* glyph name list */
1631  char **mark_class_names; /* used within ff, utf8 (the name we've given to this class of marks) */
1632 #ifdef _HAS_LONGLONG
1633  long long creationtime; /* seconds since 1970 */
1634  long long modificationtime;
1635 #else
1638 #endif
1639  short os2_version; /* 0 means default rather than the real version 0 */
1640  short compression; /* If we opened a compressed sfd file, then save it out compressed too */
1641  short gasp_version; /* 0/1 currently */
1642  short gasp_cnt;
1643  struct gasp {
1646  } *gasp;
1647  struct MATH *MATH;
1648  float sfd_version; /* Used only when reading in an sfd file */
1649  struct gfi_data *fontinfo;
1650  struct val_data *valwin;
1652  void *python_persistent; /* If python this will hold a python object, if not python this will hold a string containing a pickled object. We do nothing with it (if not python) except save it back out unchanged */
1654  LayerInfo *layers;
1655  int layer_cnt;
1656  int display_layer;
1657  struct Base *horiz_base, *vert_base;
1658  int extrema_bound; /* Splines do not count for extrema complaints when the distance between the endpoints is less than or equal to this */
1660 
1661 /* I am going to simplify my life and not encourage intermediate designs */
1662 /* this means I can easily calculate ConvertDesignVector, and don't have */
1663 /* to bother the user with specifying it. */
1664 /* (NormalizeDesignVector is fairly basic and shouldn't need user help ever) */
1665 /* (As long as they want piecewise linear) */
1666 typedef struct mmset {
1667  int axis_count;
1668  char *axes[4];
1669  int instance_count;
1671  SplineFont *normal;
1672  real *positions; /* array[instance][axis] saying where each instance lies on each axis */
1673  real *defweights; /* array[instance] saying how much of each instance makes the normal font */
1674  struct axismap {
1675  int points; /* size of the next two arrays */
1676  real *blends; /* between [0,1] ordered so that blend[0]<blend[1]<... */
1677  real *designs; /* between the design ranges for this axis, typically [1,999] or [6,72] */
1678  real min, def, max; /* For mac */
1679  } *axismaps; /* array[axis] */
1680  char *cdv, *ndv; /* for adobe */
1681  unsigned int changed: 1;
1683 
1684 /* mac styles. Useful idea we'll just steal it */
1686  sf_shadow = 0x10, sf_condense = 0x20, sf_extend = 0x40 };
1687 
1688 struct sflist {
1689  SplineFont *sf;
1690  int32 *sizes;
1691  FILE *tempttf; /* For ttf */
1692  int id; /* For ttf */
1693  int* ids; /* One for each size */
1694  BDFFont **bdfs; /* Ditto */
1695  EncMap *map;
1696  struct sflist *next;
1697  char **former_names;
1698 };
1699 
1700  /* Used for drawing text with mark to base anchors */
1701 typedef struct anchorpos {
1702  SplineChar *sc; /* This is the mark being positioned */
1703  int x,y; /* Its origin should be shifted this much relative to that of the original base char */
1704  AnchorPoint *apm; /* The anchor point in sc used to position it */
1705  AnchorPoint *apb; /* The anchor point in the base character against which we are positioned */
1706  int base_index; /* Index in this array to the base character (-1=> original base char) */
1707  unsigned int ticked: 1; /* Used as a mark to mark */
1709 
1717  ttf_flag_oldkern=0x200, /* never set in conjunction with applemode */
1718  ttf_flag_brokensize=0x400, /* Adobe originally issued fonts with a bug in the size feature. They now claim (Aug 2006) that this has been fixed. Legacy programs will do the wrong thing with the fixed feature though */
1723  ttf_flag_dummyDSIG=0x8000
1724  };
1727 enum ps_flags { ps_flag_nohintsubs = 0x10000, ps_flag_noflex=0x20000,
1729  ps_flag_afm = 0x100000, ps_flag_pfm = 0x200000,
1730  ps_flag_tfm = 0x400000,
1731  ps_flag_round = 0x800000,
1732 /* CFF fonts are wrapped up in some postscript sugar -- unless they are to */
1733 /* go into a pdf file or an otf font */
1734  ps_flag_nocffsugar = 0x1000000,
1735 /* in type42 cid fonts we sometimes want an identity map from gid to cid */
1738  ps_flag_noseac = 0x8000000,
1742  };
1743 
1744 struct compressors { char *ext, *decomp, *recomp; };
1745 struct archivers {
1748 };
1749 
1750 struct fontdict;
1751 struct pschars;
1752 struct findsel;
1753 struct charprocs;
1754 struct enc;
1755 
1756 /* extern void *chunkalloc(int size); */
1757 /* extern void chunkfree(void *, int size); */
1758 
1759 #define chunkalloc(size) gcalloc(1,size)
1760 #define chunkfree(item,size) free(item)
1761 
1762 extern char *strconcat(const char *str, const char *str2);
1763 extern char *strconcat3(const char *str, const char *str2, const char *str3);
1764 
1765 extern char *XUIDFromFD(int xuid[20]);
1766 extern SplineFont *SplineFontFromPSFont(struct fontdict *fd);
1767 extern int CheckAfmOfPostscript(SplineFont *sf, const char *psname,EncMap *map);
1768 extern int LoadKerningDataFromAmfm(SplineFont *sf, char *filename, EncMap *map);
1769 extern int LoadKerningDataFromAfm(SplineFont *sf, char *filename, EncMap *map);
1777 extern void SFApplyFeatureFile(SplineFont *sf,FILE *file,char *filename);
1778 extern void SFApplyFeatureFilename(SplineFont *sf,char *filename);
1779 extern void SubsNew(SplineChar *to,enum possub_type type,int tag,char *components,
1780  SplineChar *default_script);
1781 extern void PosNew(SplineChar *to,int tag,int dx, int dy, int dh, int dv);
1782 extern int SFOneWidth(SplineFont *sf);
1783 extern int CIDOneWidth(SplineFont *sf);
1792 extern struct pschars *SplineFont2ChrsSubrs(SplineFont *sf, int iscjk,
1793  struct pschars *subrs,int flags,enum fontformat format,int layer);
1794 extern int CanonicalCombiner(int uni);
1795 struct cidbytes;
1796 struct fd2data;
1797 struct ttfinfo;
1798 struct alltabs;
1799 struct growbuf;
1800 struct glyphdata;
1801 extern int UnitsParallel(BasePoint *u1,BasePoint *u2,int strict);
1802 extern int CvtPsStem3(struct growbuf *gb, SplineChar *scs[MmMax], int instance_count,
1803  int ishstem, int round);
1804 extern struct pschars *SplineFont2ChrsSubrs2(SplineFont *sf, int nomwid,
1805  int defwid, const int *bygid, int cnt, int flags,
1806  struct pschars **_subrs,int layer);
1807 extern struct pschars *CID2ChrsSubrs2(SplineFont *cidmaster,struct fd2data *fds,
1808  int flags, struct pschars **_glbls,int layer);
1810  bf_nfntmacbin, /*bf_nfntdfont, */bf_fon, bf_fnt, bf_palm,
1813 extern const char *GetAuthor(void);
1815 extern void SC_PSDump(void (*dumpchar)(int ch,void *data), void *data,
1816  SplineChar *sc, int refs_to_splines, int pdfopers,int layer );
1818 extern int WritePSFont(char *fontname,SplineFont *sf,enum fontformat format,int flags,EncMap *enc,SplineFont *fullsf,int layer);
1820  int flags,EncMap *enc,int layer);
1821 extern int _WriteTTFFont(FILE *ttf,SplineFont *sf, enum fontformat format,
1822  int32 *bsizes, enum bitmapformat bf,int flags,EncMap *enc,int layer);
1823 extern int WriteTTFFont(char *fontname,SplineFont *sf, enum fontformat format,
1824  int32 *bsizes, enum bitmapformat bf,int flags,EncMap *enc,int layer);
1826  int flags,EncMap *enc,int layer);
1828  int32 *bsizes, enum bitmapformat bf,int flags,EncMap *enc,int layer);
1829 extern int WriteMacBitmaps(char *filename,SplineFont *sf, int32 *sizes,
1830  int is_dfont,EncMap *enc);
1831 extern int WritePalmBitmaps(char *filename,SplineFont *sf, int32 *sizes,EncMap *enc);
1832 extern int WriteMacFamily(char *filename,struct sflist *sfs,enum fontformat format,
1833  enum bitmapformat bf,int flags,EncMap *enc,int layer);
1834 extern long mactime(void);
1837 extern void SfListFree(struct sflist *sfs);
1838 extern void DefaultTTFEnglishNames(struct ttflangname *dummy, SplineFont *sf);
1841 extern void OS2FigureCodePages(SplineFont *sf, uint32 CodePage[2]);
1842 extern void OS2FigureUnicodeRanges(SplineFont *sf, uint32 Ranges[4]);
1843 extern void SFDefaultOS2Info(struct pfminfo *pfminfo,SplineFont *sf,char *fontname);
1844 extern void SFDefaultOS2Simple(struct pfminfo *pfminfo,SplineFont *sf);
1845 extern void SFDefaultOS2SubSuper(struct pfminfo *pfminfo,int emsize,double italicangle);
1847 extern int ScriptIsRightToLeft(uint32 script);
1848 extern void ScriptMainRange(uint32 script, int *start, int *end);
1849 extern uint32 ScriptFromUnicode(int u,SplineFont *sf);
1851 extern int SCRightToLeft(SplineChar *sc);
1852 extern int SLIContainsR2L(SplineFont *sf,int sli);
1853 extern void SFFindNearTop(SplineFont *);
1855 extern int SFForceEncoding(SplineFont *sf,EncMap *old,Encoding *new_map);
1857 extern void SFMatchGlyphs(SplineFont *sf,SplineFont *target,int addempties);
1858 extern void MMMatchGlyphs(MMSet *mm);
1859 extern char *_GetModifiers(char *fontname, char *familyname,char *weight);
1860 extern char *SFGetModifiers(SplineFont *sf);
1862  const unichar_t *weight);
1863 extern void SFSetFontName(SplineFont *sf, char *family, char *mods, char *full);
1864 extern void ttfdumpbitmap(SplineFont *sf,struct alltabs *at,int32 *sizes);
1865 extern void ttfdumpbitmapscaling(SplineFont *sf,struct alltabs *at,int32 *sizes);
1867 
1868 extern int RealNear(real a,real b);
1869 extern int RealNearish(real a,real b);
1870 extern int RealApprox(real a,real b);
1871 extern int RealWithin(real a,real b,real fudge);
1872 extern int RealRatio(real a,real b,real fudge);
1873 
1875 extern int MergeDStemInfo(SplineFont *sf,DStemInfo **ds, DStemInfo *test);
1876 
1877 extern void LineListFree(LineList *ll);
1878 extern void LinearApproxFree(LinearApprox *la);
1879 extern void SplineFree(Spline *spline);
1881 extern void SplinePointFree(SplinePoint *sp);
1883 extern void SplinePointsFree(SplinePointList *spl);
1884 extern void SplinePointListFree(SplinePointList *spl);
1888 extern void SplineSetBeziersClear(SplineSet *spl);
1889 extern void RefCharFree(RefChar *ref);
1890 extern void RefCharsFree(RefChar *ref);
1891 extern void RefCharsFreeRef(RefChar *ref);
1892 extern void CopyBufferFree(void);
1894 extern void UndoesFree(Undoes *undo);
1895 extern void StemInfosFree(StemInfo *h);
1896 extern void StemInfoFree(StemInfo *h);
1897 extern void DStemInfosFree(DStemInfo *h);
1898 extern void DStemInfoFree(DStemInfo *h);
1899 extern void KernPairsFree(KernPair *kp);
1900 extern void SCOrderAP(SplineChar *sc);
1901 extern void AnchorPointsFree(AnchorPoint *ap);
1903 extern void SFRemoveAnchorClass(SplineFont *sf,AnchorClass *an);
1905 extern int IsAnchorClassUsed(SplineChar *sc,AnchorClass *an);
1906 extern AnchorPoint *APAnchorClassMerge(AnchorPoint *anchors,AnchorClass *into,AnchorClass *from);
1908 extern void AnchorClassesFree(AnchorClass *kp);
1909 extern void TtfTablesFree(struct ttf_table *tab);
1912  AnchorClass *restrict_, AnchorPoint **_ap1,AnchorPoint **_ap2 );
1914  AnchorPoint **_ap1,AnchorPoint **_ap2 );
1916  AnchorPoint **_ap1,AnchorPoint **_ap2 );
1917 extern void SCInsertPST(SplineChar *sc,PST *new);
1918 #ifdef FONTFORGE_CONFIG_DEVICETABLES
1919 extern void ValDevFree(ValDevTab *adjust);
1920 extern ValDevTab *ValDevTabCopy(ValDevTab *orig);
1921 extern void DeviceTableFree(DeviceTable *adjust);
1922 extern DeviceTable *DeviceTableCopy(DeviceTable *orig);
1923 extern void DeviceTableSet(DeviceTable *adjust, int size, int correction);
1924 #endif
1925 extern void PSTFree(PST *lig);
1927 extern int PSTContains(const char *components,const char *name);
1928 extern StemInfo *StemInfoCopy(StemInfo *h);
1934  int lcnt;
1935  struct lookup_cvt { OTLookup *from, *to; int old;} *lks;
1936  int scnt;
1937  struct sub_cvt { struct lookup_subtable *from, *to; int old;} *subs;
1938  int acnt;
1939  struct ac_cvt { AnchorClass *from, *to; int old;} *acs;
1940  char *prefix;
1942  int lmax;
1943 };
1944 extern PST *PSTCopy(PST *base,SplineChar *sc,struct sfmergecontext *mc);
1945 extern struct lookup_subtable *MCConvertSubtable(struct sfmergecontext *mc,struct lookup_subtable *sub);
1947 extern void SFFinishMergeContext(struct sfmergecontext *mc);
1950 extern void BCFlattenFloat(BDFChar *bc);
1951 extern void BitmapsCopy(SplineFont *to, SplineFont *from, int to_index, int from_index );
1952 extern struct gimage *ImageAlterClut(struct gimage *image);
1953 extern void ImageListsFree(ImageList *imgs);
1954 extern void TTFLangNamesFree(struct ttflangname *l);
1955 extern void AltUniFree(struct altuni *altuni);
1956 extern void AltUniRemove(SplineChar *sc,int uni);
1957 extern void MinimumDistancesFree(MinimumDistance *md);
1958 extern void LayerDefault(Layer *);
1959 extern SplineChar *SplineCharCreate(int layer_cnt);
1961 extern RefChar *RefCharCreate(void);
1962 extern RefChar *RefCharsCopy(RefChar *ref); /* Still needs to be instanciated and have the dependency list adjusted */
1963 extern void SCAddRef(SplineChar *sc,SplineChar *rsc,int layer, real xoff, real yoff);
1964 extern void _SCAddRef(SplineChar *sc,SplineChar *rsc,int layer, real transform[6]);
1965 extern KernClass *KernClassCopy(KernClass *kc);
1966 extern void KernClassFreeContents(KernClass *kc);
1967 extern void KernClassListFree(KernClass *kc);
1968 extern int KernClassContains(KernClass *kc, char *name1, char *name2, int ordered );
1969 extern void OTLookupFree(OTLookup *lookup);
1970 extern void OTLookupListFree(OTLookup *lookup );
1971 extern FPST *FPSTCopy(FPST *fpst);
1972 extern void FPSTRuleContentsFree(struct fpst_rule *r, enum fpossub_format format);
1973 extern void FPSTRulesFree(struct fpst_rule *r, enum fpossub_format format, int rcnt);
1974 extern void FPSTFree(FPST *fpst);
1975 extern void GlyphVariantsFree(struct glyphvariants *gv);
1976 extern void MathKernVContentsFree(struct mathkernvertex *mk);
1977 extern void MathKernFree(struct mathkern *mk);
1978 extern struct mathkern *MathKernCopy(struct mathkern *mk);
1979 extern void SplineCharListsFree(struct splinecharlist *dlist);
1980 extern void LayerFreeContents(SplineChar *sc, int layer);
1981 extern void SplineCharFreeContents(SplineChar *sc);
1982 extern void SplineCharFree(SplineChar *sc);
1983 extern void EncMapFree(EncMap *map);
1986 extern EncMap *EncMapNew(int encmax, int backmax, Encoding *enc);
1987 extern EncMap *EncMap1to1(int enccount);
1988 extern EncMap *EncMapCopy(EncMap *map);
1989 extern void SFExpandGlyphCount(SplineFont *sf, int newcnt);
1990 extern void ScriptLangListFree(struct scriptlanglist *sl);
1992 extern void SFBaseSort(SplineFont *sf);
1993 extern struct baselangextent *BaseLangCopy(struct baselangextent *extent);
1994 extern void BaseLangFree(struct baselangextent *extent);
1995 extern void BaseScriptFree(struct basescript *bs);
1996 extern void BaseFree(struct Base *base);
1997 extern void SplineFontFree(SplineFont *sf);
1998 extern void MATHFree(struct MATH *math);
1999 extern struct MATH *MathTableNew(SplineFont *sf);
2000 extern void OtfNameListFree(struct otfname *on);
2001 extern void MarkClassFree(int cnt,char **classes,char **names);
2002 extern void MMSetFreeContents(MMSet *mm);
2003 extern void MMSetFree(MMSet *mm);
2005 extern void SplineRefigure3(Spline *spline);
2006 extern void SplineRefigure(Spline *spline);
2007 extern Spline *SplineMake3(SplinePoint *from, SplinePoint *to);
2009 extern int SplinePointListIsClockwise(const SplineSet *spl);
2010 extern void SplineSetFindBounds(const SplinePointList *spl, DBounds *bounds);
2011 extern void SplineCharLayerFindBounds(SplineChar *sc,int layer,DBounds *bounds);
2012 extern void SplineCharFindBounds(SplineChar *sc,DBounds *bounds);
2013 extern void SplineFontLayerFindBounds(SplineFont *sf,int layer,DBounds *bounds);
2014 extern void SplineFontFindBounds(SplineFont *sf,DBounds *bounds);
2015 extern void CIDLayerFindBounds(SplineFont *sf,int layer,DBounds *bounds);
2016 extern void SplineSetQuickBounds(SplineSet *ss,DBounds *b);
2017 extern void SplineCharQuickBounds(SplineChar *sc, DBounds *b);
2021 extern void SplinePointCatagorize(SplinePoint *sp);
2022 extern int SplinePointIsACorner(SplinePoint *sp);
2023 extern void SPLCatagorizePoints(SplinePointList *spl);
2024 extern void SCCatagorizePoints(SplineChar *sc);
2028 extern ImageList *ImageListCopy(ImageList *cimg);
2030 extern void ApTransform(AnchorPoint *ap, real transform[6]);
2032 extern SplinePointList *SplinePointListShift(SplinePointList *base, real xoff, int allpoints );
2034  SplineChar *basesc,HintMask *hm);
2036  SplineChar *basesc, SplineChar *subsc, BasePoint *trans);
2038  SplineChar *basesc, BasePoint *trans,int layer);
2040 extern void SplinePointListSet(SplinePointList *tobase, SplinePointList *frombase);
2041 extern void SplinePointListSelect(SplinePointList *spl,int sel);
2042 extern void SCRefToSplines(SplineChar *sc,RefChar *rf,int layer);
2043 extern void RefCharFindBounds(RefChar *rf);
2044 extern void SCReinstanciateRefChar(SplineChar *sc,RefChar *rf,int layer);
2045 extern void SCReinstanciateRef(SplineChar *sc,SplineChar *rsc,int layer);
2046 extern void SFReinstanciateRefs(SplineFont *sf);
2047 extern void SFInstanciateRefs(SplineFont *sf);
2048 extern SplineChar *MakeDupRef(SplineChar *base, int local_enc, int uni_enc);
2049 extern void SCRemoveDependent(SplineChar *dependent,RefChar *rf,int layer);
2050 extern void SCRemoveLayerDependents(SplineChar *dependent,int layer);
2051 extern void SCRemoveDependents(SplineChar *dependent);
2053 extern void BCCompressBitmap(BDFChar *bdfc);
2054 extern void BCRegularizeBitmap(BDFChar *bdfc);
2055 extern void BCRegularizeGreymap(BDFChar *bdfc);
2056 extern void BCPasteInto(BDFChar *bc,BDFChar *rbc,int ixoff,int iyoff, int invert, int cleartoo);
2057 extern void BCRotateCharForVert(BDFChar *bc,BDFChar *from, BDFFont *frombdf);
2058 extern int GradientHere(double scale,DBounds *bbox,int iy,int ix,
2059  struct gradient *grad,struct pattern *pat, int defgrey);
2060 extern void PatternPrep(SplineChar *sc,struct brush *brush,double scale);
2061 extern BDFChar *SplineCharRasterize(SplineChar *sc, int layer, double pixelsize);
2062 extern BDFFont *SplineFontToBDFHeader(SplineFont *_sf, int pixelsize, int indicate);
2063 extern BDFFont *SplineFontRasterize(SplineFont *sf, int layer, int pixelsize, int indicate);
2064 extern void BDFCAntiAlias(BDFChar *bc, int linear_scale);
2065 extern BDFChar *SplineCharAntiAlias(SplineChar *sc, int layer, int pixelsize,int linear_scale);
2066 extern BDFFont *SplineFontAntiAlias(SplineFont *sf, int layer, int pixelsize,int linear_scale);
2067 extern struct clut *_BDFClut(int linear_scale);
2068 extern void BDFClut(BDFFont *bdf, int linear_scale);
2069 extern int BDFDepth(BDFFont *bdf);
2070 extern BDFChar *BDFPieceMeal(BDFFont *bdf, int index);
2073 extern BDFFont *SplineFontPieceMeal(SplineFont *sf,int layer,int pixelsize,int flags,void *freetype_context);
2076 extern void BDFCharFree(BDFChar *bdfc);
2077 extern void BDFPropsFree(BDFFont *bdf);
2078 extern void BDFFontFree(BDFFont *bdf);
2081 extern int BDFFontDump(char *filename,BDFFont *font, EncMap *map, int res);
2082 extern int FNTFontDump(char *filename,BDFFont *font, EncMap *map, int res);
2083 extern int FONFontDump(char *filename,SplineFont *sf, int32 *sizes,int res,
2084  EncMap *map);
2087 extern int IsUnsignedBDFKey(char *key);
2088 extern int BdfPropHasInt(BDFFont *font,const char *key, int def );
2089 extern char *BdfPropHasString(BDFFont *font,const char *key, char *def );
2090 extern void def_Charset_Enc(EncMap *map,char *reg,char *enc);
2091 extern void Default_XLFD(BDFFont *bdf,EncMap *map, int res);
2092 extern void Default_Properties(BDFFont *bdf,EncMap *map,char *onlyme);
2093 extern void BDFDefaultProps(BDFFont *bdf, EncMap *map, int res);
2096  char foundry[80];
2097  char family[100];
2098  char weight[80];
2099  char slant[40];
2100  char setwidth[50];
2101  char add_style[50];
2104  int res_x;
2105  int res_y;
2106  char spacing[40];
2108  char cs_reg[80]; /* encoding */
2109  char cs_enc[80]; /* encoding version? */
2111 };
2113  char *name;
2114  int type;
2116 };
2117 extern void XLFD_GetComponents(char *xlfd,struct xlfd_components *comp);
2119 /* Two lines intersect in at most 1 point */
2120 /* Two quadratics intersect in at most 4 points */
2121 /* Two cubics intersect in at most 9 points */ /* Plus an extra space for a trailing -1 */
2122 extern int SplinesIntersect(const Spline *s1, const Spline *s2, BasePoint pts[9],
2123  extended t1s[10], extended t2s[10]);
2126 extern int SplineSetIntersect(SplineSet *spl, Spline **_spline, Spline **_spline2 );
2128  extended tmin, extended tmax);
2129 extern int CubicSolve(const Spline1D *sp,extended ts[3]);
2130 extern extended IterateSplineSolve(const Spline1D *sp, extended tmin, extended tmax, extended sought_y, double err);
2131 extern extended SplineSolve(const Spline1D *sp, real tmin, real tmax, extended sought_y, real err);
2132 extern int SplineSolveFull(const Spline1D *sp,extended val, extended ts[3]);
2133 extern void SplineFindExtrema(const Spline1D *sp, extended *_t1, extended *_t2 );
2134 
2138 
2140 
2141 extern void DumpPfaEditEncodings(void);
2142 extern void ParseEncodingFile(char *filename);
2143 extern void LoadPfaEditEncodings(void);
2144 
2145 extern int GenerateScript(SplineFont *sf,char *filename,char *bitmaptype,
2146  int fmflags,int res, char *subfontdirectory,struct sflist *sfs,
2147  EncMap *map,NameList *rename_to,int layer);
2148 
2149 extern void _SCAutoTrace(SplineChar *sc, int layer, char **args);
2150 extern char **AutoTraceArgs(int ask);
2151 
2152 #define CURVATURE_ERROR -1e9
2153 extern double SplineCurvature(Spline *s, double t);
2154 
2155 #ifndef EXTENDED_IS_LONG_DOUBLE
2156 extern double CheckExtremaForSingleBitErrors(const Spline1D *sp, double t);
2157 #define esqrt(d) sqrt(d)
2158 #else
2159 extern extended esqrt(extended e);
2160 #endif
2161 extern int Spline2DFindExtrema(const Spline *sp, extended extrema[4] );
2162 extern int Spline2DFindPointsOfInflection(const Spline *sp, extended poi[2] );
2163 extern int SplineAtInflection(Spline1D *sp, double t );
2164 extern int SplineAtMinMax(Spline1D *sp, double t );
2165 extern void SplineRemoveExtremaTooClose(Spline1D *sp, extended *_t1, extended *_t2 );
2166 extern int NearSpline(struct findsel *fs, Spline *spline);
2168 extern void SCMakeDependent(SplineChar *dependent,SplineChar *base);
2172  TPoint *mid, int cnt,int order2);
2174  TPoint *mid, int cnt,int order2);
2175 extern double SplineLength(Spline *spline);
2176 extern double SplineLengthRange(Spline *spline, real from_t, real to_t);
2177 extern double PathLength(SplineSet *ss);
2178 extern Spline *PathFindDistance(SplineSet *path,double d,double *_t);
2179 extern SplineSet *SplineSetBindToPath(SplineSet *ss,int doscale, int glyph_as_unit,
2180  int align,real offset, SplineSet *path);
2181 extern int SplineIsLinear(Spline *spline);
2182 extern int SplineIsLinearMake(Spline *spline);
2186 extern void SSOverlapClusterCpAngles(SplineSet *base,double within);
2187 extern void SplinesRemoveBetween(SplineChar *sc, SplinePoint *from, SplinePoint *to,int type);
2189 extern void SPLNearlyHvCps(SplineChar *sc,SplineSet *ss,double err);
2190 extern void SPLNearlyHvLines(SplineChar *sc,SplineSet *ss,double err);
2191 extern int SPLNearlyLines(SplineChar *sc,SplineSet *ss,double err);
2194  struct simplifyinfo *smpl);
2196  struct simplifyinfo *smpl);
2201 extern SplineSet *SplineSetJoin(SplineSet *start,int doall,real fudge,int *changed);
2203 extern Spline *SplineAddExtrema(Spline *s,int always,real lenbound,
2204  real offsetbound,DBounds *b);
2205 extern void SplineSetAddExtrema(SplineChar *sc,SplineSet *ss,enum ae_type between_selected, int emsize);
2206 extern void SplineCharAddExtrema(SplineChar *sc,SplineSet *head,enum ae_type between_selected,int emsize);
2209 extern char *GetNextUntitledName(void);
2210 extern SplineFont *SplineFontEmpty(void);
2212 extern void SFIncrementXUID(SplineFont *sf);
2213 extern void SFRandomChangeXUID(SplineFont *sf);
2214 extern SplineSet *SplineSetReverse(SplineSet *spl);
2219 extern SplineSet *SplineSetsDetectDir(SplineSet **_base, int *lastscan);
2220 extern void SPAverageCps(SplinePoint *sp);
2221 extern void SPLAverageCps(SplinePointList *spl);
2222 extern void SPWeightedAverageCps(SplinePoint *sp);
2225 extern void SplineCharTangentNextCP(SplinePoint *sp);
2226 extern void SplineCharTangentPrevCP(SplinePoint *sp);
2232 extern int KernThreshold(SplineFont *sf, int cnt);
2234 
2236 extern SplineSet *SSttfApprox(SplineSet *ss);
2238 extern SplineSet *SSPSApprox(SplineSet *ss);
2240 extern SplineSet *SplineSetsConvertOrder(SplineSet *ss, int to_order2);
2241 extern void SplineRefigure2(Spline *spline);
2242 extern void SplineRefigureFixup(Spline *spline);
2243 extern Spline *SplineMake2(SplinePoint *from, SplinePoint *to);
2244 extern Spline *SplineMake(SplinePoint *from, SplinePoint *to, int order2);
2246 extern void SCConvertToOrder2(SplineChar *sc);
2247 extern void SFConvertToOrder2(SplineFont *sf);
2250 extern void SFConvertGridToOrder2(SplineFont *_sf);
2251 extern void SCConvertLayerToOrder2(SplineChar *sc,int layer);
2252 extern void SFConvertLayerToOrder2(SplineFont *sf,int layer);
2256 extern void SCConvertOrder(SplineChar *sc, int to_order2);
2259 extern int IntersectLines(BasePoint *inter,
2260  BasePoint *line1_1, BasePoint *line1_2,
2261  BasePoint *line2_1, BasePoint *line2_2);
2262 extern int IntersectLinesClip(BasePoint *inter,
2263  BasePoint *line1_1, BasePoint *line1_2,
2264  BasePoint *line2_1, BasePoint *line2_2);
2265 
2266 #if 0
2267 extern void SSBisectTurners(SplineSet *spl);
2268 #endif
2272 extern SplineSet *SSShadow(SplineSet *spl,real angle, real outline_width,
2273  real shadow_length,SplineChar *sc, int wireframe);
2274 
2275 extern double BlueScaleFigureForced(struct psdict *private,real bluevalues[], real otherblues[]);
2276 extern double BlueScaleFigure(struct psdict *private,real bluevalues[], real otherblues[]);
2277 extern void FindBlues( SplineFont *sf, int layer, real blues[14], real otherblues[10]);
2278 extern void QuickBlues(SplineFont *sf, int layer, BlueData *bd);
2279 extern void FindHStems( SplineFont *sf, real snaps[12], real cnt[12]);
2280 extern void FindVStems( SplineFont *sf, real snaps[12], real cnt[12]);
2281 extern double SFStdVW(SplineFont *sf);
2283 extern void SCGuessHintInstancesList(SplineChar *sc,int layer,StemInfo *hstem,StemInfo *vstem,DStemInfo *dstem,int hvforce,int dforce);
2285 extern void SCGuessHHintInstancesAndAdd(SplineChar *sc, int layer,StemInfo *stem, real guess1, real guess2);
2286 extern void SCGuessVHintInstancesAndAdd(SplineChar *sc, int layer,StemInfo *stem, real guess1, real guess2);
2287 extern void SCGuessHHintInstancesList(SplineChar *sc, int layer);
2288 extern void SCGuessVHintInstancesList(SplineChar *sc, int layer);
2289 extern real HIlen( StemInfo *stems);
2290 extern real HIoverlap( HintInstance *mhi, HintInstance *thi);
2292 extern int StemListAnyConflicts(StemInfo *stems);
2294 extern void MDAdd(SplineChar *sc, int x, SplinePoint *sp1, SplinePoint *sp2);
2295 extern int SFNeedsAutoHint( SplineFont *_sf,int layer);
2296 
2297 typedef struct bluezone {
2299  int cvtindex;
2300  real family_base; /* NaN if none */
2301  int family_cvtindex;
2302  real overshoot; /* relative to baseline, NOT to base */
2303  int highest; /* used in autoinstructing for HStem positioning */
2304  int lowest; /* as above */
2306 
2307 typedef struct stdstem {
2308  real width; /* -1 if none */
2309  int cvtindex;
2310  struct stdstem *snapto;/* NULL means stem isn't snapped to any other */
2311  int stopat; /* at which ppem stop snapping to snapto */
2313 
2314 typedef struct globalinstrct {
2315  SplineFont *sf;
2316  int layer;
2317  BlueData *bd;
2318  double fudge;
2319 
2320  /* Did we initialize the tables needed? 'maxp' is skipped because */
2321  /* its initialization always succeeds. */
2322  int cvt_done;
2323  int fpgm_done;
2324  int prep_done;
2325 
2326  /* PS private data with truetype-specific information added */
2327  BlueZone blues[12]; /* like in BlueData */
2328  int bluecnt;
2329  StdStem stdhw;
2330  StdStem *stemsnaph; /* StdHW excluded */
2331  int stemsnaphcnt;
2332  StdStem stdvw;
2333  StdStem *stemsnapv; /* StdVW excluded */
2334  int stemsnapvcnt;
2336 
2337 extern void InitGlobalInstrCt( GlobalInstrCt *gic,SplineFont *sf,int layer,
2338  BlueData *bd );
2339 extern void FreeGlobalInstrCt( GlobalInstrCt *gic );
2340 extern void NowakowskiSCAutoInstr( GlobalInstrCt *gic,SplineChar *sc );
2342 
2345 extern void SCClearHintMasks(SplineChar *sc,int layer,int counterstoo);
2348 extern void SCFigureHintMasks(SplineChar *sc,int layer);
2349 extern void _SplineCharAutoHint( SplineChar *sc, int layer, BlueData *bd, struct glyphdata *gd2, int gen_undoes );
2350 extern void SplineCharAutoHint( SplineChar *sc,int layer, BlueData *bd);
2351 extern void SFSCAutoHint( SplineChar *sc,int layer,BlueData *bd);
2352 extern void SplineFontAutoHint( SplineFont *sf, int layer);
2353 extern void SplineFontAutoHintRefs( SplineFont *sf, int layer);
2354 extern StemInfo *HintCleanup(StemInfo *stem,int dosort,int instance_count);
2355 extern int SplineFontIsFlexible(SplineFont *sf,int layer, int flags);
2356 extern int SCDrawsSomething(SplineChar *sc);
2357 #define SCWorthOutputting(a) 1
2358 extern int SFFindNotdef(SplineFont *sf, int fixed);
2360 extern int IsntBDFChar(BDFChar *bdfc);
2361 extern int CIDWorthOutputting(SplineFont *cidmaster, int enc); /* Returns -1 on failure, font number on success */
2362 extern int AmfmSplineFont(FILE *afm, MMSet *mm,int formattype,EncMap *map,int layer);
2363 extern int AfmSplineFont(FILE *afm, SplineFont *sf,int formattype,EncMap *map, int docc, SplineFont *fullsf,int layer);
2364 extern int PfmSplineFont(FILE *pfm, SplineFont *sf,int type0,EncMap *map,int layer);
2365 extern int TfmSplineFont(FILE *afm, SplineFont *sf,int formattype,EncMap *map,int layer);
2366 extern int OfmSplineFont(FILE *afm, SplineFont *sf,int formattype,EncMap *map,int layer);
2367 extern char *EncodingName(Encoding *map);
2369 extern void SFLigaturePrepare(SplineFont *sf);
2370 extern void SFLigatureCleanup(SplineFont *sf);
2371 extern void SFKernClassTempDecompose(SplineFont *sf,int isv);
2372 extern void SFKernCleanup(SplineFont *sf,int isv);
2373 extern int SCSetMetaData(SplineChar *sc,char *name,int unienc,
2374  const char *comment);
2375 
2377 extern const char *EncName(Encoding *encname);
2378 extern const char*FindUnicharName(void);
2379 extern Encoding *_FindOrMakeEncoding(const char *name,int make_it);
2380 extern Encoding *FindOrMakeEncoding(const char *name);
2381 extern int SFDWrite(char *filename,SplineFont *sf,EncMap *map,EncMap *normal, int todir);
2383 extern SplineFont *SFDRead(char *filename);
2384 extern SplineFont *_SFDRead(char *filename,FILE *sfd);
2387 extern char *TTFGetFontName(FILE *ttf,int32 offset,int32 off2);
2388 extern char *TTFGetPSFontName(FILE *ttf,int32 offset,int32 off2);
2389 extern void TTFLoadBitmaps(FILE *ttf,struct ttfinfo *info, int onlyone);
2391 extern SplineFont *_SFReadTTF(FILE *ttf,int flags,enum openflags openflags,
2392  char *filename,struct fontdict *fd);
2393 extern SplineFont *SFReadTTF(char *filename,int flags,enum openflags openflags);
2394 extern SplineFont *SFReadSVG(char *filename,int flags);
2395 extern SplineFont *SFReadUFO(char *filename,int flags);
2396 extern SplineFont *_CFFParse(FILE *temp,int len,char *fontsetname);
2397 extern SplineFont *CFFParse(char *filename);
2399 extern SplineFont *SFReadWinFON(char *filename,int toback);
2400 extern SplineFont *SFReadPalmPdb(char *filename,int toback);
2403 extern SplineFont *ReadSplineFont(char *filename,enum openflags); /* Don't use this, use LoadSF instead */
2404 extern FILE *URLToTempFile(char *url,void *lock);
2405 extern int URLFromFile(char *url,FILE *from);
2406 extern int HttpGetBuf(char *url, char *databuf, int *datalen, void *mutex);
2407 extern void ArchiveCleanup(char *archivedir);
2408 extern char *Unarchive(char *name, char **_archivedir);
2409 extern char *Decompress(char *name, int compression);
2410 extern SplineFont *SFFromBDF(char *filename,int ispk,int toback);
2411 extern SplineFont *SFFromMF(char *filename);
2413 extern uint16 _MacStyleCode( char *styles, SplineFont *sf, uint16 *psstyle );
2414 extern uint16 MacStyleCode( SplineFont *sf, uint16 *psstyle );
2416 extern SplineFont *_SFReadPdfFont(FILE *ttf,char *filename,char *select_this_font, enum openflags openflags);
2418 extern char **GetFontNames(char *filename);
2419 extern char **NamesReadSFD(char *filename);
2420 extern char **NamesReadTTF(char *filename);
2421 extern char **NamesReadCFF(char *filename);
2422 extern char **NamesReadPostscript(char *filename);
2423 extern char **_NamesReadPostscript(FILE *ps);
2424 extern char **NamesReadSVG(char *filename);
2425 extern char **NamesReadUFO(char *filename);
2426 extern char **NamesReadMacBinary(char *filename);
2427 
2428 extern void SFSetOrder(SplineFont *sf,int order2);
2430 
2431 extern const char *UnicodeRange(int unienc);
2433 extern SplineChar *SFMakeChar(SplineFont *sf,EncMap *map,int i);
2434 extern char *AdobeLigatureFormat(char *name);
2435 extern uint32 LigTagFromUnicode(int uni);
2436 extern void SCLigCaretheck(SplineChar *sc,int clean);
2437 extern BDFChar *BDFMakeGID(BDFFont *bdf,int gid);
2439 
2441 extern int SCWasEmpty(SplineChar *sc, int skip_this_layer);
2444 extern Undoes *SCPreserveLayer(SplineChar *sc,int layer,int dohints);
2445 extern Undoes *SCPreserveState(SplineChar *sc,int dohints);
2451 extern void BCDoRedo(BDFChar *bc);
2452 extern void BCDoUndo(BDFChar *bc);
2453 
2454 extern int isaccent(int uni);
2455 extern int SFIsCompositBuildable(SplineFont *sf,int unicodeenc,SplineChar *sc, int layer);
2456 extern int SFIsSomethingBuildable(SplineFont *sf,SplineChar *sc, int layer,int onlyaccents);
2458 extern int SCMakeDotless(SplineFont *sf, SplineChar *dotless, int layer, int copybmp, int doit);
2459 extern void SCBuildComposit(SplineFont *sf, SplineChar *sc, int layer, int copybmp);
2460 extern int SCAppendAccent(SplineChar *sc,int layer, char *glyph_name,int uni,int pos);
2461 extern const unichar_t *SFGetAlternate(SplineFont *sf, int base,SplineChar *sc,int nocheck);
2462 
2463 extern int getAdobeEnc(char *name);
2464 
2465 extern void SFSplinesFromLayers(SplineFont *sf,int tostroke);
2466 extern void SFSetLayerWidthsStroked(SplineFont *sf, real strokewidth);
2467 extern SplineSet *SplinePointListInterpretSVG(char *filename,char *memory, int memlen, int em_size, int ascent,int stroked);
2468 extern SplineSet *SplinePointListInterpretGlif(char *filename,char *memory, int memlen, int em_size, int ascent,int stroked);
2469 #define UNDEFINED_WIDTH -999999
2471 extern void PSFontInterpretPS(FILE *ps,struct charprocs *cp,char **encoding);
2472 extern struct enc *PSSlurpEncodings(FILE *file);
2473 extern int EvaluatePS(char *str,real *stack,int size);
2474 struct pscontext {
2480 };
2481 extern int UnblendedCompare(real u1[MmMax], real u2[MmMax], int cnt);
2482 extern SplineChar *PSCharStringToSplines(uint8 *type1, int len, struct pscontext *context,
2483  struct pschars *subrs, struct pschars *gsubrs, const char *name);
2484 extern SplineChar *PSCharStringToBB(uint8 *type1, int len, struct pscontext *context,
2485  struct pschars *subrs, struct pschars *gsubrs, const char *name);
2486 extern void MatMultiply(real m1[6], real m2[6], real to[6]);
2487 
2488 extern int NameToEncoding(SplineFont *sf,EncMap *map,const char *uname);
2489 extern void GlyphHashFree(SplineFont *sf);
2490 extern void SFHashGlyph(SplineFont *sf,SplineChar *sc);
2491 extern SplineChar *SFHashName(SplineFont *sf,const char *name);
2492 extern int SFFindGID(SplineFont *sf, int unienc, const char *name );
2493 extern int SFFindSlot(SplineFont *sf, EncMap *map, int unienc, const char *name );
2494 extern int SFCIDFindCID(SplineFont *sf, int unienc, const char *name );
2495 extern SplineChar *SFGetChar(SplineFont *sf, int unienc, const char *name );
2496 extern int SFHasChar(SplineFont *sf, int unienc, const char *name );
2497 extern SplineChar *SFGetOrMakeChar(SplineFont *sf, int unienc, const char *name );
2498 extern int SFFindExistingSlot(SplineFont *sf, int unienc, const char *name );
2499 extern int SFCIDFindExistingChar(SplineFont *sf, int unienc, const char *name );
2500 extern int SFHasCID(SplineFont *sf, int cid);
2501 
2502 extern char *getPfaEditDir(char *buffer);
2503 extern void _DoAutoSaves(struct fontviewbase *);
2504 extern void CleanAutoRecovery(void);
2505 extern int DoAutoRecovery(int);
2506 extern SplineFont *SFRecoverFile(char *autosavename,int inquire, int *state);
2509 
2510 extern void PSCharsFree(struct pschars *chrs);
2511 extern void PSDictFree(struct psdict *chrs);
2512 extern struct psdict *PSDictCopy(struct psdict *dict);
2513 extern int PSDictFindEntry(struct psdict *dict, char *key);
2514 extern char *PSDictHasEntry(struct psdict *dict, char *key);
2515 extern int PSDictRemoveEntry(struct psdict *dict, char *key);
2516 extern int PSDictChangeEntry(struct psdict *dict, char *key, char *newval);
2517 extern int SFPrivateGuess(SplineFont *sf,int layer, struct psdict *private,
2518  char *name, int onlyone);
2519 
2520 extern void SFRemoveLayer(SplineFont *sf,int l);
2521 extern void SFAddLayer(SplineFont *sf,char *name,int order2, int background);
2522 extern void SFLayerSetBackground(SplineFont *sf,int layer,int is_back);
2523 
2524 extern void SplineSetsRound2Int(SplineSet *spl,real factor,int inspiro,int onlysel);
2526 extern int SCRoundToCluster(SplineChar *sc,int layer,int sel,double within,double max);
2527 extern int SplineSetsRemoveAnnoyingExtrema(SplineSet *ss,double err);
2529 #if 0
2530 extern void SFFigureGrid(SplineFont *sf);
2531 #endif
2532 
2533 struct cidmap; /* private structure to encoding.c */
2534 extern int CIDFromName(char *name,SplineFont *cidmaster);
2535 extern int CID2Uni(struct cidmap *map,int cid);
2536 extern int CID2NameUni(struct cidmap *map,int cid, char *buffer, int len);
2537 extern int NameUni2CID(struct cidmap *map,int uni, const char *name);
2538 extern int MaxCID(struct cidmap *map);
2539 extern struct cidmap *FindCidMap(char *registry,char *ordering,int supplement,
2540  SplineFont *sf);
2541 extern void SFEncodeToMap(SplineFont *sf,struct cidmap *map);
2543 extern void SFFlatten(SplineFont *cidmaster);
2544 extern int SFFlattenByCMap(SplineFont *sf,char *cmapname);
2545 extern SplineFont *MakeCIDMaster(SplineFont *sf,EncMap *oldmap,int bycmap,char *cmapfilename,struct cidmap *cidmap);
2546 
2547 int getushort(FILE *ttf);
2548 int32 getlong(FILE *ttf);
2549 int get3byte(FILE *ttf);
2550 real getfixed(FILE *ttf);
2551 real get2dot14(FILE *ttf);
2552 void putshort(FILE *file,int sval);
2553 void putlong(FILE *file,int val);
2554 void putfixed(FILE *file,real dval);
2555 int ttfcopyfile(FILE *ttf, FILE *other, int pos, char *table_name);
2556 
2557 extern void SCCopyLayerToLayer(SplineChar *sc, int from, int to,int doclear);
2558 
2559 extern int hasFreeType(void);
2560 extern int hasFreeTypeDebugger(void);
2561 extern int hasFreeTypeByteCode(void);
2562 extern int FreeTypeAtLeast(int major, int minor, int patch);
2563 extern void doneFreeType(void);
2565  int layer, enum fontformat ff,int flags,void *shared_ftc);
2567 extern BDFFont *SplineFontFreeTypeRasterize(void *freetypecontext,int pixelsize,int depth);
2568 extern BDFChar *SplineCharFreeTypeRasterize(void *freetypecontext,int gid,
2569  int pixelsize,int depth);
2570 extern void FreeTypeFreeContext(void *freetypecontext);
2571 extern SplineSet *FreeType_GridFitChar(void *single_glyph_context,
2572  int enc, real ptsizey, real ptsizex, int dpi, uint16 *width, SplineChar *sc, int depth);
2573 extern struct freetype_raster *FreeType_GetRaster(void *single_glyph_context,
2574  int enc, real ptsizey, real ptsizex, int dpi,int depth);
2576  int pixelsize,int depth);
2578  int pixelsize,int depth);
2580 struct TT_ExecContextRec_;
2582 
2583 extern int UniFromName(const char *name,enum uni_interp interp, Encoding *encname);
2584 extern const char *StdGlyphName(char *buffer, int uni, enum uni_interp interp, NameList *for_this_font);
2585 extern char **AllGlyphNames(int uni, NameList *for_this_font,SplineChar *sc/* May be NULL*/);
2586 extern char **AllNamelistNames(void);
2587 extern NameList *DefaultNameListForNewFonts(void);
2588 extern NameList *NameListByName(char *name);
2589 extern NameList *LoadNamelist(char *filename);
2590 extern void LoadNamelistDir(char *dir);
2591 extern const char *RenameGlyphToNamelist(char *buffer, SplineChar *sc,NameList *old,NameList *new);
2592 extern void SFRenameGlyphsToNamelist(SplineFont *sf,NameList *new);
2594 extern void SFTemporaryRestoreGlyphNames(SplineFont *sf,char **former);
2595 
2596 extern void doversion(const char *);
2597 
2599 extern void AnchorPosFree(AnchorPos *apos);
2600 
2602 extern int SSTtfNumberPoints(SplineSet *ss);
2603 extern int SCNumberPoints(SplineChar *sc,int layer);
2604 extern int SCPointsNumberedProperly(SplineChar *sc,int layer);
2605 extern int ttfFindPointInSC(SplineChar *sc,int layer,int pnum,BasePoint *pos,
2606  RefChar *bound);
2607 
2608 int SFFigureDefWidth(SplineFont *sf, int *_nomwid);
2609 
2611  uint32 totag, int tosli, int toflags, int ismac);
2613 
2614 extern char *utf8_verify_copy(const char *str);
2615 
2616 extern char *MacStrToUtf8(const char *str,int macenc,int maclang);
2617 extern char *Utf8ToMacStr(const char *ustr,int macenc,int maclang);
2618 extern uint8 MacEncFromMacLang(int maclang);
2619 extern uint16 WinLangFromMac(int maclang);
2620 extern uint16 WinLangToMac(int winlang);
2621 extern int CanEncodingWinLangAsMac(int winlang);
2622 extern const int32 *MacEncToUnicode(int script,int lang);
2623 extern int MacLangFromLocale(void);
2624 extern char *MacLanguageFromCode(int code);
2625 
2626 extern int32 UniFromEnc(int enc, Encoding *encname);
2627 extern int32 EncFromUni(int32 uni, Encoding *encname);
2628 extern int32 EncFromName(const char *name,enum uni_interp interp,Encoding *encname);
2629 
2630 extern void MatInverse(real into[6], real orig[6]);
2631 
2633 
2636 
2637 extern char *MMAxisAbrev(char *axis_name);
2638 extern char *MMMakeMasterFontname(MMSet *mm,int ipos,char **fullname);
2639 extern char *MMGuessWeight(MMSet *mm,int ipos,char *def);
2640 extern char *MMExtractNth(char *pt,int ipos);
2641 extern char *MMExtractArrayNth(char *pt,int ipos);
2642 extern int MMValid(MMSet *mm,int complain);
2644  struct lookup_subtable *sub,KernPair *oldkp);
2645 extern char *MMBlendChar(MMSet *mm, int gid);
2646 
2647 extern char *EnforcePostScriptName(char *old);
2648 
2649 extern char *ToAbsolute(char *filename);
2650 
2658  SS_NoMatch = 128,
2667 
2671  BC_NoMatch = 8<<16,
2672  BC_Match = 16<<16,
2673 
2674  SS_RefPtMismatch = 32<<16
2675  };
2676 
2677 extern enum Compare_Ret BitmapCompare(BDFChar *bc1, BDFChar *bc2, int err, int bb_err);
2678 extern enum Compare_Ret SSsCompare(const SplineSet *ss1, const SplineSet *ss2,
2679  real pt_err, real spline_err, SplinePoint **hmfail);
2683  fcf_bitmaps=0x80, fcf_names = 0x100, fcf_gpos=0x200, fcf_gsub=0x400,
2685 extern int CompareFonts(SplineFont *sf1, EncMap *map1, SplineFont *sf2,
2686  FILE *diffs, int flags);
2687 extern int LayersSimilar(Layer *ly1, Layer *ly2, double spline_err);
2688 
2689 
2690 # if HANYANG
2691 extern void SFDDumpCompositionRules(FILE *sfd,struct compositionrules *rules);
2692 extern struct compositionrules *SFDReadCompositionRules(FILE *sfd);
2693 extern void SFModifyComposition(SplineFont *sf);
2694 extern void SFBuildSyllables(SplineFont *sf);
2695 # endif
2696 
2697 extern void DefaultOtherSubrs(void);
2698 extern int ReadOtherSubrsFile(char *filename);
2699 
2700 extern char *utf8toutf7_copy(const char *_str);
2701 extern char *utf7toutf8_copy(const char *_str);
2702 
2704 extern void SFTimesFromFile(SplineFont *sf,FILE *);
2705 
2706 extern int SFHasInstructions(SplineFont *sf);
2707 extern int RefDepth(RefChar *ref,int layer);
2708 
2710 
2711 extern char *TagFullName(SplineFont *sf,uint32 tag, int onlyifknown);
2712 
2713