add: more font

This commit is contained in:
Simon Hardt
2022-03-05 21:58:04 +01:00
parent 0553927dad
commit 0fe1509c6c
9 changed files with 149 additions and 52 deletions

View File

@@ -65,12 +65,32 @@ int main()
{110, (int)display->getSize().height - 10},
5);
target.DrawText("abcdefghijklmnopqrstuvwxyz", {100, 50}, *font, 14);
target.DrawText("Hallo Welt!", {100, 50}, *font, 14);
target.DrawText("Hallo Welt!", {50, 100}, *font, 30);
display->Display(target.getImage());
std::this_thread::sleep_for(10s);
target.Clear();
frame::Vector pos = display->getSize() / 2;
auto text = "10:30";
pos.x -= font->getLength(text, 250) / 2;
pos.y += font->getHeight(text, 250) / 2;
pos.y -= font->getMaxYOffset(text, 250) + font->getHeight(text, 250);
target.DrawText(text, pos, *font, 250);
target.DrawTextGlyphBounds(text, pos, *font, 250);
target.DrawLine({0, (int32_t)pos.y},
{(int32_t)display->getSize().width, pos.y});
display->Display(target.getImage());
std::this_thread::sleep_for(10s);
display->Clear(frame::display::Color::WHITE);
}