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 _BASEVIEWS_H
28 #define _BASEVIEWS_H
29 
30 /* cross-compiler woes */
31 #if defined (small)
32 #undef small
33 #endif
34 
35 #include "splinefont.h"
36 
37 enum widthtype { wt_width, wt_lbearing, wt_rbearing, wt_vwidth };
38 
39 enum fvtrans_flags { fvt_dobackground=1, fvt_round_to_int=2,
40 	fvt_dontsetwidth=4, fvt_dontmovewidth=8, fvt_scalekernclasses=0x10,
41 	fvt_scalepstpos=0x20, fvt_dogrid=0x40, fvt_partialreftrans=0x80 };
42 
43 typedef struct drect {
44     real x, y;
45     real width, height;
46 } DRect;
47 
48 /* Note: These are ordered as they are displayed in the tools palette */
49 enum cvtools { cvt_pointer, cvt_magnify,
50 	cvt_freehand, cvt_hand,
51 	cvt_curve, cvt_hvcurve,
52 	cvt_corner, cvt_tangent,
53 	cvt_pen, cvt_spiro,
54 	cvt_knife, cvt_ruler,
55 	cvt_scale, cvt_flip,
56 	cvt_rotate, cvt_skew,
57 	cvt_3d_rotate, cvt_perspective,
58 	cvt_rect, cvt_poly,
59 	cvt_elipse, cvt_star,
60 	cvt_minify, cvt_max=cvt_minify,
61 	cvt_none = -1,
62 	cvt_spirog4=cvt_curve, cvt_spirog2=cvt_hvcurve,
63 	cvt_spirocorner=cvt_corner, cvt_spiroleft=cvt_tangent,
64 	cvt_spiroright=cvt_pen};
65 
66 enum bvtools { bvt_pointer, bvt_magnify,
67 	bvt_pencil, bvt_line,
68 	bvt_shift, bvt_hand,
69 	bvt_minify, bvt_eyedropper, bvt_max=bvt_eyedropper,
70 	bvt_setwidth, bvt_setvwidth,
71 	bvt_rect, bvt_filledrect,
72 	bvt_elipse, bvt_filledelipse,
73 	bvt_max2 = bvt_filledelipse,
74 	bvt_none = -1,
75 	bvt_fliph=0, bvt_flipv, bvt_rotate90cw, bvt_rotate90ccw, bvt_rotate180, bvt_skew, bvt_transmove };
76 enum drawmode { dm_grid, dm_back, dm_fore, dm_max };
77 
78 typedef struct bvtfunc {
79     enum bvtools func;
80     int x,y;		/* used by skew and move */
81 } BVTFunc;
82 
83 struct freetype_raster {
84     int16 rows, cols;
85     int16 as, lb;
86     int16 bytes_per_row;
87     int16 num_greys;
88     uint8 *bitmap;
89 };
90 
91 struct cvcontainer {
92     struct cvcontainer_funcs *funcs;
93 };
94 
95 enum nav_type { nt_prevdef, nt_prev, nt_goto, nt_next, nt_nextdef };
96 struct cvcontainer_funcs {
97     enum cv_container_type { cvc_searcher, cvc_mathkern, cvc_tilepath,
98 	cvc_gradient, cvc_multiplepattern } type;
99     void (*activateMe)(struct cvcontainer *cvc,struct charviewbase *cv);
100     void (*charEvent)(struct cvcontainer *cvc,void *event);
101     int (*canNavigate)(struct cvcontainer *cvc,enum nav_type type);
102     void (*doNavigate)(struct cvcontainer *cvc,enum nav_type type);
103     int (*canOpen)(struct cvcontainer *cvc);
104     void (*doClose)(struct cvcontainer *cvc);
105     SplineFont *(*sf_of_container)(struct cvcontainer *cvc);
106 };
107 
108 typedef struct charviewbase {
109     struct charviewbase *next;
110     struct fontviewbase *fv;
111     SplineChar *sc;
112     Layer *layerheads[dm_max];
113     uint8 drawmode;
114     uint16 ft_gridfitwidth;
115     SplineSet *gridfit;
116     struct cvcontainer *container;		/* The sv (or whatever) within which this view is embedded (if it is embedded) */
117 } CharViewBase;
118 
119 typedef struct fontviewbase {
120     struct fontviewbase *next;		/* Next on list of open fontviews */
121     struct fontviewbase *nextsame;	/* Next fv looking at this font */
122     EncMap *map;			/* Current encoding info */
123     EncMap *normal;			/* If this is not NULL then we have a compacted encoding in map, and this is the original */
124     SplineFont *sf;			/* Current font */
125     SplineFont *cidmaster;		/* If CID keyed, contains master font */
126     int active_layer;
127     BDFFont *active_bitmap;		/* Set if the fontview displays a bitmap strike */
128     uint8 *selected;			/* Current selection */
129 #ifndef _NO_FFSCRIPT
130     struct dictionary *fontvars;	/* Scripting */
131 #endif
132 #ifndef _NO_PYTHON
133     void *python_fv_object;
134 #endif
135 } FontViewBase;
136 
137 enum origins { or_zero, or_center, or_lastpress, or_value, or_undefined };
138 struct pov_data {
139     enum origins xorigin, yorigin;
140     double x, y, z;
141     double direction;		/* Direction of gaze projected into xy plane */
142     double tilt;		/* Angle which drawing plane is tilted with respect to projection plane */
143     double d;			/* Distance to projection plane */
144     double sintilt;		/* Used internally */
145 };
146 
147 typedef struct {
148     SplineFont *sf;
149     char *pathspec;			/* In utf8, not necessarily local encoding */
150     char *username, *password;
151     char *name;
152     char *description;
153     char *tags;
154     char *artists;
155     int notsafeforwork;
156     int oflicense;
157     char *previewimage;			/* NULL => No image */
158     uint8 upload_license;
159     uint8 upload_fontlog;
160     char *upload_id;			/* Way to manipulate upload on OFLib */
161 } OFLibData;
162 
163 struct lcg_zones {
164     /* info for unhinted processing */
165      /* everything abvoe this should be moved down (default xheight/2) */
166     int top_zone;
167      /* everything below this should be moved up (default xheight/2) */
168      /* anything in between should be stationary */
169     int bottom_zone;
170 
171     /* info for hinted processing */
172      /* everything above & at this should be moved down */
173      /* also anything on the other side of a hint from this should be moved down */
174     int top_bound;
175      /* everything below & at this should be moved down */
176      /* also anything on the other side of a hint from this should be moved down */
177     int bottom_bound;
178 
179     enum counter_type { ct_squish, ct_retain, ct_auto } counter_type;
180 
181     SplineSet *(*embolden_hook)(SplineSet *,struct lcg_zones *,SplineChar *,int layer);
182     int wants_hints;
183     double serif_height, serif_fuzz;
184 
185     double stroke_width;	/* negative number to lighten, positive to embolden */
186     int removeoverlap;
187 
188     BlueData bd;
189     double stdvw;
190 };
191 /* This order is the same order as the radio buttons in the embolden dlg */
192 enum embolden_type { embolden_lcg, embolden_cjk, embolden_auto, embolden_custom, embolden_error };
193 
194 struct counterinfo {
195     double c_factor, c_add;		/* For counters */
196     double sb_factor, sb_add;		/* For side bearings */
197     int correct_italic;
198 
199     BlueData bd;
200     double stdvw;
201 
202     SplineChar *sc;
203     int layer;
204     DBounds bb;				/* Value before change */
205     double top_y, bottom_y, boundry;
206     int has_two_zones;
207 #define TOP_Z	0
208 #define BOT_Z	1
209     int cnts[2];
210     int maxes[2];
211     struct ci_zones {
212 	double start, width;
213 	double moveto, newwidth;	/* Only change width for diagonal stems*/
214     } *zones[2];
215 };
216 
217 enum fvformats { fv_bdf, fv_ttf, fv_pk, fv_pcf, fv_mac, fv_win, fv_palm,
218 	fv_image, fv_imgtemplate,
219 	fv_eps, fv_epstemplate,
220 	fv_pdf, fv_pdftemplate,
221 	fv_plate, fv_platetemplate,
222 	fv_svg, fv_svgtemplate,
223 	fv_glif, fv_gliftemplate,
224 	fv_fig,
225 	fv_pythonbase = 0x100 };
226 
227 extern enum undotype CopyUndoType(void);
228 extern int CopyContainsSomething(void);
229 extern int CopyContainsBitmap(void);
230 extern const Undoes *CopyBufferGet(void);
231 extern RefChar *CopyContainsRef(SplineFont *);
232 extern char **CopyGetPosSubData(enum possub_type *type,SplineFont **copied_from,
233 	int pst_depth);
234 extern void CopyReference(SplineChar *sc);
235 extern void SCCopyLookupData(SplineChar *sc);
236 extern void PasteRemoveSFAnchors(SplineFont *);
237 extern void PasteAnchorClassMerge(SplineFont *sf,AnchorClass *into,AnchorClass *from);
238 extern void PasteRemoveAnchorClass(SplineFont *sf,AnchorClass *dying);
239 extern void ClipboardClear(void);
240 extern SplineSet *ClipBoardToSplineSet(void);
241 extern void BCCopySelected(BDFChar *bc,int pixelsize,int depth);
242 extern void PasteToBC(BDFChar *bc,int pixelsize,int depth);
243 extern void FVCopyWidth(FontViewBase *fv,enum undotype ut);
244 extern void FVCopyAnchors(FontViewBase *fv);
245 enum fvcopy_type { ct_fullcopy, ct_reference, ct_lookups, ct_unlinkrefs };
246 extern void FVCopy(FontViewBase *fv, enum fvcopy_type copytype);
247 extern void PasteIntoFV(FontViewBase *fv, int pasteinto, real trans[6]);
248 extern void FVCopyFgtoBg(FontViewBase *fv);
249 extern void FVSameGlyphAs(FontViewBase *fv);
250 extern void FVClearBackground(FontViewBase *fv);
251 extern void FVClear(FontViewBase *fv);
252 extern void FVUnlinkRef(FontViewBase *fv);
253 extern void FVUndo(FontViewBase *fv);
254 extern void FVRedo(FontViewBase *fv);
255 extern void FVJoin(FontViewBase *fv);
256 extern void FVBuildDuplicate(FontViewBase *fv);
257 extern void FVTrans(FontViewBase *fv,SplineChar *sc,real transform[6],uint8 *sel,
258 	enum fvtrans_flags);
259 extern void FVTransFunc(void *_fv,real transform[6],int otype, BVTFunc *bvts,
260 	enum fvtrans_flags );
261 extern void FVReencode(FontViewBase *fv,Encoding *enc);
262 extern void FVOverlap(FontViewBase *fv,enum overlap_type ot);
263 extern void FVAddExtrema(FontViewBase *fv);
264 extern void FVCorrectDir(FontViewBase *fv);
265 extern void FVRound2Int(FontViewBase *fv,real factor);
266 extern void FVCanonicalStart(FontViewBase *fv);
267 extern void FVCanonicalContours(FontViewBase *fv);
268 extern void FVCluster(FontViewBase *fv);
269 extern void CIDSetEncMap(FontViewBase *fv, SplineFont *new );
270 extern void FVInsertInCID(FontViewBase *fv,SplineFont *sf);
271 
272 extern void FVAutoHint(FontViewBase *fv);
273 extern void FVAutoHintSubs(FontViewBase *fv);
274 extern void FVAutoCounter(FontViewBase *fv);
275 extern void FVDontAutoHint(FontViewBase *fv);
276 extern void FVAutoInstr(FontViewBase *fv);
277 extern void FVClearInstrs(FontViewBase *fv);
278 extern void FVClearHints(FontViewBase *fv);
279 extern void SCAutoTrace(SplineChar *sc,int layer, int ask);
280 extern char *FindAutoTraceName(void);
281 extern void *GetAutoTraceArgs(void);
282 extern void SetAutoTraceArgs(void *a);
283 extern char *FindMFName(void);
284 extern char *ProgramExists(char *prog,char *buffer);
285 extern void MfArgsInit(void);
286 extern void FVAutoTrace(FontViewBase *fv,int ask);
287 extern void FVAddEncodingSlot(FontViewBase *fv,int gid);
288 extern int FVImportMult(FontViewBase *fv, char *filename,int toback,int bf);
289 extern int FVImportBDF(FontViewBase *fv, char *filename,int ispk, int toback);
290 extern void MergeFont(FontViewBase *fv,SplineFont *other,int preserveCrossFontKerning);
291 extern int FVImportImages(FontViewBase *fv,char *path,int isimage,int toback,int flags);
292 extern int FVImportImageTemplate(FontViewBase *fv,char *path,int isimage,int toback,int flags);
293 extern void ScriptPrint(FontViewBase *fv,int type,int32 *pointsizes,char *samplefile,
294 	unichar_t *sample, char *outputfile);
295 extern int FVBParseSelectByPST(FontViewBase *fv,struct lookup_subtable *sub,
296 	int search_type);
297 extern int SFScaleToEm(SplineFont *sf, int ascent, int descent);
298 extern void TransHints(StemInfo *stem,real mul1, real off1, real mul2, real off2, int round_to_int );
299 extern void TransDStemHints(DStemInfo *ds,real xmul, real xoff, real ymul, real yoff, int round_to_int );
300 extern void VrTrans(struct vr *vr,real transform[6]);
301 extern int SFNLTrans(FontViewBase *fv,char *x_expr,char *y_expr);
302 extern void FVPointOfView(FontViewBase *fv,struct pov_data *);
303 extern void FVStrokeItScript(void *fv, StrokeInfo *si);
304 extern void FVOutline(struct fontviewbase *fv, real width);
305 extern void FVInline(struct fontviewbase *fv, real width, real inset);
306 extern void FVShadow(struct fontviewbase *fv,real angle, real outline_width,
307 	real shadow_length,int wireframe);
308 extern void CI_Init(struct counterinfo *ci,SplineFont *sf);
309 extern void FVEmbolden(struct fontviewbase *fv,enum embolden_type type,struct lcg_zones *zones);
310 extern void FVCondenseExtend(struct fontviewbase *fv,struct counterinfo *ci);
311 extern void ScriptSCCondenseExtend(SplineChar *sc,struct counterinfo *ci);
312 
313 struct smallcaps {
314     double lc_stem_width, uc_stem_width;
315     double stem_factor, v_stem_factor;
316     double xheight, scheight, capheight;
317     double vscale, hscale;
318     char *extension_for_letters, *extension_for_symbols;
319     int dosymbols;
320     SplineFont *sf;
321     int layer;
322     double italic_angle, tan_ia;
323 };
324 
325 extern void SmallCapsFindConstants(struct smallcaps *small, SplineFont *sf,
326 	int layer );
327 
328 enum glyphchange_type { gc_generic, gc_smallcaps, gc_subsuper, gc_max };
329 
330 struct genericchange {
331     enum glyphchange_type gc;
332     uint32 feature_tag;
333     char *glyph_extension;
334     char *extension_for_letters, *extension_for_symbols;
335     double stem_height_scale, stem_width_scale;
336     double stem_height_add  , stem_width_add  ;
337     double serif_height_scale, serif_width_scale;
338     double seirf_height_add  , serif_width_add  ;
339     double hcounter_scale, hcounter_add;
340     double lsb_scale, lsb_add;
341     double rsb_scale, rsb_add;
342     uint8 center_in_hor_advance;
343     uint8 use_vert_mapping;
344     uint8 do_smallcap_symbols;
345     uint8 petite;				/* generate petite caps rather than smallcaps */
346     double vcounter_scale, vcounter_add;	/* If not using mapping */
347     double v_scale;				/* If using mapping */
348     struct fixed_maps {
349 	int cnt;
350 	struct position_maps {
351 	    double current  , desired;
352             double cur_width, des_width;
353 	    int overlap_index;
354 	} *maps;
355     } m;
356     struct fixed_maps g;			/* Adjusted for each glyph */
357     double vertical_offset;
358     unsigned int dstem_control, serif_control;
359     struct smallcaps *small;
360 /* Filled in by called routine */
361     SplineFont *sf;
362     int layer;
363     double italic_angle, tan_ia;
364 };
365 
366 extern void FVAddSmallCaps(FontViewBase *fv,struct genericchange *genchange);
367 extern void FVGenericChange(FontViewBase *fv,struct genericchange *genchange);
368 extern void CVGenericChange(CharViewBase *cv,struct genericchange *genchange);
369 
370 struct xheightinfo {
371     double xheight_current, xheight_desired;
372     double serif_height;
373 };
374 
375 extern void InitXHeightInfo(SplineFont *sf, int layer, struct xheightinfo *xi);
376 extern void ChangeXHeight(FontViewBase *fv,CharViewBase *cv, struct xheightinfo *xi);
377 extern SplineSet *SSControlStems(SplineSet *ss,
378 	double stemwidthscale, double stemheightscale,
379 	double hscale, double vscale, double xheight);
380 extern void MakeItalic(FontViewBase *fv,CharViewBase *cv,ItalicInfo *ii);
381 extern int FVReplaceAll( FontViewBase *fv, SplineSet *find, SplineSet *rpl, double fudge, int flags );
382 extern void FVBReplaceOutlineWithReference( FontViewBase *fv, double fudge );
383 extern void FVCorrectReferences(FontViewBase *fv);
384 extern void _FVSimplify(FontViewBase *fv,struct simplifyinfo *smpl);
385 extern void UnlinkThisReference(FontViewBase *fv,SplineChar *sc,int layer);
386 extern FontViewBase *ViewPostscriptFont(char *filename,int openflags);
387 extern void FVBuildAccent(FontViewBase *fv,int onlyaccents);
388 extern void FVRemoveKerns(FontViewBase *fv);
389 extern void FVRemoveVKerns(FontViewBase *fv);
390 extern void FVVKernFromHKern(FontViewBase *fv);
391 extern void FVAddUnencoded(FontViewBase *fv, int cnt);
392 extern void FVRemoveUnused(FontViewBase *fv);
393 extern void FVCompact(FontViewBase *fv);
394 extern void FVDetachGlyphs(FontViewBase *fv);
395 extern void FVDetachAndRemoveGlyphs(FontViewBase *fv);
396 extern int AutoWidthScript(FontViewBase *fv,int spacing);
397 extern int AutoKernScript(FontViewBase *fv,int spacing, int threshold,
398 	struct lookup_subtable *sub, char *kernfile);
399 
400 #ifndef _NO_FFSCRIPT
401 extern void DictionaryFree(struct dictionary *dica);
402 #endif
403 
404 extern void BCTrans(BDFFont *bdf,BDFChar *bc,BVTFunc *bvts,FontViewBase *fv );
405 extern void BCSetPoint(BDFChar *bc, int x, int y, int color);
406 extern void BCTransFunc(BDFChar *bc,enum bvtools type,int xoff,int yoff);
407 extern void skewselect(BVTFunc *bvtf,real t);
408 extern void BCExpandBitmapToEmBox(BDFChar *bc, int xmin, int ymin, int xmax, int ymax);
409 
410 extern BDFFloat *BDFFloatCreate(BDFChar *bc,int xmin,int xmax,int ymin,int ymax, int clear);
411 extern BDFFloat *BDFFloatCopy(BDFFloat *sel);
412 extern BDFFloat *BDFFloatConvert(BDFFloat *sel,int newdepth, int olddepth);
413 extern void BDFFloatFree(BDFFloat *sel);
414 
415 extern int CVLayer(CharViewBase *cv);
416 extern Undoes *CVPreserveStateHints(CharViewBase *cv);
417 extern Undoes *CVPreserveState(CharViewBase *cv);
418 extern Undoes *CVPreserveWidth(CharViewBase *cv,int width);
419 extern Undoes *CVPreserveVWidth(CharViewBase *cv,int vwidth);
420 extern void CVDoRedo(CharViewBase *cv);
421 extern void CVDoUndo(CharViewBase *cv);
422 extern void CVRemoveTopUndo(CharViewBase *cv);
423 extern void CopySelected(CharViewBase *cv,int doanchors);
424 extern void CVCopyGridFit(CharViewBase *cv);
425 extern void CopyWidth(CharViewBase *cv,enum undotype);
426 extern void PasteToCV(CharViewBase *cv);
427 extern void CVYPerspective(CharViewBase *cv,double x_vanish, double y_vanish);
428 extern void ScriptSCEmbolden(SplineChar *sc,int layer,enum embolden_type type,struct lcg_zones *zones);
429 extern void CVEmbolden(CharViewBase *cv,enum embolden_type type,struct lcg_zones *zones);
430 extern void SCCondenseExtend(struct counterinfo *ci,SplineChar *sc, int layer,
431 	int do_undoes);
432 extern void SCClearSelPt(SplineChar *sc);
433 extern void SC_MoreLayers(SplineChar *,Layer *old);
434 extern void SCLayersChange(SplineChar *sc);
435 extern void SFLayerChange(SplineFont *sf);
436 extern void SCTile(SplineChar *sc,int layer);
437 extern void _CVMenuMakeLine(CharViewBase *cv,int do_arc,int ellipse_to_back);
438     /* Ellipse to back is a debugging flag and adds the generated ellipse to */
439     /*  the background layer so we can look at it. I thought it might actually*/
440     /*  be useful, so I left it in. Activated with the Alt key in the menu */
441 
442 extern void MVCopyChar(FontViewBase *fv, BDFFont *bdf, SplineChar *sc, enum fvcopy_type fullcopy);
443 extern void PasteIntoMV(FontViewBase *fv, BDFFont *bdf,SplineChar *sc, int doclear);
444 
445 extern void ExecuteScriptFile(FontViewBase *fv, SplineChar *sc, char *filename);
446 
447 extern int HasLicense(SplineFont *,FILE *);
448 extern int OFLibUploadFont(OFLibData *);
449 
450 enum search_flags { sv_reverse = 0x1, sv_flips = 0x2, sv_rotate = 0x4,
451 	sv_scale = 0x8, sv_endpoints=0x10 };
452 typedef struct searchdata {
453     SplineChar sc_srch, sc_rpl;
454     SplineSet *path, *revpath, *replacepath, *revreplace;
455     int pointcnt, rpointcnt;
456     real fudge;
457     real fudge_percent;			/* a value of .05 here represents 5% (we don't store the integer) */
458     unsigned int tryreverse: 1;
459     unsigned int tryflips: 1;
460     unsigned int tryrotate: 1;
461     unsigned int tryscale: 1;
462     unsigned int endpoints: 1;		/* Don't match endpoints, use them for direction only */
463     unsigned int onlyselected: 1;
464     unsigned int subpatternsearch: 1;
465     unsigned int doreplace: 1;
466     unsigned int replaceall: 1;
467     unsigned int findall: 1;
468     unsigned int searchback: 1;
469     unsigned int wrap: 1;
470     unsigned int wasreversed: 1;
471     unsigned int replacewithref: 1;
472     unsigned int already_complained: 1;	/* User has already been alerted to the fact that we've converted splines to refs and lost the instructions */
473     SplineSet *matched_spl;
474     SplinePoint *matched_sp, *last_sp;
475     real matched_rot, matched_scale;
476     real matched_x, matched_y;
477     double matched_co, matched_si;		/* Precomputed sin, cos */
478     enum flipset { flip_none = 0, flip_x, flip_y, flip_xy } matched_flip;
479 #ifdef _HAS_LONGLONG
480     unsigned long long matched_refs;	/* Bit map of which refs in the char were matched */
481     unsigned long long matched_ss;	/* Bit map of which splines in the char were matched */
482 				    /* In multi-path mode */
483     unsigned long long matched_ss_start;/* Bit map of which splines we tried to start matches with */
484 #else
485     unsigned long matched_refs;
486     unsigned long matched_ss;
487     unsigned long matched_ss_start;
488 #endif
489     FontViewBase *fv;
490     SplineChar *curchar;
491     int last_gid;
492 } SearchData;
493 
494 extern struct searchdata *SDFromContour( FontViewBase *fv, SplineSet *find, double fudge, int flags );
495 extern SplineChar *SDFindNext(struct searchdata *sv);
496 
497 extern struct python_import_export {
498     struct _object *import;	/* None becomes NULL */
499     struct _object *export;	/* None becomes NULL */
500     struct _object *data;	/* None stays None */
501     char *name;
502     char *extension;
503     char *all_extensions;
504 } *py_ie;
505 extern void PyFF_SCExport(SplineChar *sc,int ie_index,char *filename,
506 	int layer);
507 extern void PyFF_SCImport(SplineChar *sc,int ie_index,char *filename,
508 	int layer, int clear);
509 extern void PyFF_InitFontHook(FontViewBase *fv);
510 
511 extern void LookupInit(void);
512 extern int UserFeaturesDiffer(void);
513 extern uint32 *StdFeaturesOfScript(uint32 script);
514 
515 enum byte_types { bt_instr, bt_cnt, bt_byte, bt_wordhi, bt_wordlo, bt_impliedreturn };
516 struct instrdata {
517     uint8 *instrs;
518     int instr_cnt, max;
519     uint8 *bts;
520     unsigned int changed: 1;
521     unsigned int in_composit: 1;
522     SplineFont *sf;
523     SplineChar *sc;
524     uint32 tag;
525     struct instrdlg *id;
526     struct instrdata *next;
527 };
528 
529 extern uint8 *_IVParse(SplineFont *sf, char *text, int *len,
530 	void (*IVError)(void *,char *, int), void *iv);
531 extern char *_IVUnParseInstrs(uint8 *instrs,int instr_cnt);
532 
533 extern int BitmapControl(FontViewBase *fv,int32 *sizes,int isavail,int rasterize);
534 extern void FVSetWidthScript(FontViewBase *fv,enum widthtype wtype,int val,int incr);
535 extern void FVMetricsCenter(FontViewBase *fv,int docenter);
536 extern void FVRevert(FontViewBase *fv);
537 extern void FVRevertBackup(FontViewBase *fv);
538 extern void FVRevertGlyph(FontViewBase *fv);
539 extern int   MMReblend(FontViewBase *fv, MMSet *mm);
540 extern FontViewBase *MMCreateBlendedFont(MMSet *mm,FontViewBase *fv,real blends[MmMax],int tonew );
541 #endif
542