2018-04-13 01:14:01 +00:00
|
|
|
/**
|
|
|
|
* @file fontutf8.h
|
|
|
|
* @brief font api for u8g lib
|
|
|
|
* @author Yunhui Fu (yhfudev@gmail.com)
|
|
|
|
* @version 1.0
|
|
|
|
* @date 2015-02-19
|
|
|
|
* @copyright GPL/BSD
|
|
|
|
*/
|
|
|
|
#ifndef _UXG_FONTUTF8_H
|
|
|
|
#define _UXG_FONTUTF8_H 1
|
|
|
|
|
2018-04-17 22:28:55 +00:00
|
|
|
#include <U8glib.h>
|
2018-04-13 01:14:01 +00:00
|
|
|
#include "fontutils.h"
|
|
|
|
|
|
|
|
// 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 {
|
2018-05-27 08:11:36 +00:00
|
|
|
uint16_t page;
|
|
|
|
uint8_t begin;
|
|
|
|
uint8_t end;
|
|
|
|
uint16_t size;
|
|
|
|
const u8g_fntpgm_uint8_t *fntdata;
|
2018-04-13 01:14:01 +00:00
|
|
|
} uxg_fontinfo_t;
|
|
|
|
|
2018-05-26 04:32:37 +00:00
|
|
|
int uxg_SetUtf8Fonts (const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM
|
2018-04-13 01:14:01 +00:00
|
|
|
|
2018-05-26 04:32:37 +00:00
|
|
|
unsigned int uxg_DrawWchar (u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_length);
|
2018-04-13 01:14:01 +00:00
|
|
|
|
2018-05-26 04:32:37 +00:00
|
|
|
unsigned int uxg_DrawUtf8Str (u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length);
|
|
|
|
unsigned int uxg_DrawUtf8StrP (u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length);
|
2018-04-13 01:14:01 +00:00
|
|
|
|
2018-05-26 04:32:37 +00:00
|
|
|
int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg);
|
|
|
|
int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, const char *utf8_msg);
|
2018-04-13 01:14:01 +00:00
|
|
|
|
|
|
|
#define uxg_GetFont(puxg) ((puxg)->font)
|
|
|
|
|
|
|
|
#endif // _UXG_FONTUTF8_H
|