Tc Unicode Helper
UnicodeFontDefs.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 https://www.thecoderscorner.com (Dave Cherry).
3  * This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
4  */
5 
6 #ifndef TCMENU_UNICODE_FONT_DEFN
7 #define TCMENU_UNICODE_FONT_DEFN
8 
9 #include <inttypes.h>
10 
11 #ifdef HUGE_FONT_BITMAPS
12 typedef uint32_t bitmap_size_t;
13 #else
14 typedef uint16_t bitmap_size_t;
15 #endif //HUGE_FONT_BITMAPS
16 
17 #ifndef _GFXFONT_H_
18 #define _GFXFONT_H_
19 
25 /*
26  * The next section is copied from Adafruit_GFX, it provides support for using Adafruit GFX fonts with this library.
27  *
28  * Font structures for newer Adafruit_GFX (1.1 and later).
29  * Example fonts are included in 'Fonts' directory.
30  * To use a font in your Arduino sketch, #include the corresponding .h
31  * file and pass address of GFXfont struct to setFont().
32  */
33 
40 typedef struct {
41  uint16_t bitmapOffset;
42  uint8_t width;
43  uint8_t height;
44  uint8_t xAdvance;
45  int8_t xOffset;
46  int8_t yOffset;
47 } GFXglyph;
48 
54 typedef struct {
55  uint8_t *bitmap;
57  uint16_t first;
58  uint16_t last;
59  uint8_t yAdvance;
60 } GFXfont;
61 
62 #endif // GFXFont include
63 
69 enum BitmapFormat: uint8_t { TCFONT_ONE_BIT_PER_PIXEL };
70 
82 typedef struct {
84  uint16_t relativeChar;
86  bitmap_size_t relativeBmpOffset;
88  uint8_t width;
90  uint8_t height;
92  uint8_t xAdvance;
94  int8_t xOffset;
96  int8_t yOffset;
98 
104 typedef struct {
106  uint32_t startingNum;
108  const uint8_t *bitmap;
112  uint16_t numberOfPoints;
114 
120 typedef struct {
124  uint16_t numberOfBlocks;
126  uint8_t yAdvance;
127  BitmapFormat bitmapFormat;
128 } UnicodeFont;
129 
130 #endif // TCMENU_UNICODE_FONT_DEFN
uint8_t width
Bitmap dimensions in pixels.
Definition: UnicodeFontDefs.h:42
const UnicodeFontGlyph * glyphs
Definition: UnicodeFontDefs.h:110
uint8_t height
Bitmap dimensions in pixels.
Definition: UnicodeFontDefs.h:43
uint16_t bitmapOffset
Pointer into GFXfont->bitmap.
Definition: UnicodeFontDefs.h:41
bitmap_size_t relativeBmpOffset
Definition: UnicodeFontDefs.h:86
const UnicodeFontBlock * unicodeBlocks
Definition: UnicodeFontDefs.h:122
uint8_t height
Definition: UnicodeFontDefs.h:90
const uint8_t * bitmap
Definition: UnicodeFontDefs.h:108
uint32_t startingNum
Definition: UnicodeFontDefs.h:106
uint16_t first
ASCII extents (first char)
Definition: UnicodeFontDefs.h:57
uint8_t * bitmap
Glyph bitmaps, concatenated.
Definition: UnicodeFontDefs.h:55
uint8_t width
Definition: UnicodeFontDefs.h:88
int8_t yOffset
Y dist from cursor pos to UL corner.
Definition: UnicodeFontDefs.h:46
int8_t xOffset
Definition: UnicodeFontDefs.h:94
uint8_t xAdvance
Distance to advance cursor (x axis)
Definition: UnicodeFontDefs.h:44
uint16_t last
ASCII extents (last char)
Definition: UnicodeFontDefs.h:58
uint16_t relativeChar
Definition: UnicodeFontDefs.h:84
int8_t xOffset
X dist from cursor pos to UL corner.
Definition: UnicodeFontDefs.h:45
BitmapFormat
Definition: UnicodeFontDefs.h:69
uint8_t yAdvance
Newline distance (y axis)
Definition: UnicodeFontDefs.h:59
uint16_t numberOfPoints
Definition: UnicodeFontDefs.h:112
int8_t yOffset
Definition: UnicodeFontDefs.h:96
uint16_t numberOfBlocks
Definition: UnicodeFontDefs.h:124
uint8_t xAdvance
Definition: UnicodeFontDefs.h:92
GFXglyph * glyph
Glyph array.
Definition: UnicodeFontDefs.h:56
uint8_t yAdvance
Definition: UnicodeFontDefs.h:126
Definition: UnicodeFontDefs.h:54
Definition: UnicodeFontDefs.h:40
Definition: UnicodeFontDefs.h:120
Definition: UnicodeFontDefs.h:104
Definition: UnicodeFontDefs.h:82