1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:27:45 +00:00

LibGfx+icc: Add ICCProfile support for textDescriptionType and print it

This is used in v2 profiles for the required 'desc' tag. In v2
profiles, it's also used by the 'dmnd', 'dmdd', 'scrd', 'vued' tags.

In v4 profiles, these all use 'mluc' instead (except for 'scrd', which
is no longer part of the spec in v4).
This commit is contained in:
Nico Weber 2023-01-22 21:49:05 -05:00 committed by Linus Groh
parent 8272cfc9f3
commit e7eccf4ac8
3 changed files with 186 additions and 1 deletions

View file

@ -18,7 +18,7 @@ static ErrorOr<String> hyperlink(URL const& target, T const& label)
}
template<class T>
static void out_optional(char const* label, Optional<T> optional)
static void out_optional(char const* label, Optional<T> const& optional)
{
out("{}: ", label);
if (optional.has_value())
@ -102,6 +102,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
record.iso_3166_1_country_code >> 8, record.iso_3166_1_country_code & 0xff,
record.text);
}
} else if (tag_data->type() == Gfx::ICC::TextDescriptionTagData::Type) {
auto& text_description = static_cast<Gfx::ICC::TextDescriptionTagData&>(*tag_data);
outln(" ascii: \"{}\"", text_description.ascii_description());
out_optional(" unicode", MUST(text_description.unicode_description().map([](auto description) { return String::formatted("\"{}\"", description); })));
outln(" unicode language code: 0x{}", text_description.unicode_language_code());
out_optional(" macintosh", MUST(text_description.macintosh_description().map([](auto description) { return String::formatted("\"{}\"", description); })));
} else if (tag_data->type() == Gfx::ICC::TextTagData::Type) {
outln(" text: \"{}\"", static_cast<Gfx::ICC::TextTagData&>(*tag_data).text());
}