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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
/*
* This file is subject to the terms of the GFX License. If a copy of
* the license was not distributed with this file, you can obtain one at:
*
* http://ugfx.io/license.html
*/
/* Configuration constants for mcufont. */
#ifndef _MF_CONFIG_H_
#define _MF_CONFIG_H_
/*******************************************************
* Configuration settings related to GFX *
*******************************************************/
#include "../../../gfx.h"
/* Ensure definitions are compatible with uGFX */
#undef bool
#define bool gBool
#if !GFX_USE_GDISP || !GDISP_NEED_TEXT
#define MF_NO_COMPILE // Don't compile any font code
#endif
/* Prevent double definitions of standard int types */
#define MF_NO_STDINT_H
/* Mapping from uGFX settings to mcufont settings */
#if GDISP_NEED_UTF8
#define MF_ENCODING MF_ENCODING_UTF8
#else
#define MF_ENCODING MF_ENCODING_ASCII
#endif
#if GDISP_NEED_TEXT_WORDWRAP
#define MF_USE_ADVANCED_WORDWRAP 1
#else
#define MF_USE_ADVANCED_WORDWRAP 0
#endif
#define MF_USE_KERNING GDISP_NEED_TEXT_KERNING
#define MF_FONT_FILE_NAME "src/gdisp/fonts/fonts.h"
/* These are not used for now */
#define MF_USE_JUSTIFY 0
/*******************************************************
* Configuration settings related to build environment *
*******************************************************/
/* Name of the file that contains all the included fonts. */
#ifndef MF_FONT_FILE_NAME
#define MF_FONT_FILE_NAME "fonts.h"
#endif
/*****************************************
* Configuration settings related to API *
*****************************************/
/* Encoding for the input data.
* With the unicode encodings, the library supports the range of unicode
* characters 0x0000-0xFFFF (the Basic Multilingual Plane).
*
* ASCII: Plain ascii (somewhat works with ISO8859-1 also)
* UTF8: UTF8 encoding (variable number of bytes)
* UTF16: UTF16 encoding (2 bytes per character, compatible with UCS-2)
* WCHAR: Use compiler's wchar_t (usually same as UTF16)
*/
#define MF_ENCODING_ASCII 0
#define MF_ENCODING_UTF8 1
#define MF_ENCODING_UTF16 2
#define MF_ENCODING_WCHAR 3
#ifndef MF_ENCODING
#define MF_ENCODING MF_ENCODING_UTF8
#endif
/************************************************************************
* Configuration settings related to visual appearance of rendered text *
************************************************************************/
/* Minimum space between characters, in percents of the glyph width.
* Increasing this causes the kerning module to leave more space between
* characters.
*/
#ifndef MF_KERNING_SPACE_PERCENT
#define MF_KERNING_SPACE_PERCENT 15
#endif
/* Minimum space between characters, in pixels. Added to the percentual
* spacing. This pixel-based value guarantees enough space even with small
* fonts.
*/
#ifndef MF_KERNING_SPACE_PIXELS
#define MF_KERNING_SPACE_PIXELS 3
#endif
/* Maximum adjustment done by the kerning algorithm, as percent of the
* glyph width.
*/
#ifndef MF_KERNING_LIMIT
#define MF_KERNING_LIMIT 20
#endif
/* Spacing of tabulator stops. The value is multiplied by the width of the
* 'm' character in the current font.
*/
#ifndef MF_TABSIZE
#define MF_TABSIZE 8
#endif
/*************************************************************************
* Configuration settings to strip down library to reduce resource usage *
*************************************************************************/
/* Enable or disable the kerning module.
* Disabling it saves some code size and run time, but causes the spacing
* between characters to be less consistent.
*/
#ifndef MF_USE_KERNING
#define MF_USE_KERNING 1
#endif
/* Enable or disable the advanced word wrap algorithm.
* If disabled, uses a simpler algorithm.
*/
#ifndef MF_USE_ADVANCED_WORDWRAP
#define MF_USE_ADVANCED_WORDWRAP 1
#endif
/* Enable of disable the justification algorithm.
* If disabled, mf_render_justified renders just left-aligned.
*/
#ifndef MF_USE_JUSTIFY
#define MF_USE_JUSTIFY 1
#endif
/* Enable or disable the center and right alignment code.
* If disabled, any alignment results in MF_ALIGN_LEFT.
*/
#ifndef MF_USE_ALIGN
#define MF_USE_ALIGN 1
#endif
/* Enable or disable the support for tab alignment.
* If disabled, tabs will be rendered as regular space character.
*/
#ifndef MF_USE_TABS
#define MF_USE_TABS 1
#endif
/* Number of vertical zones to use when computing kerning.
* Larger values give more accurate kerning, but are slower and use somewhat
* more memory. There is no point to increase this beyond the height of the
* font.
*/
#ifndef MF_KERNING_ZONES
#define MF_KERNING_ZONES 16
#endif
/* Add extern "C" when used from C++. */
#ifdef __cplusplus
#define MF_EXTERN extern "C"
#else
#define MF_EXTERN
#endif
#endif
|