summaryrefslogtreecommitdiff
path: root/fonts.h
blob: ffb38176bc0616eec6f5b2a0d7711f91cafc4d7d (plain)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#ifndef FONTS_H
#define FONTS_H

#include <uchar.h>

#define SPACE_SYMBOL_WIDTH 2
#define MAX_SYMBOL_WIDTH   7
#define SYMBOL_COUNT       110
#define TIGHT_SYMBOLS_START  105

static char const symbols[SYMBOL_COUNT * MAX_SYMBOL_WIDTH] = {
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,  // space
  0x00,0x00,0x00,0x00,0x2F,0x00,0x00,  // !
  0x00,0x00,0x00,0x07,0x00,0x07,0x00,  // "
  0x00,0x00,0x14,0x7C,0x17,0x7C,0x17,  // #
  0x00,0x00,0x00,0x16,0x77,0x0A,0x00,  // $
  0x00,0x00,0x26,0x15,0x3F,0x2A,0x19,  // %
  0x00,0x00,0x10,0x2C,0x2A,0x12,0x28,  // &
  0x00,0x00,0x00,0x00,0x03,0x00,0x00,  // '
  0x00,0x00,0x00,0x1C,0x63,0x00,0x00,  // (
  0x00,0x00,0x00,0x00,0x63,0x1C,0x00,  // )
  0x00,0x00,0x00,0x0A,0x07,0x0A,0x00,  // *
  0x00,0x00,0x08,0x08,0x3E,0x08,0x08,  // +
  0x00,0x00,0x00,0x40,0x30,0x00,0x00,  // ,
  0x00,0x00,0x00,0x08,0x08,0x08,0x00,  // -
  0x00,0x00,0x00,0x00,0x20,0x00,0x00,  // .
  0x00,0x00,0x40,0x30,0x0C,0x03,0x00,  // /
  0x00,0x00,0x00,0x1E,0x21,0x1E,0x00,  // 0
  0x00,0x00,0x00,0x22,0x3F,0x20,0x00,  // 1
  0x00,0x00,0x00,0x32,0x29,0x26,0x00,  // 2
  0x00,0x00,0x00,0x21,0x25,0x1A,0x00,  // 3
  0x00,0x00,0x0C,0x0A,0x3F,0x08,0x00,  // 4
  0x00,0x00,0x00,0x27,0x25,0x19,0x00,  // 5
  0x00,0x00,0x00,0x3E,0x29,0x19,0x00,  // 6
  0x00,0x00,0x00,0x03,0x39,0x07,0x00,  // 7
  0x00,0x00,0x00,0x1B,0x25,0x1B,0x00,  // 8
  0x00,0x00,0x00,0x26,0x29,0x1F,0x00,  // 9
  0x00,0x00,0x00,0x00,0x28,0x00,0x00,  // :
  0x00,0x00,0x00,0x40,0x28,0x00,0x00,  // ;
  0x00,0x00,0x00,0x0C,0x12,0x00,0x00,  // <
  0x00,0x00,0x00,0x14,0x14,0x14,0x00,  // =
  0x00,0x00,0x00,0x00,0x12,0x0C,0x00,  // >
  0x00,0x00,0x00,0x02,0x29,0x06,0x00,  // ?
  0x00,0x00,0x3C,0x4B,0x55,0x5E,0x10,  // @
  0x00,0x00,0x20,0x3E,0x0A,0x3C,0x20,  // A
  0x00,0x00,0x22,0x3E,0x2A,0x1C,0x00,  // B
  0x00,0x00,0x1C,0x22,0x22,0x14,0x00,  // C
  0x00,0x00,0x22,0x3E,0x22,0x1C,0x00,  // D
  0x00,0x00,0x22,0x3E,0x2A,0x22,0x00,  // E
  0x00,0x00,0x22,0x3E,0x0A,0x06,0x00,  // F
  0x00,0x00,0x00,0x1C,0x2A,0x3A,0x00,  // G
  0x00,0x00,0x22,0x3E,0x08,0x3E,0x22,  // H
  0x00,0x00,0x00,0x22,0x3E,0x22,0x00,  // I
  0x00,0x00,0x18,0x22,0x1E,0x02,0x00,  // J
  0x00,0x00,0x22,0x3E,0x08,0x14,0x22,  // K
  0x00,0x00,0x22,0x3E,0x20,0x30,0x00,  // L
  0x00,0x00,0x3E,0x0C,0x04,0x3E,0x00,  // M
  0x00,0x00,0x22,0x3E,0x04,0x08,0x3E,  // N
  0x00,0x00,0x00,0x1C,0x22,0x1C,0x00,  // O
  0x00,0x00,0x22,0x3E,0x0A,0x0C,0x00,  // P
  0x00,0x00,0x00,0x5C,0x62,0x5C,0x00,  // Q
  0x00,0x00,0x22,0x3E,0x0A,0x1C,0x20,  // R
  0x00,0x00,0x00,0x34,0x2A,0x1A,0x00,  // S
  0x00,0x00,0x06,0x22,0x3E,0x22,0x06,  // T
  0x00,0x00,0x02,0x3E,0x20,0x1E,0x02,  // U
  0x00,0x00,0x0E,0x30,0x08,0x06,0x00,  // V
  0x00,0x02,0x3E,0x10,0x18,0x32,0x0E,  // W
  0x00,0x00,0x36,0x1C,0x36,0x22,0x00,  // X
  0x00,0x00,0x06,0x38,0x28,0x06,0x00,  // Y
  0x00,0x00,0x00,0x32,0x2A,0x26,0x00,  // Z
  0x00,0x00,0x00,0x7F,0x41,0x00,0x00,  // [
  0x00,0x00,0x00,0x01,0x0E,0x30,0x40,  // backslash
  0x00,0x00,0x00,0x00,0x41,0x7F,0x00,  // ]
  0x00,0x00,0x04,0x02,0x02,0x04,0x00,  // ^
  0x00,0x00,0x40,0x40,0x40,0x40,0x40,  // _
  0x00,0x00,0x00,0x01,0x02,0x00,0x00,  // `
  0x00,0x00,0x00,0x14,0x2C,0x18,0x20,  // a
  0x00,0x00,0x21,0x3F,0x24,0x18,0x00,  // b
  0x00,0x00,0x00,0x18,0x24,0x14,0x00,  // c
  0x00,0x00,0x00,0x18,0x25,0x1F,0x20,  // d
  0x00,0x00,0x00,0x18,0x2C,0x2C,0x00,  // e
  0x00,0x00,0x00,0x24,0x3F,0x25,0x00,  // f
  0x00,0x00,0x00,0x58,0x64,0x78,0x04,  // g
  0x00,0x00,0x21,0x3F,0x04,0x38,0x20,  // h
  0x00,0x00,0x00,0x24,0x3D,0x20,0x00,  // i
  0x00,0x00,0x40,0x44,0x7D,0x00,0x00,  // j
  0x00,0x00,0x21,0x3F,0x18,0x34,0x20,  // k
  0x00,0x00,0x00,0x21,0x3F,0x20,0x00,  // l
  0x00,0x3C,0x04,0x38,0x04,0x38,0x20,  // m
  0x00,0x00,0x24,0x3C,0x04,0x38,0x20,  // n
  0x00,0x00,0x00,0x18,0x24,0x18,0x00,  // o
  0x00,0x00,0x44,0x7C,0x64,0x18,0x00,  // p
  0x00,0x00,0x00,0x18,0x64,0x78,0x44,  // q
  0x00,0x00,0x00,0x24,0x3C,0x24,0x04,  // r
  0x00,0x00,0x00,0x28,0x2C,0x14,0x00,  // s
  0x00,0x00,0x04,0x3F,0x24,0x14,0x00,  // t
  0x00,0x00,0x04,0x3C,0x20,0x1C,0x20,  // u
  0x00,0x00,0x04,0x1C,0x20,0x1C,0x00,  // v
  0x00,0x00,0x1C,0x30,0x1C,0x30,0x0C,  // w
  0x00,0x00,0x24,0x18,0x18,0x24,0x00,  // x
  0x00,0x00,0x44,0x5C,0x20,0x1C,0x00,  // y
  0x00,0x00,0x00,0x34,0x2C,0x24,0x00,  // z
  0x00,0x00,0x00,0x08,0x36,0x41,0x00,  // {
  0x00,0x00,0x00,0x00,0x7F,0x00,0x00,  // |
  0x00,0x00,0x00,0x41,0x36,0x08,0x00,  // }
  0x00,0x00,0x00,0x08,0x04,0x08,0x04,  // ~
// 0x7f .. 0xaf missing
  0x00,0x00,0x00,0x02,0x05,0x02,0x00,  // ° (0xb0)
// 0xb1 .. 0xc2af missing
  0x00,0x00,0x00,0x02,0x05,0x02,0x00,  // ° (0xc2b0)
// 0xc2b1 .. 0xc383 missing
  0x00,0x00,0x21,0x3E,0x0A,0x3C,0x21,  // Ä (0xc384)
// 0xc385 .. 0xc395 missing
  0x00,0x00,0x01,0x1C,0x22,0x1C,0x01,  // Ö (0xc396)
// 0xc397 .. 0xc39b missing
  0x00,0x00,0x03,0x3E,0x20,0x1E,0x03,  // Ü (0xc39c)
// 0xc39d .. 0xc39e missing
  0x00,0x00,0x7E,0x0A,0x2A,0x1C,0x00,  // ß (0xc39f)
// 0xc3a0 .. 0xc3a3 missing
  0x00,0x00,0x01,0x14,0x2C,0x18,0x21,  // ä (0xc3a4)
// 0xc3a5 .. 0xc3b5 missing
  0x00,0x00,0x01,0x18,0x24,0x18,0x01,  // ö (0xc3b6)
// 0xc3b7 .. 0xc3bb missing
  0x00,0x00,0x05,0x3C,0x20,0x1C,0x21,   // ü (0xc3bc)
// 0xc3bd .. 0xee00 missing
  0x00,0x38,0x7D,0x39,0x79,0x38,0x39,  // Lok1 (0xee01)
  0x00,0x7F,0x39,0x7F,0x11,0x10,0x00,  // Lok2 (0xee02)
  0x00,0x10,0x7F,0x39,0x7F,0x39,0x3F,  // Waggon1a (0xee03)
  0x00,0x39,0x7F,0x39,0x7F,0x10,0x00,  // Waggon1b (0xee04)
  0x00,0x10,0x78,0x30,0x70,0x30,0x30,  // Waggon2a (0xee05)
  0x00,0x30,0x70,0x30,0x78,0x10,0x00   // Waggon2b (0xee06)
};

static char16_t const skip_ranges[11][2] = {
  {0x0000, 0x001f},
  {0x007f, 0x00af},
  {0x00b1, 0xc2af},
  {0xc2b1, 0xc383},
  {0xc385, 0xc395},
  {0xc397, 0xc39b},
  {0xc39d, 0xc39e},
  {0xc3a0, 0xc3a3},
  {0xc3a5, 0xc3b5},
  {0xc3b7, 0xc3bb},
  {0xc3bd, 0xee00}
};

static int symbols_boundaries[SYMBOL_COUNT][2];

void init_symbols_boundaries();
int render(char *input, int input_len, char *output, int max_output_len, int skip_unprintables);

#endif // FONTS_H