gfx
gfx copied to clipboard
Unicode 16 bits runtime support
At the time I didn't find a way to create text containing 16bits characters in runtime, so I modified the "libaria_string.c" file with the following function in order to support it.
Here it is just in case you might want to add it to the library:
laString laString_CreateFromCharBuffer16(const uint16_t* chr, uint16_t size, GFXU_FontAsset* fnt)
{
laString str = { 0, 0, 0, 0, LA_STRING_NULLIDX };
uint32_t i;
if(laContext_GetActive() == NULL || chr == NULL)
{
laString_Initialize(&str);
return str;
}
if(size != 0)
{
laString_Allocate(&str, size);
if(str.capacity == 0)
return str;
for(i = 0; i < size; i++)
{
str.data[i] = (GFXU_CHAR)(chr[i]);
}
str.data[i] = '\0';
}
str.font = fnt;
str.table_index = LA_STRING_NULLIDX;
return str;
}
This is a good submission. Thank you for posting.
As an FYI the newer Legato graphics library in Harmony uses 16 bit character strings by default.