Repository navigation
feat(engines): PDF backend spike: font subsetter and Skia page writer - #683
Merged
Merged
Conversation
A CID-keyed CFF font whose Top DICT and font dictionary both carry a units-per-em scale (Top DICT 1/2048, font dictionary 1/1000, as in Pretendard) had the two scales multiplied, so OTF -> TTF and EOT drew every glyph a thousand times too small. The product is now scaled back by the smaller units-per-em of the two. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…renderer
The PDF backend spike of Project 4 ("Layout engine: PDF backend and font
subsetting spike"):
- Fonts/FontSubsetter: glyph-ID-preserving TrueType subsets (composite
components, hinting kept; CFF converted first, only the used glyphs;
variable fonts become their default instance), with Fonts/CmapTable to
read and write the character map.
- Rendering/PageContent, PageFont, PdfPageWriter: a page record of shaped
glyph runs (text + clusters), Skia drawing, links and destinations, written
through SKDocument.CreatePdf with one subset per font and document;
right-to-left runs in logical order; exact page sizes and the outline
added with PDFsharp.
- docs/ENGINES.md: measurements of option A (Skia + own subsetter) and
option B (own page writer on PDFsharp) and the recommendation (A), for
the maintainer to confirm.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this change?
Implements the Project 4 item "Layout engine: PDF backend and font subsetting spike" (M0, P0). Both PDF backends were prototyped on one mixed A4 page (Korean, Latin, Arabic, Devanagari). This PR keeps the recommended one, option A: Skia's PDF backend with fonts subset by Filee. Option B, a page writer of Filee's own on PDFsharp's low-level objects, is described in docs/ENGINES.md with its numbers; its prototype code is not in the PR.
The decision is a recommendation for the maintainer to confirm (README → "Decisions to make" #1).
Fonts/FontSubsetter.cs(+Fonts/CmapTable.cs): glyph-ID-preserving TrueType subsets. Composite components and hinting are kept. CFF fonts are converted to TrueType first, only the used glyphs (CffToTrueTypegained anonlyfilter). Variable fonts become their default instance. CFF2 and colour fonts are refused with a reason.Rendering/PageContent.cs,PageFont.cs,PdfPageWriter.cs: the minimal page-writer API for the later layout work.SKDocument.CreatePdfwithSKPositionedTextRunBuffer, so Skia writes ToUnicode and/ActualText.PageContent.Drawrenders PNG pages.Measured (details in docs/ENGINES.md → "Filee renderer: PDF output")
XXXXXX+tag). Without the subsetter, Skia embeds one line of Malgun Gothic as a 7.45 MB PDF and draws variable and CFF fonts as Type 3.FileeTest-CID.otf(a Noto Sans KR OTF subset) and by Pretendard locally.FILEE_RENDER_OUT=<folder>keeps the test PDFs for a manual look.Open questions
Type of change
How was it tested?
dotnet format --verify-no-changesdotnet test(Filee.Engines.Tests: 1843 passed, 193 skipped;dotnet build Filee.slnx -c Releaseclean)Checklist
src/Filee.App/Assets/i18n/*.jsonfiles (none)THIRD-PARTY-NOTICES.md(none)🤖 Generated with Claude Code