version 2.8
mf_config.h
1 /*
2  * This file is subject to the terms of the GFX License. If a copy of
3  * the license was not distributed with this file, you can obtain one at:
4  *
5  * http://ugfx.org/license.html
6  */
7 
8 /* Configuration constants for mcufont. */
9 
10 #ifndef _MF_CONFIG_H_
11 #define _MF_CONFIG_H_
12 
13 /*******************************************************
14  * Configuration settings related to GFX *
15  *******************************************************/
16 
17 #include "../../../gfx.h"
18 
19 #if !GFX_USE_GDISP || !GDISP_NEED_TEXT
20  #define MF_NO_COMPILE // Don't compile any font code
21 #endif
22 
23 /* Prevent double definitions of standard int types */
24 #define MF_NO_STDINT_H
25 
26 /* Mapping from uGFX settings to mcufont settings */
27 #if GDISP_NEED_UTF8
28  #define MF_ENCODING MF_ENCODING_UTF8
29 #else
30  #define MF_ENCODING MF_ENCODING_ASCII
31 #endif
32 
33 #if GDISP_NEED_TEXT_WORDWRAP
34  #define MF_USE_ADVANCED_WORDWRAP 1
35 #else
36  #define MF_USE_ADVANCED_WORDWRAP 0
37 #endif
38 
39 #define MF_USE_KERNING GDISP_NEED_TEXT_KERNING
40 #define MF_FONT_FILE_NAME "src/gdisp/fonts/fonts.h"
41 
42 /* These are not used for now */
43 #define MF_USE_JUSTIFY 0
44 
45 /*******************************************************
46  * Configuration settings related to build environment *
47  *******************************************************/
48 
49 /* Name of the file that contains all the included fonts. */
50 #ifndef MF_FONT_FILE_NAME
51 #define MF_FONT_FILE_NAME "fonts.h"
52 #endif
53 
54 
55 /*****************************************
56  * Configuration settings related to API *
57  *****************************************/
58 
59 /* Encoding for the input data.
60  * With the unicode encodings, the library supports the range of unicode
61  * characters 0x0000-0xFFFF (the Basic Multilingual Plane).
62  *
63  * ASCII: Plain ascii (somewhat works with ISO8859-1 also)
64  * UTF8: UTF8 encoding (variable number of bytes)
65  * UTF16: UTF16 encoding (2 bytes per character, compatible with UCS-2)
66  * WCHAR: Use compiler's wchar_t (usually same as UTF16)
67  */
68 #define MF_ENCODING_ASCII 0
69 #define MF_ENCODING_UTF8 1
70 #define MF_ENCODING_UTF16 2
71 #define MF_ENCODING_WCHAR 3
72 #ifndef MF_ENCODING
73 #define MF_ENCODING MF_ENCODING_UTF8
74 #endif
75 
76 
77 /************************************************************************
78  * Configuration settings related to visual appearance of rendered text *
79  ************************************************************************/
80 
81 /* Minimum space between characters, in percents of the glyph width.
82  * Increasing this causes the kerning module to leave more space between
83  * characters.
84  */
85 #ifndef MF_KERNING_SPACE_PERCENT
86 #define MF_KERNING_SPACE_PERCENT 15
87 #endif
88 
89 /* Minimum space between characters, in pixels. Added to the percentual
90  * spacing. This pixel-based value guarantees enough space even with small
91  * fonts.
92  */
93 #ifndef MF_KERNING_SPACE_PIXELS
94 #define MF_KERNING_SPACE_PIXELS 3
95 #endif
96 
97 /* Maximum adjustment done by the kerning algorithm, as percent of the
98  * glyph width.
99  */
100 #ifndef MF_KERNING_LIMIT
101 #define MF_KERNING_LIMIT 20
102 #endif
103 
104 /* Spacing of tabulator stops. The value is multiplied by the width of the
105  * 'm' character in the current font.
106  */
107 #ifndef MF_TABSIZE
108 #define MF_TABSIZE 8
109 #endif
110 
111 
112 /*************************************************************************
113  * Configuration settings to strip down library to reduce resource usage *
114  *************************************************************************/
115 
116 /* Enable or disable the kerning module.
117  * Disabling it saves some code size and run time, but causes the spacing
118  * between characters to be less consistent.
119  */
120 #ifndef MF_USE_KERNING
121 #define MF_USE_KERNING 1
122 #endif
123 
124 /* Enable or disable the advanced word wrap algorithm.
125  * If disabled, uses a simpler algorithm.
126  */
127 #ifndef MF_USE_ADVANCED_WORDWRAP
128 #define MF_USE_ADVANCED_WORDWRAP 1
129 #endif
130 
131 /* Enable of disable the justification algorithm.
132  * If disabled, mf_render_justified renders just left-aligned.
133  */
134 #ifndef MF_USE_JUSTIFY
135 #define MF_USE_JUSTIFY 1
136 #endif
137 
138 /* Enable or disable the center and right alignment code.
139  * If disabled, any alignment results in MF_ALIGN_LEFT.
140  */
141 #ifndef MF_USE_ALIGN
142 #define MF_USE_ALIGN 1
143 #endif
144 
145 /* Enable or disable the support for tab alignment.
146  * If disabled, tabs will be rendered as regular space character.
147  */
148 #ifndef MF_USE_TABS
149 #define MF_USE_TABS 1
150 #endif
151 
152 /* Number of vertical zones to use when computing kerning.
153  * Larger values give more accurate kerning, but are slower and use somewhat
154  * more memory. There is no point to increase this beyond the height of the
155  * font.
156  */
157 #ifndef MF_KERNING_ZONES
158 #define MF_KERNING_ZONES 16
159 #endif
160 
161 
162 
163 /* Add extern "C" when used from C++. */
164 #ifdef __cplusplus
165 #define MF_EXTERN extern "C"
166 #else
167 #define MF_EXTERN
168 #endif
169 
170 #endif
171