-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathkernagic.h
122 lines (94 loc) · 3.17 KB
/
kernagic.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
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
#ifndef KERNAGIC_H
#define KERNAGIC_H
#include <stdint.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <cairo.h>
#include "glyph.h"
void kernagic_load_ufo (const char *ufo_path, gboolean strip_left_bearing);
void load_ufo_glyph (Glyph *glyph);
float kernagic_x_height (void);
Glyph *kernagic_find_glyph_unicode (unsigned int unicode);
Glyph *kernagic_find_glyph (const char *name);
void kernagic_kern_clear_all (void);
void kernagic_save_kerning_info (void);
void kernagic_compute (GtkProgressBar *progress);
void kernagic_compute_bearings (void);
/* setting a glyph string makes kernagic only kern the involved pairs -
* permitting */
void kernagic_set_glyph_string (const char *utf8);
void rewrite_ufo_glyph (Glyph *glyph);
#define KERNAGIC_DEFAULT_STRIP_LEFT_BEARING 1
extern gboolean kernagic_strip_left_bearing;
gboolean kernagic_deal_with_glyphs (gunichar left, gunichar right);
gboolean kernagic_deal_with_glyph (gunichar unicode);
/* ipsum generator is a single c function, relies on state from srandom () */
char *ipsumat_generate (const char *dict_path,
const char *charset,
const char *desired_glyphs,
int max_wordlen,
int max_words);
GList *kernagic_glyphs (void);
typedef struct _KernagicMethod KernagicMethod;
KernagicMethod *kernagic_method_no (int no);
int kernagic_active_method_no (void);
struct _KernagicMethod {
char *name;
void (*init) (void);
void (*each) (Glyph *glyph, GtkProgressBar *progress);
void (*done) (void);
};
typedef struct _Word Word;
struct _Word
{
gchar *utf8;
int len;
int x;
int y;
int width;
int height;
};
const char *detect_word (int x, int y);
float n_distance (void);
extern int debug_start_y;
typedef struct _KernerSettings KernerSettings;
#define KERNER_DEFAULT_MODE 3
#define KERNER_DEFAULT_MIN 15
#define KERNER_DEFAULT_MAX 50
#define KERNER_DEFAULT_DIVISOR 24
#define KERNER_DEFAULT_SNAP 0
#define KERNER_DEFAULT_GAP 0.3
#define KERNER_DEFAULT_BIG_GLYPH_SCALING 1
#define KERNER_DEFAULT_TRACKING 100
struct _KernerSettings
{
KernagicMethod *method;
float minimum_distance;
float maximum_distance;
float divisor;
float snap;
float gap;
float big_glyph_scaling;
float tracking;
};
extern KernerSettings kerner_settings;
float kerner_kern (KernerSettings *settings, Glyph *left, Glyph *right);
void init_kerner (void);
void kerner_debug_ui (void);
void kernagic_set_cadence (const char *cadence_path);
void redraw_test_text (const char *intext, int debuglevel);
int canvas_width ();
int canvas_height ();
extern float debug_scale;
extern float waterfall_offset;
extern char *loaded_ufo_path;
void kernagic_libplist_rewrite (const char *path);
int kernagic_libplist_read (const char *path);
extern float kernagic_x_shift;
#define WATERFALL_START 0.02
#define WATERFALL_SCALING 1.33
#define WATERFALL_SPACING 0.7
#define WATERFALL_LEVELS 10
#define PREVIEW_PADDING 5
#define IPSUM0 "ooonnnono frtjckxiv Page Down - "
#endif