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