mirror of
https://github.com/RGBCube/serenity
synced 2025-06-14 15:32:07 +00:00
LibGfx: Use x-mac-roman TextCodec for decoding MacRoman text
This commit is contained in:
parent
eac2b2382c
commit
55e45856ae
1 changed files with 1 additions and 11 deletions
|
@ -834,17 +834,7 @@ ErrorOr<NonnullRefPtr<TextDescriptionTagData>> TextDescriptionTagData::from_byte
|
||||||
if (macintosh_description_data[macintosh_description_length - 1] != '\0')
|
if (macintosh_description_data[macintosh_description_length - 1] != '\0')
|
||||||
return Error::from_string_literal("ICC::Profile: textDescriptionType ScriptCode not \\0-terminated");
|
return Error::from_string_literal("ICC::Profile: textDescriptionType ScriptCode not \\0-terminated");
|
||||||
|
|
||||||
bool is_ascii = true;
|
macintosh_description = TRY(String::from_deprecated_string(TextCodec::decoder_for("x-mac-roman")->to_utf8({ macintosh_description_data, (size_t)macintosh_description_length - 1 })));
|
||||||
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");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
dbgln("TODO: ICCProfile textDescriptionType ScriptCode {}, length {}", scriptcode_code, macintosh_description_length);
|
dbgln("TODO: ICCProfile textDescriptionType ScriptCode {}, length {}", scriptcode_code, macintosh_description_length);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue