aboutsummaryrefslogtreecommitdiff
path: root/Marlin/src/lcd/dogm/u8g_fontutf8.h
diff options
context:
space:
mode:
authorGeorgiy Bondarenko <69736697+nehilo@users.noreply.github.com>2021-03-04 20:54:23 +0300
committerGeorgiy Bondarenko <69736697+nehilo@users.noreply.github.com>2021-03-04 20:54:23 +0300
commite8701195e66f2d27ffe17fb514eae8173795aaf7 (patch)
tree9f519c4abf6556b9ae7190a6210d87ead1dfadde /Marlin/src/lcd/dogm/u8g_fontutf8.h
downloadkp3s-lgvl-e8701195e66f2d27ffe17fb514eae8173795aaf7.tar.xz
kp3s-lgvl-e8701195e66f2d27ffe17fb514eae8173795aaf7.zip
Initial commit
Diffstat (limited to 'Marlin/src/lcd/dogm/u8g_fontutf8.h')
-rw-r--r--Marlin/src/lcd/dogm/u8g_fontutf8.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/Marlin/src/lcd/dogm/u8g_fontutf8.h b/Marlin/src/lcd/dogm/u8g_fontutf8.h
new file mode 100644
index 0000000..34e365c
--- /dev/null
+++ b/Marlin/src/lcd/dogm/u8g_fontutf8.h
@@ -0,0 +1,37 @@
+/**
+ * @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
+ */
+#pragma once
+
+#include <U8glib.h>
+#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 {
+ uint16_t page;
+ uint8_t begin;
+ uint8_t end;
+ uint16_t size;
+ const u8g_fntpgm_uint8_t *fntdata;
+} uxg_fontinfo_t;
+
+int uxg_SetUtf8Fonts(const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM
+
+unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_length);
+
+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, PGM_P utf8_msg, pixel_len_t max_length);
+
+int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg);
+int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg);
+
+#define uxg_GetFont(puxg) ((puxg)->font)