-
Notifications
You must be signed in to change notification settings - Fork 7
/
glyph.h
76 lines (54 loc) · 2.1 KB
/
glyph.h
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
#ifndef KERNAGIC_GLYPH_H
#define KERNAGIC_GLYPH_H
#include <stdint.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <cairo.h>
typedef struct _Glyph Glyph;
struct _Glyph {
char *path;
char *name;
char *xml;
uint32_t unicode;
/* each glyph loaded into kernagic can have an associated raster image
*/
uint8_t *raster;
int r_width; /* raster width */
int r_height;
int scan_width[1024]; /* 1024 is a really arbitrary number.. */
int offset_x; /* how many units have been subtracted out of glyphs outline
* coordinates by the bearing stripping */
float ink_min_x; /* always 0 due to stripped bearings */
float ink_max_x; /* the ink extents is bounding box of the glyph */
float ink_min_y; /* outline. */
float ink_max_y;
float ink_width; /* computed from ink_max_x - ink_min_x */
float ink_height; /* computed from ink_max_y - ink_min_y */
float left_original;
float right_original;
float left_bearing;
float right_bearing; /* this should deprecate advance.. */
GHashTable *kerning;
/* leftmost and rightmost pixel per row -1 for no pixel */
int leftmost[2048];
int rightmost[2048];
cairo_t *cr; /* used transiently during glyph rendering */
#define MAX_STEMS 32
float stems[MAX_STEMS];
float stem_weight[MAX_STEMS];
int stem_count;
float lstem;
float rstem;
int loaded;
};
float kernagic_kern_get (Glyph *a, Glyph *b);
void kernagic_set_kerning (Glyph *a, Glyph *b, float kerning);
void kernagic_set_left_bearing (Glyph *g, float left_bearing);
void kernagic_set_right_bearing (Glyph *g, float right_bearing);
float kernagic_get_advance (Glyph *g);
Glyph *kernagic_glyph_new (const char *path);
void kernagic_glyph_free (Glyph *glyph);
/* resets the bearing information of the glyph
*/
void kernagic_glyph_reset (Glyph *glyph);
#endif