beta-0.89.2
[luatex.git] / source / texk / web2c / luatexdir / luafontloader / fontforge / fontforge / sd.h
blobab3657891485f5c1969653b74431adf43e798649
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:
6 * Redistributions of source code must retain the above copyright notice, this
7 * list of conditions and the following disclaimer.
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.
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.
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.
27 #ifndef _SD_H
28 #define _SD_H
29 # include <gimage.h>
31 /* All coordinates are in millimeters */
32 /* they will be displayed to the user scaled by the units field of the design */
34 #include "splinefont.h"
36 struct epattern {
37 struct entity *tile;
38 real width, height;
39 DBounds bbox;
40 real transform[6];
43 typedef struct entpen {
44 Color col;
45 struct gradient *grad;
46 struct epattern *tile;
47 float scale;
48 float opacity;
49 } Pen;
51 typedef struct textunit {
52 unichar_t *text;
53 SplineFont *sf;
54 float size; /* in points */
55 float kernafter;
56 Pen fill;
57 struct textunit *next;
58 } TextUnit;
60 typedef struct entity {
61 enum entity_type { et_splines, et_text, et_image, et_group } type;
62 union {
63 struct filledsplines {
64 SplineSet *splines;
65 unsigned int isfillable: 1; /* All splinesets are closed */
66 Pen fill, stroke; /* A value of 0xffffffff means do not fill or stroke */
67 float stroke_width;
68 enum linejoin join;
69 enum linecap cap;
70 real transform[6]; /* The stroke may be quite different depending on the transformation (ie. ellipse not circle, rotated, etc) */
71 } splines;
72 struct text {
73 TextUnit *text;
74 real transform[6];
75 struct entity *bound;
76 } text;
77 struct image {
78 GImage *image;
79 real transform[6];
80 Color col; /* that gets poured into imagemasks */
81 } image;
82 struct group {
83 struct entity *group;
84 } group;
85 } u;
86 SplineSet *clippath;
87 DBounds bb;
88 struct entity *next;
89 } Entity;
91 typedef struct entlayer {
92 Entity *entities;
93 char *name;
94 unsigned int isvisible: 1;
95 } EntLayer;
97 typedef struct tile {
98 Entity *tile;
99 struct tileinstance { real scale; struct gwindow *pixmap; struct tileinstance *next; }
100 *instances;
101 char *name;
102 } Tile;
104 typedef struct splinedesign {
105 int lcnt, lmax, active;
106 EntLayer *layers;
108 real width, height; /* in millimeters */
109 int16 hpages, vpages;
110 real pwidth, pheight; /* in millimeters */
111 real units; /* if user wants to see things in */
112 /* centimeters then units will be 10, if inches then 25.4, if points */
113 /* then 25.4/72, if 1/1200" then 25.4/1200, etc. */
114 struct dview *dvs;
115 } SplineDesign, Design;
117 extern Entity *EntityInterpretPS(FILE *ps,int *width);
118 extern Entity *EntityInterpretSVG(char *filename,char *memory, int memlen, int em_size,int ascent);
119 extern Entity *EntityInterpretPDFPage(FILE *pdf,int select_page);
120 extern SplinePointList *SplinesFromEntities(Entity *ent,int *flags,int is_stroked);
121 extern void SCAppendEntityLayers(SplineChar *sc, Entity *ent);
123 /* Used for type3 fonts briefly */
124 /* This is not a "real" structure. It is a temporary hack that encompasses */
125 /* various possibilities, the combination of which won't occur in reality */
126 typedef struct entitychar {
127 Entity *splines;
128 RefChar *refs;
129 int width, vwidth;
130 SplineChar *sc;
131 uint8 fromtype3;
132 } EntityChar;
134 struct pskeydict {
135 int16 cnt, max;
136 uint8 is_executable;
137 struct pskeyval *entries;
140 struct psstack {
141 enum pstype { ps_void, ps_num, ps_bool, ps_string, ps_instr, ps_lit,
142 ps_mark, ps_array, ps_dict } type;
143 union vals {
144 real val;
145 int tf;
146 char *str;
147 struct pskeydict dict; /* and for arrays too */
148 } u;
151 struct pskeyval {
152 enum pstype type;
153 union vals u;
154 char *key;
157 typedef struct retstack {
158 int max;
159 int cnt;
160 real *stack;
161 } RetStack;
163 #endif