1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:18:12 +00:00

LibGfx: Use x-mac-roman TextCodec for decoding MacRoman text

This commit is contained in:
Nico Weber 2023-01-24 08:55:51 -05:00 committed by Linus Groh
parent eac2b2382c
commit 55e45856ae

View file

@ -834,17 +834,7 @@ ErrorOr<NonnullRefPtr<TextDescriptionTagData>> TextDescriptionTagData::from_byte
if (macintosh_description_data[macintosh_description_length - 1] != '\0')
return Error::from_string_literal("ICC::Profile: textDescriptionType ScriptCode not \\0-terminated");
bool is_ascii = true;
for (u32 i = 0; i < macintosh_description_length; ++i) {
if (macintosh_description_data[i] >= 128)
is_ascii = false;
}
if (is_ascii) {
macintosh_description = TRY(String::from_utf8(StringView { macintosh_description_data, (size_t)macintosh_description_length - 1 }));
} else {
dbgln("TODO: ICCProfile textDescriptionType non-ASCII MacRoman");
}
macintosh_description = TRY(String::from_deprecated_string(TextCodec::decoder_for("x-mac-roman")->to_utf8({ macintosh_description_data, (size_t)macintosh_description_length - 1 })));
} else {
dbgln("TODO: ICCProfile textDescriptionType ScriptCode {}, length {}", scriptcode_code, macintosh_description_length);
}