My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

u8g_fontutf8.h 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * @file fontutf8.h
  3. * @brief font api for u8g lib
  4. * @author Yunhui Fu (yhfudev@gmail.com)
  5. * @version 1.0
  6. * @date 2015-02-19
  7. * @copyright GPL/BSD
  8. */
  9. #pragma once
  10. #include <U8glib-HAL.h>
  11. #include "../fontutils.h"
  12. // the macro to indicate a UTF-8 string
  13. // You should to save the C/C++ source in UTF-8 encoding!
  14. // Once you change your UTF-8 strings, you need to call the script uxggenpages.sh to create the font data file fontutf8-data.h
  15. #define _UxGT(a) a
  16. typedef struct _uxg_fontinfo_t {
  17. uint16_t page;
  18. uint8_t begin;
  19. uint8_t end;
  20. uint16_t size;
  21. const u8g_fntpgm_uint8_t *fntdata;
  22. } uxg_fontinfo_t;
  23. int uxg_SetUtf8Fonts(const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM
  24. unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, const pixel_len_t max_length);
  25. unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, const pixel_len_t max_length);
  26. unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, const pixel_len_t max_length);
  27. int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg);
  28. int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg);
  29. #define uxg_GetFont(puxg) ((puxg)->font)
  30. #define _LANG_FONT_INFO(L) g_fontinfo_##L
  31. #define LANG_FONT_INFO(L) _LANG_FONT_INFO(L)