summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/libs/ff-woff/fontforge/sd.h
blob: 9e9bd56c1d1cbdeefbb81ef2e7ad38e324fc6af7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/* Copyright (C) 2000-2012 by George Williams */
/*
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.

 * Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.

 * The name of the author may not be used to endorse or promote products
 * derived from this software without specific prior written permission.

 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
#ifndef _SD_H
#define _SD_H
# include <gimage.h>

/* All coordinates are in millimeters */
/* they will be displayed to the user scaled by the units field of the design */

#include "splinefont.h"

struct epattern {
    struct entity *tile;
    real width, height;
    DBounds bbox;
    real transform[6];
};

typedef struct entpen {
    Color col;
    struct gradient *grad;
    struct epattern *tile;
    float scale;
    float opacity;
} Pen;

typedef struct textunit {
    unichar_t *text;
    SplineFont *sf;
    float size;			/* in points */
    float kernafter;
    Pen fill;
    struct textunit *next;
} TextUnit;

struct filledsplines {
    SplineSet *splines;
    unsigned int isfillable: 1;		/* All splinesets are closed */
    Pen fill, stroke;			/* A value of 0xffffffff means do not fill or stroke */
    float stroke_width;
    enum linejoin join;
    enum linecap cap;
    real transform[6];			/* The stroke may be quite different depending on the transformation (ie. ellipse not circle, rotated, etc) */
};

struct text {
    TextUnit *text;
    real transform[6];
    struct entity *bound;
};

struct image {
    GImage *image;
    real transform[6];
    Color col;				/* that gets poured into imagemasks */
};

struct group {
    struct entity *group;
};

enum entity_type { et_splines, et_text, et_image, et_group };

typedef struct entity {
    enum entity_type type;
    union {
	struct filledsplines splines;
	struct text text;
	struct image image;
	struct group group;
    } u;
    SplineSet *clippath;
    DBounds bb;
    struct entity *next;
} Entity;
	    
typedef struct entlayer {
    Entity *entities;
    char *name;
    unsigned int isvisible: 1;
} EntLayer;

typedef struct tile {
    Entity *tile;
    struct tileinstance { real scale; struct gwindow *pixmap; struct tileinstance *next; }
	    *instances;
    char *name;
} Tile;

typedef struct splinedesign {
    int lcnt, lmax, active;
    EntLayer *layers;

    real width, height;		/* in millimeters */
    int16 hpages, vpages;
    real pwidth, pheight;		/* in millimeters */
    real units;			/* if user wants to see things in */
	/* centimeters then units will be 10, if inches then 25.4, if points */
	/* then 25.4/72, if 1/1200" then 25.4/1200, etc. */
    struct dview *dvs;
} SplineDesign, Design;

/* Used for type3 fonts briefly */
/* This is not a "real" structure. It is a temporary hack that encompasses */
/*  various possibilities, the combination of which won't occur in reality */
typedef struct entitychar {
    Entity *splines;
    RefChar *refs;
    int width, vwidth;
    SplineChar *sc;
    uint8 fromtype3;
} EntityChar;

extern SplinePointList *SplinesFromEntityChar(EntityChar *ec,int *flags,int is_stroked);

struct pskeydict {
    int16 cnt, max;
    uint8 is_executable;
    struct pskeyval *entries;
};

enum pstype { ps_void, ps_num, ps_bool, ps_string, ps_instr, ps_lit,
	      ps_mark, ps_array, ps_dict };

union vals {
    real val;
    int tf;
    char *str;
    struct pskeydict dict;		/* and for arrays too */
};

struct pskeyval {
    enum pstype type;
    union vals u;
    char *key;
};

typedef struct retstack {
    int max;
    int cnt;
    real *stack;
} RetStack;

#endif