Repository navigation
feat(engines): paragraph layout and line breaking for the layout engine - #834
Merged
Merged
Conversation
…절 and Latin tailorings Passes all 16,672 cases of Unicode's LineBreakTest.txt (not kept in the repository). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t copy out as the radical ⽂ CJK fonts map both to one glyph and Skia's ToUnicode took the lower code point. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…render harness Itemising, shaping, greedy line breaking (UAX #14 with 한글 어절 / 글자), alignment with justify and distribute, indents, tab stops with leaders, 한글 and Word line height rules, character spacing, ratio, raise, decorations and links, and a simplified bidi. 한글's useFontSpace and useKerning are read into HCharLayout. An interim page flow (Typesetting/FileeRenderer.cs) registers the renderer as DocumentRenderers.Candidate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…languages lacked on builtin-engines Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…re line breaks with 한글's own 한글 writes the setting the other way round from its names: the binary HWP of the same document has the 글자 bit set where the HWPX says KEEP_WORD, and 한글's stored line layout breaks KEEP_WORD paragraphs inside words. HangulLineBreakTests lays out the plain-text paragraphs of a private corpus at the width 한글 used and compares their line starts with the ones 한글 stored (hp:linesegarray). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…font size A space or a character narrowed by 장평 closes up less. With it, the two lines of the issue documents that took one or two characters more than 한글's now break where 한글 broke them (150 of 152 plain paragraphs; the other two are a font that isn't installed and an unbreakable run wider than the line). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and HWPX code now refers to The document asks for the sentence in the product's interface, manuals, help and source: THIRD-PARTY-NOTICES.md (shown on the About page), README, ENGINES.md and the files that use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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: paragraph layout and line breaking": a paragraph goes in, positioned and shaped lines come out. Everything is in
src/Filee.Engines/Typesetting. No converter uses it yet; the render quality harness now measures it against rhwp (DocumentRenderers.Candidateis set).LineBreaker.cs): UAX Add e-book conversion, a built-in HTML reader and a calibre package #14 at Unicode 16.0, rules LB1–LB31.LineBreakTest.txt. I checked that locally and didn't commit the file;LineBreakerTestscovers each rule family instead.breakNonLatinWordKEEP_WORD) keeps Hangul words whole.breakLatinWordBREAK_WORD).w:noLineBreaksBefore/After) are honoured.ParagraphText.cs): the inlines become one string: tabs, line breaks as U+2028, links, bookmarks, and a list marker in front.ParagraphLayout.cs, output inLineBox.cs):condense) lets the spaces shrink to fit.lineWrapKEEP and SQUEEZE hold the paragraph on one line.GlyphRun.Embolden/SkewX.HCharLayoutgainsFontSpaceandKerning, read from HWPXuseFontSpace/useKerning.useKerning="0", the font's kerning is off.FileeRenderer.cs): sections' pages, paragraphs stacked with a new page when full, and headings as the PDF outline. Table cells are stacked as paragraphs for now. The page composer item replaces this flow.Against 한글 itself
HangulLineBreakTests(a private-corpus test, run bybuild/render-compare.ps1) compares where 한글 broke lines with where Filee breaks them.hp:linesegarray).Result on the four HWPX files attached to Filee's issues (#49, #51, #65), kept out of the repository:
The two that differ:
-wider than the line, which 한글 keeps on one line.자간 is a share of each character's own width (장평 applied), not of the font size. A space or a narrowed character closes up less. Before this change, two lines with negative 자간 took one or two characters more than 한글's; now they break where 한글 broke them.
Reader fix: 한글 writes
breakNonLatinWordthe other way round from its names.BREAK_WORDis 어절 andKEEP_WORDis 글자. Two pieces of evidence:KEEP_WORD.KEEP_WORDparagraphs, 한글's stored lines break inside words 6 times in 9 ("외국인등록|번호", "공동이|용을").HwpxReadernow maps it that way;breakLatinWordagrees with its names.Against rhwp (feature matrix, Windows fonts)
The thresholds in
render-thresholds.jsonare today's values, each with its reason.Also: the main sync brought Italian and Indonesian without
error.document_too_complex(abuiltin-engineskey). Both now have it; that is what failed the first CI run.Tests
LineBreakerTests: 34 cases.ParagraphLayoutTests: 38 cases, with the pinned Noto fonts ofbuild/fetch-fonts.ps1. Expected widths come from the shaper, so no magic numbers.FontSubsetterTestscase for the cmap fix.Not in this PR
These have their own board items.
🤖 Generated with Claude Code