summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibTTF/Font.cpp7
-rw-r--r--Userland/Libraries/LibTTF/Font.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/Userland/Libraries/LibTTF/Font.cpp b/Userland/Libraries/LibTTF/Font.cpp
index aa7166683b..81efaa7ca9 100644
--- a/Userland/Libraries/LibTTF/Font.cpp
+++ b/Userland/Libraries/LibTTF/Font.cpp
@@ -510,6 +510,13 @@ u16 Font::weight() const
return 400;
}
+bool Font::is_fixed_width() const
+{
+ // FIXME: Read this information from the font file itself.
+ // FIXME: Although, it appears some application do similar hacks
+ return glyph_metrics(glyph_id_for_codepoint('.'), 1, 1).advance_width == glyph_metrics(glyph_id_for_codepoint('X'), 1, 1).advance_width;
+}
+
int ScaledFont::width(const StringView& string) const
{
Utf8View utf8 { string };
diff --git a/Userland/Libraries/LibTTF/Font.h b/Userland/Libraries/LibTTF/Font.h
index d1e96c0267..2448e8f6af 100644
--- a/Userland/Libraries/LibTTF/Font.h
+++ b/Userland/Libraries/LibTTF/Font.h
@@ -78,7 +78,7 @@ public:
String family() const;
String variant() const;
u16 weight() const;
- bool is_fixed_width() const { return false; } /* TODO */
+ bool is_fixed_width() const;
private:
enum class Offsets {