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

summaryrefslogtreecommitdiff
path: root/source/core
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-04-22 08:17:10 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-04-22 08:17:10 +1000
commit52dae03aae84afa78a9dbfc68976e99fd1b20ee2 (patch)
tree90977a5c89733bbe98f8257ae520ceb9f69bd6cd /source/core
parentca1426eabc873f781eb0dd389d45634b7d183250 (diff)
Add UnifontEx fallback for glyphs that are missing from the current font
Diffstat (limited to 'source/core')
-rw-r--r--source/core/StarFont.cpp4
-rw-r--r--source/core/StarFont.hpp1
2 files changed, 5 insertions, 0 deletions
diff --git a/source/core/StarFont.cpp b/source/core/StarFont.cpp
index 63356ad..b21b85a 100644
--- a/source/core/StarFont.cpp
+++ b/source/core/StarFont.cpp
@@ -133,4 +133,8 @@ std::pair<Image, Vec2I> Font::render(String::Char c) {
return { std::move(image), {slot->bitmap_left - 1, (slot->bitmap_top - height) + (m_pixelSize / 4) - 1} };
}
+bool Font::exists(String::Char c) {
+ return FT_Get_Char_Index(m_fontImpl->face, c);
+}
+
}
diff --git a/source/core/StarFont.hpp b/source/core/StarFont.hpp
index ec10533..dee50f7 100644
--- a/source/core/StarFont.hpp
+++ b/source/core/StarFont.hpp
@@ -35,6 +35,7 @@ public:
// render a box, but if there is an internal freetype error this may return
// an empty image).
std::pair<Image, Vec2I> render(String::Char c);
+ bool exists(String::Char c);
private:
FontImplPtr m_fontImpl;