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

LibPDF: Add spec comments, dbgln_if()s to CFF's parse_encoding()

This commit is contained in:
Nico Weber 2023-10-16 16:18:22 -04:00 committed by Andreas Kling
parent c41e742de4
commit 37daeae6fd

View file

@ -719,12 +719,16 @@ PDFErrorOr<Vector<u8>> CFF::parse_encoding(Reader&& reader)
auto format = format_raw & 0x7f; auto format = format_raw & 0x7f;
if (format == 0) { if (format == 0) {
// CFF spec, "Table 11 Format 0"
auto n_codes = TRY(reader.try_read<Card8>()); auto n_codes = TRY(reader.try_read<Card8>());
dbgln_if(CFF_DEBUG, "CFF encoding format 0, {} codes", n_codes);
for (u8 i = 0; i < n_codes; i++) { for (u8 i = 0; i < n_codes; i++) {
TRY(encoding_codes.try_append(TRY(reader.try_read<Card8>()))); TRY(encoding_codes.try_append(TRY(reader.try_read<Card8>())));
} }
} else if (format == 1) { } else if (format == 1) {
// CFF spec, "Table 12 Format 1"
auto n_ranges = TRY(reader.try_read<Card8>()); auto n_ranges = TRY(reader.try_read<Card8>());
dbgln_if(CFF_DEBUG, "CFF encoding format 1, {} ranges", n_ranges);
for (u8 i = 0; i < n_ranges; i++) { for (u8 i = 0; i < n_ranges; i++) {
// CFF spec, "Table 13 Range1 Format (Encoding)" // CFF spec, "Table 13 Range1 Format (Encoding)"
auto first_code = TRY(reader.try_read<Card8>()); auto first_code = TRY(reader.try_read<Card8>());