mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:27:45 +00:00
LibPDF: Implement support for callgsubr in CFF font programs
Font programs are bytecode programs defining glyphs. If several glyphs share a piece of outline, that opcode sequence can be put in a subroutine ("subr") table and the definition of those glyphs can then call that subroutine by number, to reduce file size. CFF fonts can in theory contain multiple fonts, and so there's a global subr table shared by all the fonts in one CFF, and a local per-fornt subr table. We used to only implement the local subr table, now we implement both. (We only support one font per CFF, and at least in PDF files, that's all that's ever used. So a global subr table isn't very useful. But the spec explicitly allows it -- "Global subroutines may be used in a FontSet even if it only contains one font." -- and it happens in practice.)
This commit is contained in:
parent
185573c03f
commit
3907374621
5 changed files with 15 additions and 11 deletions
|
@ -92,7 +92,7 @@ PDFErrorOr<void> PS1FontProgram::parse_encrypted_portion(ByteBuffer const& buffe
|
|||
reader.move_by(encrypted_size);
|
||||
auto glyph_name = word.substring_view(1);
|
||||
GlyphParserState state;
|
||||
TRY(add_glyph(glyph_name, TRY(parse_glyph(line, subroutines, state, false))));
|
||||
TRY(add_glyph(glyph_name, TRY(parse_glyph(line, subroutines, {}, state, false))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue