-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcadence.c
61 lines (50 loc) · 1.28 KB
/
cadence.c
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
#include <string.h>
#include <stdlib.h>
#include "kernagic.h"
typedef struct Cadence
{
int left;
char *utf8;
int right;
int flags;
} Cadence;
#define LEFT_EXTREME (1<<0)
#define RIGHT_EXTREME (1<<1)
#define RIGHT_STEM (1<<2)
#define LEFT_STEM (1<<3)
#define BOTH_EXTREME (LEFT_EXTREME | RIGHT_EXTREME)
#define BOTH_STEM (LEFT_STEM | RIGHT_STEM)
#define MAX_GLYPHS 4096
float n_basis = 24;
enum {
S_E_CHAR = 0,
S_IN_CHAR,
S_IN_COMMENT,
S_E_LEFT_MODE,
S_IN_LEFT_MODE,
S_E_LEFT_VAL,
S_IN_LEFT_VAL,
S_E_RIGHT_MODE,
S_IN_RIGHT_MODE,
S_E_RIGHT_VAL,
S_IN_RIGHT_VAL,
S_IN_BASIS,
S_DONE
};
extern float scale_factor;
float left_most_center (Glyph *g)
{
/* we only look at a single scan-line in the middle of the x-height */
return g->leftmost[(int)(kernagic_x_height() * 1.5 * scale_factor)] / scale_factor;
}
float right_most_center (Glyph *g)
{
/* we only look at a single scan-line in the middle of the x-height */
return g->rightmost[(int)(kernagic_x_height() * 1.5 * scale_factor)] / scale_factor;
}
#define LEFT_EXTREME (1<<0)
#define RIGHT_EXTREME (1<<1)
#define RIGHT_STEM (1<<2)
#define LEFT_STEM (1<<3)
#define BOTH_EXTREME (LEFT_EXTREME | RIGHT_EXTREME)
#define BOTH_STEM (LEFT_STEM | RIGHT_STEM)