mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:37:44 +00:00
LibTTF: Add hack for recognizing fixed-width fonts
This commit is contained in:
parent
53d2073a66
commit
05d31cbeeb
2 changed files with 8 additions and 1 deletions
|
@ -510,6 +510,13 @@ u16 Font::weight() const
|
||||||
return 400;
|
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
|
int ScaledFont::width(const StringView& string) const
|
||||||
{
|
{
|
||||||
Utf8View utf8 { string };
|
Utf8View utf8 { string };
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
String family() const;
|
String family() const;
|
||||||
String variant() const;
|
String variant() const;
|
||||||
u16 weight() const;
|
u16 weight() const;
|
||||||
bool is_fixed_width() const { return false; } /* TODO */
|
bool is_fixed_width() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class Offsets {
|
enum class Offsets {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue