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

@@ -173,7 +173,7 @@ namespace frame::render
void RenderTarget::DrawText(std::string_view pText,
Vector pCenterLineStart,
font::Font const& pFont,
uint8_t size)
uint32_t size)
{
auto pos = pCenterLineStart;
for(auto c : pText)
@@ -182,6 +182,31 @@ namespace frame::render
}
}
void RenderTarget::DrawTextGlyphBounds(std::string_view pText,
Vector pCenterLineStart,
font::Font const& pFont,
uint32_t size)
{
auto pos = pCenterLineStart;
auto lineSpacing = pFont.getLineSpacing(size);
auto _3 = lineSpacing / 3;
for(auto c : pText)
{
auto const& g = pFont.getGlyph(size, c);
DrawRect({int32_t(pos.x), int32_t(pos.y - _3 * 2)},
{int32_t(pos.x + g.advance), int32_t(pos.y + _3)},
1);
pos.x += g.advance;
}
}
void RenderTarget::Clear(Color color)
{
image.Clear(color);
}
void RenderTarget::DrawPointsMirrorCircle(Vector const& center,
Vector const& pos,
Color color)