Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-03 19:46:56 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-03 19:46:56 +1000
commit809744c300d6bc3a4f5cb71a8a67dbad811fe2de (patch)
tree8eb5d92d3a608aef29ed43ef43c23d20bb35a987 /source
parentf73cb3ce03c35770605ce83a49906cc4825c00a6 (diff)
Fix horizontal alignment with font, add new fonts
Diffstat (limited to 'source')
-rw-r--r--source/core/StarFont.cpp4
-rw-r--r--source/core/StarFont.hpp2
-rw-r--r--source/rendering/StarFontTextureGroup.cpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/source/core/StarFont.cpp b/source/core/StarFont.cpp
index 9c8636a..6adc4c3 100644
--- a/source/core/StarFont.cpp
+++ b/source/core/StarFont.cpp
@@ -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} };
}
}
diff --git a/source/core/StarFont.hpp b/source/core/StarFont.hpp
index d353611..e4786b6 100644
--- a/source/core/StarFont.hpp
+++ b/source/core/StarFont.hpp
@@ -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;
diff --git a/source/rendering/StarFontTextureGroup.cpp b/source/rendering/StarFontTextureGroup.cpp
index e59d15c..6a33d32 100644
--- a/source/rendering/StarFontTextureGroup.cpp
+++ b/source/rendering/StarFontTextureGroup.cpp
@@ -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);
}