Repository navigation
feat(render): render quality harness for the layout engine - #693
Merged
Merged
Conversation
…against rhwp Measures a document renderer without sample files in the repository (Project 4, M0): - Feature matrix written in code (RenderFeatures): line spacing kinds x alignment, tabs, lists, tables, headers and footers, notes, columns, floating objects, equations and paragraphs in eight scripts, through the HWPX writer or DocxBuilder and the DOCX reader; binary HWP twins made with rhwp convert. - Read-back checks with PdfPig, one tested function each (PdfChecks): text round trip, overlapping glyphs (> 0.05 em), glyphs outside the page and the margins, page count, baselines (±0.5 pt), fonts embedded and subset. - Differential compare (RenderDiff): page count, line-break agreement (Myers LCS over lines), baselines and per-page SSIM of PDFium pictures at 100 dpi; proven by rhwp against itself and by perturbed renderings. - Thresholds and an allow-list for known rhwp defects in render-thresholds.json; a worse value fails the test. - One seam for the layout engine (DocumentRenderers.Candidate); its compare is skipped until it is registered. - build/render-compare.ps1: a private corpus (FILEE_RENDER_CORPUS, doc.hwpx + the PDF 한글 printed) to an HTML report in the temp folder. PdfPageWriterTests now share the checks, SSIM and the HarfBuzz test shaper (TestShaper) with the harness. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 of 12 tasks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # tests/Filee.Engines.Tests/PdfPageWriterTests.cs
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?
The render quality harness of Project 4 ("Layout engine: render quality harness", M0). It measures a document renderer
against rhwp today, with no sample or reference file in the repository, and Filee's layout engine plugs in at one
seam (
DocumentRenderers.Candidate) when its first milestone lands. Documented indocs/RENDER-QUALITY.md, linkedfrom
docs/ENGINES.md.RenderFeatures): line-spacing kinds × alignment, tabs, lists, tables,headers/footers, notes, columns, floating objects × wrap, equations, and paragraphs in Korean, Chinese, Japanese,
Arabic, Hebrew, Devanagari, Gujarati and Thai. The documents are built as an
HDocument(written by the HWPXwriter) or with
DocxBuilder(through the DOCX reader). Binary HWP twins are made withrhwp convert.PdfChecks): text round trip, overlapping glyphson a line (> 0.05 em), glyphs inside the page and the body inside the margins, page count, baselines ±0.5 pt, fonts
embedded and subset.
RenderDiff): page count, line-break agreement (Myers LCS over lines), baselines, andper-page SSIM (own small implementation) of PDFium pictures at 100 dpi. It is proven by rhwp against itself
(identical) and by perturbed renderings: shifted 2 pt, and re-wrapped by a wider margin.
render-thresholds.json: what rhwp reaches where it falls short of the ideal, and an allow-listfor the layout engine's compares where rhwp is wrong. A worse value fails the test. A better one is reported, so
the threshold can be raised.
build/render-compare.ps1runs a private corpus outside the repository (FILEE_RENDER_CORPUS,doc.hwpx+the PDF 한글 printed) and writes an HTML report to %TEMP%.
PdfPageWriterTestsnow share the checks, SSIM and the HarfBuzz test shaper (TestShaper), and the feat(engines): PDF backend spike: font subsetter and Skia page writer #683 acceptancepage passes the read-back checks too.
No new packages or programs: PdfPig, PDFtoImage/PDFium, SkiaSharp and PDFsharp only. rhwp is only the reference in
tests.
rhwp 0.8.7 today (CI matrix)
Every check meets the ideal for the line-spacing rules (lines exactly one pitch apart), tabs, lists, tables,
headers/footers, notes, columns, Korean, Chinese and Japanese. Every font is embedded and subset, and the HWP
renderings of
line-spacing-percent,tablesandscript-koare identical to their HWPX ones. Below the ideal(overlaps are the share of neighbouring glyph pairs):
The full run (
FILEE_RENDER_FULL=1) found that rhwp's rendering of the HWP twin of Chinese and Japanese paragraphsdraws 。 and 、 half an em over the next character. No line breaks where the HWPX rendering breaks (SSIM 0.23 and
0.19), and the equations are placed differently.
Type of change
How was it tested?
dotnet format --verify-no-changesdotnet test:tests/Filee.Engines.Testsin Release, 2004 passed. The harness class takes about 25 s (thematrix 15 s, the perturbed compare 6 s, the self-compare 2 s), and the building-block tests about 3 s. The full
run takes about 70 s.
build/render-compare.ps1on a scratch corpus outside the repository (rhwp PDFs standing in for 한글's).Checklist
src/Filee.App/Assets/i18n/*.jsonfiles (none)THIRD-PARTY-NOTICES.md(none)🤖 Generated with Claude Code