new functions prototypes, minor fixes
* prototypes for UTF-8 ==> wchar16 conversion * minor fixes
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
#if defined(WLED_ENABLE_FULL_FONTS)
|
||||
|
||||
#include "codepages.h"
|
||||
#include <string.h>
|
||||
|
||||
// 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
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef WLED_CODEPAGES_H
|
||||
#define WLED_CODEPAGES_H
|
||||
#include <stdlib.h> // 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
|
||||
// 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
|
||||
|
||||
17
wled00/src/font/unicodetool.cpp
Normal file
17
wled00/src/font/unicodetool.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#if defined(WLED_ENABLE_FULL_FONTS)
|
||||
|
||||
#include "codepages.h"
|
||||
#include <string.h>
|
||||
|
||||
// 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
|
||||
Reference in New Issue
Block a user