mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 18:14:58 +00:00
LibPDF: Implement support for CFF charset format 2
I haven't seen this being used in the wild (yet), but it's easy to implement, and with this we support all charset formats. So we can now mention if we see a format we don't know about.
This commit is contained in:
parent
5b915fb15c
commit
6f783929dd
1 changed files with 12 additions and 0 deletions
|
@ -637,6 +637,18 @@ PDFErrorOr<Vector<DeprecatedFlyString>> CFF::parse_charset(Reader&& reader, size
|
||||||
for (SID sid = first_sid; left >= 0; left--, sid++)
|
for (SID sid = first_sid; left >= 0; left--, sid++)
|
||||||
TRY(names.try_append(resolve_sid(sid, strings)));
|
TRY(names.try_append(resolve_sid(sid, strings)));
|
||||||
}
|
}
|
||||||
|
} else if (format == 2) {
|
||||||
|
// CFF spec, "Table 20 Format 2"
|
||||||
|
// "Format 2 differs from format 1 only in the size of the Left field in each range."
|
||||||
|
while (names.size() < glyph_count - 1) {
|
||||||
|
// CFF spec, "Table 21 Range2 Format"
|
||||||
|
auto first_sid = TRY(reader.try_read<BigEndian<SID>>());
|
||||||
|
int left = TRY(reader.try_read<Card16>());
|
||||||
|
for (SID sid = first_sid; left >= 0; left--, sid++)
|
||||||
|
TRY(names.try_append(resolve_sid(sid, strings)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dbgln("CFF: Unknown charset format {}", format);
|
||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue