Add initial support to process CFF fonts contained inside a TrueType font #1159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes BobLd/PdfPig.Rendering.Skia#46
Prior to this change, we were not parsing the CFF font embedded in a True Type font.
There's only a check for the CFF signature here:
https://github.com/UglyToad/PdfPig/blob/304d7dde5ac70ab07da6989812dbd913ea55298d/src/UglyToad.PdfPig/PdfFonts/Parser/Parts/CidFontFactory.cs#L112C1-L117C26
This only tackle the case where the True Type font is in fact a CFF font.
This PR addresses the case where the CFF font is inside the True Type font. The
TrueTypeFontParseralready check if the font contains a CFF table, but was not parsing it: The https://github.com/UglyToad/PdfPig/blob/304d7dde5ac70ab07da6989812dbd913ea55298d/src/UglyToad.PdfPig.Fonts/TrueType/Parser/TrueTypeFontParser.cs#L62C13-L62C76The changes are made to not cause breaking change, but would need a much better test coverage, and potentially some refactoring (e.g. the
PdfCidCompactFontFormatFontclass cannot be used fromTrueTypeFontbecause it cannot be accessed.