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

LibPDF: Add new Type1FontProgram base class

We are planning to add support for CFF fonts to read Type1 fonts, and
therefore much of the logic already found in PS1FontProgram will be
useful for representing the Type1 fonts read from CFF.

This commit moves the PS1-independent bits of PS1FontProgram into a new
Type1FontProgram base class that can be used as the base for CFF-based
Type1 fonts in the future. The Type1Font class uses this new type now
instead of storing a PS1FontProgram pointer. While doing this
refactoring I also took care of making some minor adjustments to the
PS1FontProgram API, namely:

 * Its create() method is static and returns a
   NonnullRefPtr<Type1FontProgram>.
 * Many (all?) of the parse_* methods are now static.
 * Added const where possible.

Notably, the Type1FontProgram also contains at the moment the code that
parses the CharString data from the PS1 program. This logic is very
similar in CFF files, so after some minor adjustments later on it should
be possible to reuse most of it.
This commit is contained in:
Rodrigo Tobar 2023-01-07 12:21:25 +08:00 committed by Andreas Kling
parent e751ec2089
commit 416585f75a
7 changed files with 535 additions and 476 deletions

View file

@ -11,6 +11,7 @@ set(SOURCES
Fonts/TrueTypeFont.cpp
Fonts/Type0Font.cpp
Fonts/Type1Font.cpp
Fonts/Type1FontProgram.cpp
Interpolation.cpp
ObjectDerivatives.cpp
Parser.cpp