Repository navigation
fix(docx): seat what a row's margins leave of a text cell by the height of its lines - #881
Merged
Merged
Conversation
…ht of its lines - What a row's margins leave of a text cell's call, from a tenth of a point up to a half, is moved by the height of the cell's lines: each exact line written shorter and the space after it taller by as much, or the other way as far as that space holds. The cell's content keeps its height and each line its top, and Word and LibreOffice stand the text four fifths of the difference higher or lower. Under half a point nothing moved such a cell before: CobaltRota's staff names, beside the day cells its chips are composed in, stood 0.25pt low in their rows in Word and 0.2pt in LibreOffice. - Only where every paragraph of the cell is one line, in a face whose letters are read, and no nearer the letters' tops and feet than three quarters of a point, where Word cuts an exact line's letters on screen. From half a point up the position moves it, as before. - DocxInk reads the reach of a text set in one style, which the paragraph line's reading now goes through. - Docs: the CHANGELOG entry and a wording fix in the composed chip label entry, the recipe's table paragraph and the capability matrix's table row. - Fidelity: the Word and LibreOffice on Windows baselines rewritten for CobaltRota and LumaStudioInvoice, both nearer the page. - Tests: DocxCellSeatTest covers a cell beside a composed one, several lines, a line made taller from the space after it, what the margins leave of a text row, the letters' foot and top, lines broken in one paragraph, a standard face not embedded and a call under a tenth.
…ove further - The covers row that came out 0.8pt shorter in LibreOffice 24.2 was a probe writing the lines alone shorter, the covers values' composed lines among them; the CHANGELOG entry and seatByTheLines say so. - The CHANGELOG entry counts its corpus at the median, and names the lines that move further: 21 amounts of LumaStudioInvoice and its long version in LibreOffice on Windows, from 0.07-0.09pt low to 0.11-0.13pt high, and 6 in Word, a step of its grid. - DocxCellSeatTest: the class Javadoc names the position and the line trade, the premises read the line as written, and the top-guard test is renamed.
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.
Why
Word and LibreOffice stand an exact line's baseline four fifths of the way down it. The page sets a table cell's line its face's ascent below its top.
moveTheRowsTextcloses the gap for a row of text cells by moving the row's top and bottom margins together, by the least any of its cells calls for. Some rows it does not move:What the margins leave was moved by the text's
w:positionfrom half a point up, and under half a point not at all.CobaltRota's staff names sit beside the day cells its chips are composed in. Measured against their own row's rules, they stood:What changed
In
DocxSemanticBackend:seatByTheLinesmoves what the margins leave, from a tenth of a point to a half, by the height of the cell's lines. Each exact line is written shorter and the space after it taller by as much. Where Word sets the text high, it goes the other way, as far as the space after holds.inkOf); a standard face the export does not embed is read through a stand-in, in that font's units.DocxStackedLines.INK_MARGIN, where Word cuts an exact line's letters on screen, as a composed chip's label is cut.moveTheRowsTextkeeps the position from half a point up. Its order is now position, then line, then nothing.textCellsMeasured), not for every text cell.In
DocxInk:of(String, TextStyle, FontLibrary)andreadInTheLayoutsUnits(TextStyle, FontLibrary)read a text set in one style. TheParagraphLineoverloads now go through them, with the same result.Docs:
CHANGELOG.md(v2.5.0) gets a new entry. It also corrects one sentence of the composed chip label entry: the chips' 0.25pt and 0.15pt offsets are the rows above them; in their own rows the chips stand within a tenth of a point.Verification
./mvnw -B -ntp clean verify→ BUILD SUCCESS: render-docx 1391 run, 0 failures, 1 skipped; qa 1820, core 818, examples 93.DocxCellSeatTest, 23 tests (+9; two existing tests now also assert the line is left as it was). Each new test pins one case:Twelve sabotages, each caught by its own test:
Probe and corpus, measured against the rules of each line's own row:
CobaltRotastaff names (12), before → afterDOCX fidelity corpus, against the committed baselines:
CobaltRotamedian 0.17 → 0.15pt, p90 0.38 → 0.31.LumaStudioInvoice0.14 → 0.11.CobaltRota0.08 → 0.06, p90 0.30 → 0.22.LumaStudioInvoice's long version 0.20 → 0.12.CobaltRota's lines all move nearer. 21 amounts ofLumaStudioInvoiceand its long version, 0.07–0.09pt low in LibreOffice on Windows, stand 0.11–0.13pt high there, and 6, 0.04pt low in Word, stand 0.08pt high, a step of its grid.Notes for review
ConsultingInvoice's amounts stood nearer the page in their rows in LibreOffice: in-row −0.18 → +0.07, Word unchanged at −0.02. But the median went from 0.19 to 0.40pt on Windows. Their rows stand 0.3pt low in both editors, and LibreOffice's overshoot of the position made up for it: it moves text by the position times its face's height to its em, 1.4 for Poppins. The rows' drift is its own change.CobaltRota's median moves from 0.22 to 0.25pt, its p90 unchanged at 0.52, andLumaStudioInvoice's long version's from 0.20 to 0.12; no other document's median moves. 24.2 holds each staff row to its content, a day's block rounded down, so every row is a twip shorter than the page and the rows above the names stand higher. The names, now seated in their rows, no longer make up for that. Each line moves within the fidelity gate's 0.5pt slack, and the DOCX Fidelity check passed on this head, so the Linux baseline is left as it is.CobaltRota's covers values are a composed paragraph, not a text cell, and still stand 0.2pt low in their rows in all three editors. Seating the first line of a composed cell is its own change.Lane: shared-engine (DOCX backend) —
render-docx; no public API.