Open PaddiM8 opened 3 months ago
Wait, it seems to be related to the name? It tries to decode 48be636b
. Afaik, be
is not how æ is represented in UTF-8, and my hex editor just shows it as H.ck
, but other programs do display the font name as Hæck
and loads it without issues. I can confirm that 48be636b
is present in the font file itself.
This might help; haven't tested it though:
% git diff
diff --git a/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp b/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp
index 3dc111295d..030cd72011 100644
--- a/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp
+++ b/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp
@@ -235,7 +235,8 @@ String Name::string_for_id(NameId id) const
return decoder.to_utf8(m_string_data.slice(offset, length)).release_value_but_fixme_should_propagate_errors();
}
- return String::from_utf8(m_string_data.slice(offset, length)).release_value_but_fixme_should_propagate_errors();
+ static auto& decoder = *TextCodec::decoder_for("x-mac-roman"sv);
+ return decoder.to_utf8(m_string_data.slice(offset, length)).release_value_but_fixme_should_propagate_errors();
}
ErrorOr<Kern> Kern::from_slice(ReadonlyBytes slice)
For bonus points, we'd also check the encoding_id
to be 0
, in addition to checking language_id
. (ref: https://learn.microsoft.com/en-us/typography/opentype/spec/name#macintosh-encoding-ids-script-manager-codes)
That seems to fix it in indeed!
I noticed that Ladybird crashes when I have Hæck installed. It's a variant of the
Hack
font with ligatures.Here's a gdb backtrace:
I used the font from here: https://github.com/ignatov/Haack/releases/download/0.1/Haeck-Regular.ttf