Debian Codegraph @

fontforge/nonlineartrans.h

raw symbols SCIP
1 /* Copyright (C) 2003-2012 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
28 #ifndef FONTFORGE_NONLINEARTRANS_H
29 #define FONTFORGE_NONLINEARTRANS_H
30
31 #include "baseviews.h"
32 #include "splinefont.h"
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 #include "ustring.h"
39 #include "utype.h"
40
41 #include <math.h>
42 #ifdef HAVE_IEEEFP_H
43 # include <ieeefp.h> /* Solaris defines isnan in ieeefp rather than math.h */
44 #endif
45
46 enum nlt_operator {
47 op_base = 0x100, /* Bigger than any character */
48
49 op_x, op_y, /* Returns current x & y values, no operands */
50 op_value, /* Returns a constant value */
51 op_negate, op_not, /* Unary operators: op1 */
52 op_log, op_exp, op_sqrt, op_sin, op_cos, op_tan,
53 op_abs, op_rint, op_floor, op_ceil,
54 op_pow, /* Binary operators: op1, op2 */
55 op_atan2,
56 op_times, op_div, op_mod,
57 op_add, op_sub,
58 op_eq, op_ne, op_le, op_lt, op_gt, op_ge,
59 op_and, op_or,
60 op_if /* Trinary operator: op1 ? op2 : op3 */
61 };
62
63 struct expr {
64 enum nlt_operator op;
65 struct expr *op1, *op2, *op3;
66 real value;
67 };
68
69 struct expr_context {
70 char *start, *cur;
71 unsigned int had_error: 1;
72 enum nlt_operator backed_token;
73 real backed_val;
74
75 real x, y;
76 struct expr *x_expr, *y_expr;
77 SplineChar *sc;
78 void *pov;
79 void (*pov_func)(BasePoint *me,void *);
80 };
81
82 extern void _SFNLTrans(FontViewBase *fv, struct expr_context *c);
83 extern struct expr *nlt_parseexpr(struct expr_context *c, char *str);
84 extern void nlt_exprfree(struct expr *e);
85 extern void CVNLTrans(CharViewBase *cv,struct expr_context *c);
86 extern void SPLPoV(SplineSet *spl,struct pov_data *pov, int only_selected);
87
88 extern int SCNLTrans(SplineChar *sc, int layer, char *x_expr, char *y_expr);
89 extern int SSNLTrans(SplineSet *ss, char *x_expr, char *y_expr);
90 extern void CVYPerspective(CharViewBase *cv, bigreal x_vanish, bigreal y_vanish);
91 extern void FVPointOfView(FontViewBase *fv, struct pov_data *pov);
92
93 #ifdef __cplusplus
94 }
95 #endif
96
97 #endif /* FONTFORGE_NONLINEARTRANS_H */