2023-05-24 06:36 AM
to draw the unicode 'q' character for example we can use this instructions:
void CustomContainer::draw(const Rect& invalidatedArea) const{
Font* font = FontManager::getFont(Typography::DEFAULT);
if (font != 0){
// Setup visuals for h-center of "string"
LCD::StringVisuals visuals;
visuals.font = font;
visuals.alignment = CENTER;
visuals.color = colortype(0xFF0000FF);
Unicode::UnicodeChar character[2] = { 0, 0 };
uint16_t fontHeight = font->getMinimumTextHeight();
Unicode::UnicodeChar c = 'q';
if (c != 0){
Rect Area1(50,20,40,20) ;
uint16_t offset = (Area1.height - fontHeight) / 2;
Rect invalidatedAreaRelative = Area1& invalidatedArea;
Area1.y += offset;
Area1.height -= offset;
invalidatedAreaRelative.x -= Area1.x;
invalidatedAreaRelative.y -= Area1.y;
character[0] = c;
translateRectToAbsolute(Area1);
HAL::lcd().drawString(Area1, invalidatedAreaRelative, visuals, character);
}
}
}
now how to display Unicode symbols like:
Upwards white Arrow ( Unicode 0x21E7)
Erase to the Left (Unicode = 0x232B )
or White Heavy Check Mark symbol (Unicode = 0x2705 )