diff --git a/wled00/src/font/codepage437.cpp b/wled00/src/font/codepage437.cpp index cea00454..4adadd8c 100644 --- a/wled00/src/font/codepage437.cpp +++ b/wled00/src/font/codepage437.cpp @@ -1,8 +1,9 @@ #if defined(WLED_ENABLE_FULL_FONTS) #include "codepages.h" +#include -// translates unicode 2-byte (UTF-16) "code points" into corresponding characters in codepage 347 (IBM PC aka PC-8) +// translates unicode 2-byte (UTF-16) "code points" into corresponding characters in codepage 437 (IBM PC aka PC-8) // based on a table from https://en.wikipedia.org/wiki/Code_page_437#Character_set uint16_t wchar16ToCodepage437(uint16_t wideChar) { @@ -205,7 +206,4 @@ uint16_t wchar16ToCodepage437(uint16_t wideChar) { } - - - -#endif \ No newline at end of file +#endif diff --git a/wled00/src/font/codepages.h b/wled00/src/font/codepages.h index 4ed5799e..829fcf0f 100644 --- a/wled00/src/font/codepages.h +++ b/wled00/src/font/codepages.h @@ -1,5 +1,15 @@ -#include -#include +#ifndef WLED_CODEPAGES_H +#define WLED_CODEPAGES_H +#include // needed to get uint16_t definition -// translates unicode 2-byte (UTF-16) "code points" into corresponding characters in codepage 347 (IBM PC aka PC-8) -uint16_t wchar16ToCodepage437(uint16_t wideChar); // codepage437.cpp \ No newline at end of file +// translates unicode UTF-8 "character code" into 2-byte "code point" (reduced UTF-16) +uint16_t unicodeToWchar16(const char* utf8, size_t maxLen); // unicodetool.cpp + +// returns a pointer to the next unicode item - can be used to "advance" conversion after unicodeToWchar16() +// return nullptr at end of input +const char* nextUnicode(const char* utf8, size_t maxLen); // unicodetool.cpp + +// translates unicode 2-byte (UTF-16) "code point" into corresponding character in codepage 437 (IBM PC aka PC-8) +uint16_t wchar16ToCodepage437(uint16_t wideChar); // codepage437.cpp + +#endif diff --git a/wled00/src/font/unicodetool.cpp b/wled00/src/font/unicodetool.cpp new file mode 100644 index 00000000..9388247b --- /dev/null +++ b/wled00/src/font/unicodetool.cpp @@ -0,0 +1,17 @@ +#if defined(WLED_ENABLE_FULL_FONTS) + +#include "codepages.h" +#include + +// translates the next unicode UTF-8 item to 2-byte "code points" (reduced UTF-16) +uint16_t unicodeToWchar16(const char* utf8, size_t maxLen) { + // to be implemented +} + +// returns a pointer to the next unicode item - can be used to "advance" conversion after unicodeToWchar16() +// return nullptr at end of input +const char* nextUnicode(const char* utf8, size_t maxLen) { + // to be implemented +} + +#endif