Skip to content

Conversation

@BobLd
Copy link
Collaborator

@BobLd BobLd commented Sep 14, 2025

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 TrueTypeFontParser already 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-L62C76

The changes are made to not cause breaking change, but would need a much better test coverage, and potentially some refactoring (e.g. the PdfCidCompactFontFormatFont class cannot be used from TrueTypeFont because it cannot be accessed.

@BobLd BobLd merged commit 44e638e into UglyToad:master Sep 14, 2025
2 checks passed
@BobLd BobLd deleted the true-type-font-cff branch September 14, 2025 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong font rendering

1 participant