Fix horizontal alignment with font, add new fonts

This commit is contained in:
Kae 2023-07-03 19:46:56 +10:00
parent f73cb3ce03
commit 809744c300
24 changed files with 5 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -14,7 +14,7 @@
"font" : ""
},
"debugFont" : "mono",
"debugFont" : "iosevka-extrabold",
"debugFontSize" : 7,
"debugFontDirectives" : "?border=1;2224;0000",

View File

@ -86,7 +86,7 @@ unsigned Font::width(String::Char c) {
}
std::pair<Image, int> Font::render(String::Char c) {
std::pair<Image, Vec2I> Font::render(String::Char c) {
if (!m_fontImpl)
throw FontException("Font::render called on uninitialized font.");
@ -117,7 +117,7 @@ std::pair<Image, int> Font::render(String::Char c) {
}
}
return { move(image), (slot->bitmap_top - (int)height) + m_pixelSize / 4 };
return { move(image), {slot->bitmap_left, (slot->bitmap_top - (int)height) + m_pixelSize / 4} };
}
}

View File

@ -34,7 +34,7 @@ public:
// May return empty image on unrenderable character (Normally, this will
// render a box, but if there is an internal freetype error this may return
// an empty image).
std::pair<Image, int> render(String::Char c);
std::pair<Image, Vec2I> render(String::Char c);
private:
FontImplPtr m_fontImpl;

View File

@ -67,7 +67,7 @@ const FontTextureGroup::GlyphTexture& FontTextureGroup::glyphTexture(String::Cha
else
res.first->second.offset = Vec2F();
res.first->second.offset[1] += pair.second;
res.first->second.offset += Vec2F(pair.second);
res.first->second.texture = m_textureGroup->create(image);
}