| 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 |
#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> |
| 44 |
#endif |
| 45 |
|
| 46 |
enum nlt_operator { |
| 47 |
op_base = 0x100, |
| 48 |
|
| 49 |
op_x, op_y, |
| 50 |
op_value, |
| 51 |
op_negate, op_not, |
| 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, |
| 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 |
| 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 |