There are at several ways to address a extended character set in a font / resource file.
16 bit wide character codes, giving possibility to use 65536 different characters, including all European and Russian languages, and also modern Chinese, Japanese and Korean script, without having to handle extension codes.
In Windows, and some other systems this is called widechar type, and need some extensions in C library print formatting functions:
These are available in XC32 as:
wprintf (const wchar_t *, ...)
fwprintf(__File *, const wchar_t *, ...)
swprintf (wchar_t *, size_t, const wchar_t *, ...)
There is <wchar.h> that may need to be included.
In Legacy MLA there is a macro USE_MULTIBYTECHAR that mean to use 16-bit characters.
This is a mistake and misnaming, and should really be changed to: USE_WIDECHAR.
I do not know if it have been corrected in current MLA for PIC24.
USE_MULTIBYTECHAR should be reserved to mean Variable Width Character representation.
Unicode UTF8 use between 1 and 3 bytes to represent any Unicode character.
It is defined in such a way that the 128 most common characters in american and european languages,
are the same as ASCII characters, so C language source code will need 1 byte characters only.
Then there are byte codes that indicate that there are more bytes following to represent the character.
Look up Wikipedia or Unicode documentation that explain how UTF8 is coded.
Using UTF8 multibyte character representation, there is no need for special handling by the Compiler:
All exotic character codes are just text data bytes as seen by the compiler.
The tricky work have to be done by Application code when rendering text to Display or Print.
Then Multibyte character codes must be decoded into pointers/indices to address Font data, stored by the Graphics Resource Converter.
There exist library functions to translate UTF8 Multibyte text into wide character 16 bit character codes,
that may be more convinient when addressing the Font resource file.
See: mbstowcs (...); and: mbtowc(wchar_t *pwc, const char *s, size_t n);
it is unclear to me, if the functions provided with XC16 really work as they are supposed to.
Using Font Filter.
This is scrambling the character representation for a closed selection of text
such that all characters that are actually present, are given new character codes within the range: 0 to 255.
This may work for a set of menu texts, or other fixed user interface work.
It probably isn't usable in a text processing environment where general text is imported from file or other external sources.
post edited by Mysil - 2018/07/08 15:47:20