-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathu8g_fontutf8.h
55 lines (42 loc) · 1.6 KB
/
u8g_fontutf8.h
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
/**
* @file fontutf8.h
* @brief font api for u8g lib
* @author Yunhui Fu ([email protected])
* @version 1.0
* @date 2015-02-19
* @copyright GPL/BSD
*/
#ifndef _UXG_FONTUTF8_H
#define _UXG_FONTUTF8_H 1
#include <u8g.h>
#include "fontutils.h"
#ifdef __cplusplus
extern "C" {
#endif
// the macro to indicate a UTF-8 string
// You should to save the C/C++ source in UTF-8 encoding!
// Once you change your UTF-8 strings, you need to call the script uxggenpages.sh to create the font data file fontutf8-data.h
#define _UxGT(a) a
typedef struct _uxg_fontinfo_t {
uint16_t page;
uint8_t begin;
uint8_t end;
uint16_t size;
const u8g_fntpgm_uint8_t *fntdata;
} uxg_fontinfo_t;
extern int uxg_SetUtf8Fonts (const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM
extern char uxg_Utf8FontIsInited(void);
extern unsigned int uxg_DrawWchar (u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_length);
extern unsigned int uxg_DrawUtf8Str (u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length);
extern unsigned int uxg_DrawUtf8StrP (u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length);
#if 0
extern int uxg_GetUtf8StrPixelHeight(u8g_t *pu8g, const char *utf8_msg);
extern int uxg_GetUtf8StrPixelHeightP(u8g_t *pu8g, const char *utf8_msg);
#endif
extern int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg);
extern int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, const char *utf8_msg);
#define uxg_GetFont(puxg) ((puxg)->font)
#ifdef __cplusplus
}
#endif
#endif // _UXG_FONTUTF8_H