Repository navigation
docs(layout): name the remaining public boundaries (#510) - #542
Merged
Merged
Conversation
First piece of #510. The six Margins members reach the geometry unchecked, and the audit in the issue described them as having three behaviours between them. Measured, that is not what they have. The outcome depends on which edge carries the value and which non-finite value it is, and across six members, two edges and three values there are four outcomes, with every member showing at least two of them across its own inputs. Documenting that member by member means writing a thirty-six cell table in prose, which is the shape that cost ListElement.Indent seventeen review rounds. The rule underneath is one sentence. ValidateInsets has exactly two reaching call sites in src/, LineSeparatorRenderer and LayoutValidation.ValidateCell, so LineSeparator.Margins and Cell.Padding are the only validated insets in the package and every other one arrives as given. That is what the six members say, with the consequence a caller can act on: no refusal names this property, and none of the outcomes is reported. The negative case needed the same treatment and nearly did not get it. A first draft said a negative inset widens the area and places content outside the page, which is true of Paragraph, Heading and ListElement, and false twice over: TableElement widens the table rather than moving content off the page, and PieChart clamps, staying on the page at minus five thousand. LayoutImage discards a negative left inset entirely. So the members say a negative inset is arithmetic on the available area rather than a placement instruction, and that what a renderer does with that area is what you get. This block is byte-identical across the six, which is correct here because the rule genuinely is one rule; it is also why the negative-case error would have shipped six times. Not reviewed. The measurements behind it are on #510. 0 warnings, format clean, clean-room clean.
The six element margins were already on this branch. This commit covers the rest of the measured table: Encrypt with object streams, font load path exceptions, Justify as left on a single box, empty tables, the 50,000 continuation cap on IRenderer, unvalidated Language and LinkUri, FromHex ignoring the top byte, and FontReference's invalid reads. LoadTrueTypeFont throws FileNotFoundException for a missing file and DirectoryNotFoundException for a missing directory, from that call rather than from Save. A custom overflow that never advances throws at 50,000 continuations. An all-header table still hits the too-tall path (#488).
Output intents, Dispose, MeasureString, DrawContext URI/outline, paragraph and heading Justify, SetDefaultFont's null, DocumentRenderer geometry, and RunningBand.Resolve. SetDefaultFont(null) does not throw: Add(string) still uses TextStyle.Default.
Empty and whitespace Language values are omitted after trim, not written. A mixed table with an empty row among filled rows saves. Paragraph Justify is not the one consumer: headings honour it too. UseTrueTypeFont(null) is ArgumentNullException.
Null Add overloads, DrawContext helpers, storage properties, and renderer Draw methods. Record positional properties carry the boundary on the type and on the primary-constructor params. Dual summaries were not left in.
Add(string) with null returns; Save throws from word-wrap. Paragraph(string) stores a null text. RegisterImageXObject(null) throws ArgumentNullException here. DrawContext.Canvas can be null if the constructor was given null.
Enums, renderers, elements, and the remaining constructors. Record positional properties stay documented on the type and the primary constructor params: the compiler does not emit a remarks element for those.
Positional records only emit constructor param text for R, Top, X and the rest, so IntelliSense never saw a remarks block. Reconstruct them as explicit properties with the same constructors and Deconstruct, PublicAPI unchanged.
…tring) Those four implicit operators and the string AddChild overload were the last PublicAPI.Shipped members without a remarks block. LayoutBox.ToString too. Internal types are not the public surface.
13b1c72 rewrote ColorRgb, ColorCmyk, EdgeInsets, LayoutBox, BandTruncationWarning and PieSlice from positional declarations to explicit properties so each property could carry remarks. Nothing checked that the rewrite kept what callers observe. These known answers pin ToString, equality, with, Deconstruct order and the PieSlice label default. They pass on 574c62b, where the records are still positional, and on this branch. Each of four mutations (a swapped Deconstruct out, a reordered property, a dropped Label assignment, a swapped constructor channel) fails exactly one of them. ApiCompat 10.0.401 in strict mode, with the parameter-name rule, finds no breaking change between the published 2.3.2 VellumPdf.Layout.dll and this branch. With the attribute rule on, it reports the six Deconstruct methods losing [CompilerGenerated], and the three async state machines on Document renamed: the explicit Document() constructor shifts their ordinals, and removing it restores the 2.3.2 names. LayoutBox.ToString formats in the current culture; one test pins that under nl-NL.
Four review lenses read #542 at 9bc9ff8. In Core they found statements that the source or a probe contradicts, among them: - LayoutContext.ContentTop claimed the paginator uses it. Nothing in src/ reads it, and every LayoutContext the document builds passes 0. - Outcome.Nothing claimed "taller than a single page". The paginator retries on a new page and throws only when the retry is Nothing too. - LayoutBox.IsEmpty claimed a NaN component makes it false. With the other extent at zero or below it is true. - LayoutBox.ToString claimed the invariant culture. It formats in the current culture, now pinned by a test. - EdgeInsets claimed the consumers that write an inset refuse it. Only LineSeparator.Margins and Cell.Padding check an edge. - HorizontalAlignment claimed a cell is an unbreakable box. The rule is the switch: each of the six consumers places Center and Right and starts anything else at the left, and only paragraph text justifies. The ignored sets were added where a probe showed the call succeeding with a different result: a font handle from another document, a null handle, a Standard14 value the enum does not name, the Font/FontRef initialiser order, a null link URI, outline levels without a parent, and the parts of a LayoutResult the paginator never reads. Every exception the reviews measured escaping a Core member now has a tag naming the call that raises it. Boilerplate that only pointed at the type remarks is replaced by what that member does.
The four lenses on #542 found the element members wrong in the same few ways, so each is fixed as a class, with one wording used everywhere it applies. Null arguments. About twenty members said a null "is stored" and stopped. Measured at 9bc9ff8, each one makes the save throw NullReferenceException far from the call; TextRun.Style said layout "uses it as given", which was false. Each now says so, carries the tag, and says a later major will refuse it. Cell content is the odd one: it throws only when a column is auto-sized. The class is #547. Margins. The block shared by six elements claimed two outcomes "either way". Probes found the element dropped from the page, text re-wrapped, an image mirrored, and later elements moved; a top edge of negative infinity reaches a heading's bookmark as ArgumentException. It now gives the mechanism (edges come off the area, whatever box is left is laid out), the classes of outcome, and tags for both exception types. Renderers. A renderer's Layout raises its element's refusals itself; the document calls it during a save. Each Layout now carries those tags, each constructor says what a null or out-of-range start does, and the 50,000-continuation sentences on the image and pie renderers are gone in favour of the one on IRenderer.Layout. Also: Paragraph.Text concatenates every run, PieSlice.Label feeds the composed alternate text, Justify also stretches lines that end in a hard break, element Language is trimmed and dropped when blank, the column-width rule comes from TableGridResolver, StartAngle is not reduced (#546), nested bullets draw as ? in the standard-14 fonts (#545), and no table row can carry a background (#543).
The contract lens on Document, DocumentRenderer and RendererContext found five statements a probe contradicts, each reproduced at 9bc9ff8: - Save said reaching the writer leaves a document dead. The kernel checks a null destination, object streams with Encrypt, and the PDF/A and PDF/UA-1 encryption pairings before it marks the document written, and after the layout has added its pages. A one-page document retried after Save(null) saved two pages (#530). The remarks now give the rule: only the geometry checks run before the layout. - The class example set a default font and then added a Paragraph, which never reads it. Only a later Add(string) does; SetDefaultFont now says so, and the example uses Add(string). - UseTrueTypeFont said a bad buffer throws InvalidDataException. A missing cmap throws InvalidOperationException from the call, a missing glyf passes the call and throws at save, and a CFF OpenType font is accepted. - PDF/UA-1 with Encrypt and no PdfPermissions.Extract throws at save. Conformance, Encrypt and every save overload now name it, citing ISO 14289-1 7.16, read from the local copy. - DocumentRenderer.Render carried one exception tag. It now carries six: the four raised through it here (InvalidOperationException, ArgumentException, ArgumentNullException, NullReferenceException) and the two the review measured from the kernel's own checks. Also: Tagged reads true under PDF/UA-1 as well as PDF/A-2a, the output intents are written only when Conformance is set, LoadTrueTypeFontAsync faults its task rather than throwing, Encrypt throws after Dispose, a signed document ignores UseObjectStreams, and RendererContext says what a null or foreign page does.
The #510 entry was written in review vocabulary ("the ignore set is in", "unread insets") and described a cell as an unbreakable box. It now lists the boundaries a caller is likely to act on, each with its issue. Two sentences in the #526 entries stopped being true once the Save remarks were corrected: a refusal from the kernel's checks before writing leaves the document alive rather than dead, and Conformance and Encrypt now document the PDF/A pairing themselves. Both are in the unreleased section, and the diff against every released section is empty. The record rewrite gets a Changed entry, since it is a source change to six shipped types even though nothing a caller observes moved.
Round 2 read 6d480ef with the same four lenses. The behaviours below were measured by a lens and reproduced here with a separate probe, or read from source where the claim is about code paths (the double-counted gap, the parent-style fallback, the missing Symbol widths). The save remarks listed which failures leave a document clean, alive or dead, and the list was wrong again: with a header or footer set, a refusal fires in the page-counting pass before any page exists, and the retry is still wrong because the elements keep state from the failed attempt. The remarks now give the one rule that held in every case, a retry can succeed on a wrong file, and the advice to build a fresh Document. The changelog entry for #530 is cut the same way. Also corrected: - Justify with a standard-14 font stretches a line by half its free space, because each space is counted as two gaps (#548). - A nested list item with no style inherits its parent's, not the list's DefaultStyle. - A text element's bottom margin adds no space below it; an image's and a pie chart's do, and their horizontal margins are clamped back inside the content box instead of shrinking them. - A null run style throws only on a run whose text holds a word. - "Do not pass null" named the nullable style on seven members; it now names the text or template it means. - A non-finite OccupiedArea.Bottom is handed to the next element rather than forcing a new page, and a Nothing from the first element on a page leaves that page blank. - Symbol and ZapfDingbats measure zero, so their text never wraps. - The save overloads carry IndexOutOfRangeException and InvalidDataException, a font whose outlines are malformed fails the save even when unused, and a cancelled LoadTrueTypeFontAsync ends Canceled rather than Faulted. - Renderer start indices, cell line breaks, SetColumnWidths(null), the stroked radius of an empty pie, and RendererContext's null page.
Round 3 read ecc5286 with the same four lenses. Each behaviour below was measured by a lens and reproduced here with a separate probe first. ecc5286's message lists cell line breaks among its corrections, but the script that applied it stopped at an earlier file, and Cell.cs and Row.cs were never edited. Those three edits are here: Cell.Content now says a line feed, carriage return or tab is written into the cell as it is, Row.IsHeader says "cannot be drawn", and its tag says "property". Where the font and render docs kept listing exception causes, and each round found another, they now state what the call checks and name the types the rest raises at save. UseTrueTypeFont reads the table directory and eight tables, throwing NotSupportedException for a cmap with no format 0, 4 or 6 subtable; it does not check every value or read the outlines, so an accepted font can still fail the save, a unitsPerEm of 0 as ArgumentException. DocumentRenderer.Render now carries the tags Document.Save does, since a save is a render. Also corrected: - An element exactly as tall as the content area can loop until the continuation limit, because the first call and the retry offer heights one rounding step apart (#549). - Paragraph.Add throws from the call when the first run is null and no style is given. - A StartAngle of 1e15 leaves a gap at the rim; "draws correctly" was wrong. - A list's bottom edge at negative infinity sends the next element to a new page, and its Margins ArgumentException tag was unreachable. - GetFont throws once the resource is selected, text or not, and an undefined Standard14 on an empty table cell throws too. - A font handle from another document draws correctly only when the saving document registered the same file under the same name. - LineSeparator's too-tall refusal and negative edges, a closed SaveAsync destination, an undefined Conformance stamped as PDF/A-2b, and the order implied by "called on a PDF/A document". - The #530 changelog entry quoted save wording that never shipped.
Round 4 found 4 high and 18 medium defects in the text 0f52934 left. Each change below was reproduced against the branch's code before it was written; the probes are scratch files, not tests. - ListElement.Margins: the ArgumentException tag round 3 removed is back, scoped to the only case measured to reach it: a list with no items, a top edge of negative infinity, and a later Heading. NaN and positive infinity on the same list, and negative infinity on a one-item list, do not raise it. The round-3 sentence saying a negative-infinity bottom edge sends the next element to a new page was measured with a paragraph after it only; a separator after it writes NaN on the same page. It is cut to the rule. - ListRenderer: a negative start on an empty list lays out as Full with no height, and Draw then throws ArgumentOutOfRangeException. Draw now has the tag and the constructor's tag names it. - SaveAsync: the cancellation tag said catching OperationCanceledException covers every moment. A cancellation before the layout, during it, or during serialisation ends the task with TaskCanceledException before the destination is written (the kernel's MemoryStream.CopyToAsync returns cancelled without calling the destination's WriteAsync); only during the write does the destination stream decide what is raised. - Save overloads and DocumentRenderer.Render now say that renderer, font and destination exceptions pass through, add an IOException tag for a failed write to a stream, and name a registered font's unwritable metric (a unitsPerEm of 0 gives ArgumentException with ParamName "value"). - Save(string)/SaveAsync(string): ArgumentException is for an empty, white-space-only or NUL-bearing path; a character such as '<' gives IOException, and a location you may not write to gives UnauthorizedAccessException. Each was measured. - The IndexOutOfRangeException tags said text "is drawn in" an undefined Standard14 value; an empty table cell or list item raises it too, so they now say the value is selected on a page. The four band members on Document and the two on DocumentRenderer gained the tag; an empty band template saves without it. - FontReference, TextStyle.FontRef and the CHANGELOG now give one condition for a handle from another document: only the characters the saving document's own text in the same font file also uses survive. Measured with a superset and a subset of the foreign text. - LayoutImage.Margins: with Width null, edges that leave a drawn width of zero, under 5e-6, or non-finite raise the image-extent message rather than the too-tall one. - Smaller: DocumentRenderer.Add gains its InvalidOperationException tag; PageSize, Conformance, LineSeparator.Margins and PieChart.Slices get their "Do not" paragraph as its own paragraph; LayoutResult.Partial no longer says "refused"; the rounding-step sentence on LayoutContext.Area no longer says only the shorter case matters; percent-encoding of non-ASCII link URIs is stated; Dispose names UseTrueTypeFont and UseCmykOutputIntent as still accepted; PieChart says a zero slice is not stroked; merged tag lines are split and two CHANGELOG lines rewrapped. The count of public members with an <exception> tag moves from 113 to 114 (ListRenderer.Draw), counted in the compiler's XML output.
Round 5 found 4 high and 17 medium defects in the text f720527 left. Each change below was reproduced against the branch's code before it was written; the probes are scratch files, not tests. - The six Margins ArgumentException tags blamed only a later Heading's bookmark. Linked text raises the same exception: its link rectangle is written outside the content stream too, from the element itself or from a later one, and a Heading raises it from its own bookmark with nothing after it. The tags now give that mechanism. They also said "non-finite", but NaN and positive infinity on the top edge give the too-tall error or save; negative infinity, or NaN on the left edge of linked text, is what reaches ArgumentException. - LayoutResult.Full gains an ArgumentException tag, and OccupiedArea says that the elements after a non-finite Bottom can write NaN or Infinity, be left out of the file without an exception, or make the save throw. Measured: -Infinity then a Heading throws; +Infinity or -Infinity then a table drops the table's text. - IRenderer.Layout: a null return makes the save throw NullReferenceException; the member now says so and has the tag. - SaveAsync: the summary said the token is honoured during the final write, which the cancellation tag contradicts; the clause is cut. The tag's "all three end with TaskCanceledException" does not hold when a cancellation during serialisation meets a closed or non-writable destination: MemoryStream.CopyToAsync checks the destination before the token, so that stream's own exception is raised. The path overload gets its own shorter tag. - Unpaired surrogates: text in an embedded font holding one, high or low, in a paragraph, heading, cell, list item or band, makes the save throw ArgumentException with ParamName "s". TextStyle.FontRef carries the tag; FontReference points to it; the band members and the save and Render tags state it. - TextStyle.LinkUri and DrawContext.AddUriLinkAnnotation: a link makes a PDF/UA-1 document fail ISO 14289-1 7.18.5 and 7.18.1 in veraPDF 1.30.2 (the same file without the link passes). Filed as #550. Non-ASCII is percent-encoded as UTF-8, and an unpaired surrogate becomes U+FFFD. - Document.PageSize and the DocumentRenderer constructor: a rectangle not at the origin is written to /MediaBox but layout starts at (0, 0), so the content shifts by the corner's offset, off the page once that exceeds the margins (measured: offset 100, margins 10). DocumentRenderer's constructor gains a "Do not pass" paragraph for a null pdf, negative, NaN or negative-infinity margins, and such a rectangle. - DocumentRenderer.Render: a linearized kernel document reports a non- writable destination as NotSupportedException, not ArgumentException. - SetHeader, SetFooter and RunningBand.Alignment: Justify and values the enumeration does not name are drawn left-aligned. - DrawContext's constructor: a null page is written silently as the page of each structure element it registers, rather than surfacing later. - LayoutImage.Margins: the extent refusal also covers a derived height under the floor, and the threshold is a magnitude (a width of -100 saves). - LineSeparator.LineWidth: a negative width is subtracted from the height the separator takes, moving later elements up and, at -1000 on A4, off the page. - Row.Background and its CHANGELOG line no longer say no row can have a background; a cast of Rows gives one. They now name AddRow and AddHeaderRow. - Dispose now states the rule: only Encrypt, the saves and signing check for disposal; every other member works and what it adds is lost. - Smaller: EdgeInsets says no property refuses a finite negative edge; ContentTop is "acted on" by nothing; the too-tall wording on the all- header remarks defers to the tags; pronoun objects in two "Do not" paragraphs are named; font-metric wording is one phrase; the pie's composed alternate text on overflow is stated. The count of public members with an <exception> tag moves from 114 to 115 (LayoutResult.Full), counted in the compiler's XML output.
Round 6 found 3 high and 27 medium defects in the text af2b61a left. Each change below was reproduced against the branch's code before it was written; the probes are scratch files, not tests. No code line changes. - Unpaired surrogates: round 5 tagged the save, the bands and FontRef, but the throw also comes from TextStyle.MeasureString, FontReference.MeasureString, and the Layout methods of the paragraph, list and table renderers (each measured with a high or low surrogate in an embedded font; a standard-14 font measures such text without an exception). Every public member that takes text to be drawn now carries the tag: Paragraph, Paragraph.Add, Heading, ListItem, ListItem.AddChild, ListElement.Add(string), Cell, Row.AddCell(string), TextRun, RunningBand and its Template, and Document.Add(string). A band throws only when the surrogate falls inside the part that fits the band; a truncated band saves. - Document.Margins (text from before this PR): NaN and negative infinity do not all raise InvalidOperationException. On the left edge they save and write NaN or -Infinity into the text matrix, and negative infinity at the bottom saves every element onto one page, with 147 of 200 paragraphs below it. The remarks now give one rule per edge; the #526 CHANGELOG sentence repeating the old claim is corrected too. - LayoutResult.Full's tag named any non-finite Bottom; only negative infinity reached ArgumentException, while NaN and positive infinity moved a following heading or paragraph to a new page. Partial gains the 50,000-continuation InvalidOperationException tag. - Both Add(IRenderer) overloads, and the saves' NullReferenceException tags, now cover a renderer returning a null result or a Partial with a null renderer. - The Document constructor and Dispose listed what a save reports first, and both lists missed measured cases (a null destination, a cancelled token, a path save that truncates the file before throwing). They now defer to the save's own order. Dispose's summary no longer says it releases resources: the kernel only sets a flag. - SaveAsync: a cancellation during the layout with a null destination raises ArgumentNullException first. Render: a linearized kernel document reports a closed destination as ObjectDisposedException. - PageSize: a rectangle not at the origin moves the content by minus that corner, so a negative corner moves it up and right. - ColorRgb and ColorCmyk promised a later major would refuse out-of-range and non-finite channels (#509). #509 is a patch-release issue for non-finite channels only; the paragraph now says that. Its body misquoted ISO 32000-2 8.6.4.3 as requiring clipping and has been corrected on the issue. - TextStyle.LinkUri: on a justified line in an embedded font the link rectangle is placed where the words would be unjustified, 391 points from "LINK" in the measured case. Filed as #551. - DrawContext: a null page leaves registered structure elements without a /Pg entry (0 of 3 had one); AddUriLinkAnnotation throws from the call and now has the tag. IRenderer.Draw says calling it before Layout is unsupported, and TableRenderer.Draw tags the IndexOutOfRangeException a header table gives. - Row() no longer says a row cannot join a table (a cast of Rows adds one); TextRun.Style's null throws only for text holding a word; PieSlice.Value and its constructor tag the ArgumentException whose ParamName is Slices; TableElement.BorderWidth gains a "Do not pass" paragraph for the negative width it writes as is; LayoutImage.Margins no longer points at Width for a positive-infinity rule Width does not share. - Voice: "the too-tall exception" is spelled out as InvalidOperationException on the eight lines this PR added; the surrogate sentences make text, not the font, the subject; smaller referent and repetition fixes, and ten blank doc lines with trailing whitespace that earlier edits left are removed. The count of public members with an <exception> tag moves from 115 to 119, counted in the compiler's XML output.
Round 7 found 4 high and 15 medium defects in the text ed8d914 left. Most came from sentences earlier rounds added that listed outcomes for the cases measured then, and failed on cases measured now. This round replaces those lists with the mechanism that produces them. Each change below was reproduced before it was written; no code line changes. - Unpaired surrogates: round 6 said the save throws for such text "drawn in an embedded font". The throw comes from measuring it: MeasureString converts code points and throws, while the glyph path substitutes U+FFFD. A footer with a surrogate just past its cut throws although that character is never drawn, one further out saves, and a custom renderer that draws the same text without measuring it saves. All 28 copies now say "measured", with the full rule once on TextStyle.FontRef. FontReference's implicit conversion from a handle, the route most code takes, gains the tag its constructor has. - Document.Margins: the round-6 per-edge rule held for text elements only; a table, image, pie or separator with a NaN or negative-infinity top edge saves with NaN or Infinity in the content stream, a linked paragraph with a NaN left edge raises ArgumentException, and positive infinity opposite NaN also passes the check. The remarks and both tags now describe the one check and what can follow it. The measured table is on #502. - SaveAsync: the cancellation tags listed what is reported before a cancellation and missed a refused page geometry, a null page size and an element's own exception. They now say where the token is looked at and that an earlier failure wins. - New tags: ArgumentException on both Add(IRenderer) overloads (a result with a negative-infinity bottom), InvalidOperationException and IndexOutOfRangeException on SetDefaultFont and Add(string, TextStyle). - Table cells: a word wider than its column is broken between characters, not only at spaces. A row under a RowSpan cell drops its last cell but still measures it (#487), now stated on Row.AddCell. A null cell throws for any automatically sized column, which includes an explicit width of zero, a negative width or NaN. - TableElement.BorderWidth no longer promises a refusal that LineSeparator.LineWidth says is undecided (#482). - Smaller: IRenderer.Draw names the split-renderer exception; the null-style condition counts a no-break space and not a tab; ListRenderer counts entries, not items; DrawContext's class remarks, the AddUriLinkAnnotation overflow case, ColorCmyk's #509 reference, RunningBand.Style's null default, Dispose, the RendererContext constructor and several referent fixes from the voice lens. A new pre-commit script now fails on any changed code line, a doc tag split across lines, trailing whitespace or a line over 100 columns, and lists every quantifier in added lines for review. It caught four split tags and two blank lines the editing tools produced in this round. The count of public members with an <exception> tag moves from 119 to 121.
Round 8 found 1 high and about 17 medium defects in the text 8b51216 left, about 12 of them in sentences earlier rounds had written. This round adds two steps before the commit: a delta review of the fix diff alone, which found one more defect (below) before it shipped, and an avoid-ai-writing pass over the new text. No code line changes. - Null cell text: round 7 said a null cell in a fixed-width column is drawn empty. The column widths are measured over every cell whenever any column is sized automatically, so the save throws in that case too; the cell is drawn empty only when every column has a positive finite width. - The null-style condition counted "a no-break space"; among white-space characters only U+00A0 counts (U+202F and U+2007 do not). - The four settable style members, ListElement.DefaultStyle, ListItem.Style, Cell.Style and TableElement.DefaultCellStyle, gain the size (InvalidOperationException), undefined-font (IndexOutOfRangeException) and unpaired-surrogate (ArgumentException) tags; cell and band styles say LinkUri is ignored (#475); Heading.Style states its 14pt default for a null style. - LayoutResult.Full: round 6 narrowed the trigger to negative infinity after trying built-in followers only. A later renderer that links the area it was given reaches the exception for NaN and positive infinity as well; the tag says non-finite again and names both routes. - Document.Margins: cut the claim that the message is about the element (with a running band it names the margins); added the "Do not pass NaN" paragraph the DocumentRenderer constructor already had; the save and Render ArgumentException tags now name the non-finite-position cause and its ParamName "value". The CHANGELOG sentence points to the member and #502 instead of listing outcomes. - Colour members: all six state that channels are neither checked nor clamped and are written rounded to five decimals, NaN and Infinity included. The delta review caught the first draft's "written as it is": 1.000001 is written as 1. - DrawContext: finite boxes whose sum overflows are refused, in the class remarks as well as on AddUriLinkAnnotation; int.MinValue as an outline level wraps. - Smaller: the second-save ordering, Row.AddCell(Cell) carries the #487 sentence, band surrogate wording, BandTruncationWarning counts UTF-16 code units, TableElement.BorderWidth defers to #482, IRenderer.Draw's referent, FontReference's subset growth, and voice fixes. Tooling: the reflow no longer merges a one-line summary into the remarks after it, and the pre-commit check now fails on merged block tags; it found five, which are split, and 12 over-long lines from earlier rounds, which are rewrapped. The count of public members with an <exception> tag moves from 121 to 125.
Round 9 found 2 high and about 16 medium defects in the text 35f0fa6 left, about 8 of them in sentences earlier rounds had written, down from 12 in round 8. Before this commit the fix diff went through a contract review and a voice review of its own, which found 2 high and about 14 medium defects in the new text before it shipped, counting once what both reviews found. No code line changes. - Style parameters: round 8 tagged the four settable style properties and missed the eleven members that take a style as a parameter. The Heading, Paragraph (both), ListItem and RunningBand constructors, Paragraph.Add, ListElement.Add, ListItem.AddChild, TextRun, Heading.Style and RunningBand.Style now carry the size (InvalidOperationException) and undefined-font (IndexOutOfRangeException) tags. Heading.Style and RunningBand.Style gain the unpaired-surrogate ArgumentException, and the band's size or leading can leave the content area no positive size. - TableElement.ColWidths: the scaling trigger was wrong. Each auto column first takes a content-weighted share of what the explicit entries leave, at least its longest word plus padding, and the explicit widths are scaled to what the auto columns leave, even when they fit the table on their own: 300 beside an auto column holding a 20-character word resolves to 261.44 and 238.56 at 500pt. When the auto columns take the whole width, every column is scaled: 100 and a 40-character auto word at 200pt resolve to 35.39 and 164.61. - LineSeparator: finite Top, Bottom and width values whose sum overflows are not refused. Toward positive infinity the save throws "too tall"; toward negative infinity Infinity is written into m and l, and a later heading makes the save throw ArgumentException. - Saves: a synchronous save that fails while writing leaves what was written, which can be the 15-byte PDF header alone; the asynchronous stream save builds in memory and writes nothing. DocumentRenderer's constructor gains the Render-deferred tags Document.Margins has, and running bands over pages the PdfDocument already held read "Page 2 of 1". - TextStyle.FontSize: a non-finite size is checked once a run holds a character other than white space, U+00A0 included; an empty cell or list item is always checked. #551 affects standard-14 text too. - Cell.RowSpan of int.MaxValue from the third row wraps and the group can split across pages; Cell.Content control characters in an embedded font draw whatever glyph the font's cmap gives them; Paragraph.Language is ignored by a ParagraphRenderer built directly; IRenderer.Layout may grow an embedded font's subset; EdgeInsets scopes "check neither" to this package, since Barcode.Margins does check. - Voice: the U+00A0 rule, the second-save qualifier, colour rounding, constructor tags that said "this call", and "a style's" on members that take one style. Two v2.3.4 fixes are recorded for the follow-up PR: the partial header a failed synchronous save leaves, and band numbering over existing pages.
Round 10 found 1 high and about 18 medium defects in the text c2efb9e left. About 10 were sentences round 9 wrote that held for the case it measured and not for the rest of the range: column widths with no auto column, a band's leading at positive infinity, every table cell and list item rather than only empty ones. This round each new sentence was probed across its whole input range before it was written. The fix diff then went through a contract and a voice review of its own, which found 2 high and 17 medium defects before commit, counting a shared one once. No code line changes. - Cell.RowSpan: a group that starts in the table's leading header rows is not held together. It splits across pages, and on each continuation page the data rows it covers draw their cells in its columns. The remarks, the exception tag and the TableRenderer summary now say which groups are held together. - ListElement: an item can be drawn without its last line while the space for it stays reserved. The draw pass lays each item out again in a height it recomputes, and rounding can leave it just short. At 12pt an item of exactly two lines draws only its first; two and four lines at 11pt, three at 14pt, and three and four at 18pt lose one line too. - Paragraph: text is laid out word by word. Line breaks start a new line, other white space collapses to one space, and the boundary between two runs is drawn as a space, so "Bold" + "er" reads "Bold er". Heading, list item and TextRun point here. - TableElement.ColWidths: with no auto column, the explicit widths are scaled to the whole available width ([200, 200] in 260pt gives 130 and 130). - Running bands: with Height null, a large size, positive infinity included, or a large finite leading leaves the content area no positive size (ArgumentException); a non-finite leading is treated as automatic. The six members that hold a band, and RunningBand's constructor and Style, now say so. - DrawContext: a coordinate is written in plain decimal, so 9.3e18 becomes an integer token qpdf 12.4.1 cannot hold, and it drops the annotation or outline item; 9.2e18 is kept. - RendererContext: a second context on one page reuses Im1, and only the image registered last under that name is drawn. - Tags: TextStyle.LinkUri gains the ArgumentException a link at a non-finite position raises; TextRun.Text and TextRun.Style gain the tags TextRun's type carries. The DocumentRenderer constructor names the header and footer route. TextStyle.FontSize separates the paragraph and heading rule from cells and list items, which are checked whatever their text holds. - Voice: renderer "raises the refusals" wording, the Margins "Do not" paragraph, pronouns in LineSeparator.LineWidth and IRenderer.Draw, and the ColorRgb and ColorCmyk "Do not" paragraphs. Four behaviour fixes are recorded for the v2.3.4 follow-up: the list item's lost line, header-row spans, image names across contexts, and large coordinates written as integer tokens. The run boundary drawn as a space likely needs its own issue.
Round 11 found 1 high and about 10 medium defects in the text c8e4760 left, down from about 19. About 6 were sentences round 10 wrote; the worst was the list line loss, which c8e4760 stated for every two-line item at 12pt after measuring one list at the top of a page. The fix diff then went through a contract and a voice review of its own, which found no high and 11 medium defects before commit. No code line changes. - ListElement: only the last item a list draws on a page can lose its last line. The draw pass lays each item out again in the height left to the bottom of the list's area, which for that item is exactly its own. Whether a line is lost depends on the font size, the line count and where the item falls: a single two-line item at 12pt at the top of an A4 page draws one line, and the same item further down draws two. c8e4760's commit message listed sizes measured at one position only. - TextStyle.LinkUri: without a link, paragraph and list-item text at a non-finite position saves; a heading at a non-finite height throws either way, from its bookmark. - Document.Margins: a finite negative inset moves that edge of the content area past the page; -1e308 overflows and writes Infinity or NaN, or throws for linked text. - DocumentRenderer.BandTruncations: a band is cut only when its measured width exceeds the content width, so a negative font size or a NaN content width is never reported. - Paragraph white space: a carriage return, a line feed, or CR LF starts a new line, and other white space is dropped at the start and end of each line. Justify says which line is last with trailing line breaks. - Cell.RowSpan: the save throws when a held group is taller than the page leaves below the repeated header rows; a header row after the first data row counts as a data row; a header-origin span's cell is drawn again on continuation pages, as tall as the header rows it covers there. - SaveAsync: each listed exception faults the returned task, except a cancellation, which ends it Canceled. - Tags: Heading.Text, ListItem.Text, Cell.Content and LayoutImage.Image gain the tags TextRun.Text carries; 18 style tags and the band remarks cite TextStyle.Leading as well as FontSize. - CHANGELOG: the #526 list-gutter sentence said the revert never fires on an ordinary page. On US Letter at 72-point margins, item 18 with an unbroken word of 68 lowercase "a" reverts, and its text starts inside the marker. Recorded for the v2.3.4 follow-up: the gutter revert that places text inside the marker needs a maintainer decision.
Round 12 found 1 high and about 10 medium defects in the text c8601ec left, level with round 11. About 9 were exact rules that round wrote ("cut only when", "its last line", "drawn once") breaking at a boundary. This round states behaviour that is a defect queued for the v2.3.4 follow-up with "can" and one measured example, and keeps the exact boundaries in the fix notes. The fix diff went through a contract and a voice review before commit, which found 4 high and 9 medium defects in it. No code line changes. - Justify: on a line whose text is all in standard-14 fonts, a single run is stretched by half the free space (#548); a line holding more than one run places each run at its unstretched width while stretching its spaces, so a run can overprint the next. Measured: two runs in Helvetica 10 on a 200pt line, run 1 ending at 137.6 and run 2 starting at 120.08. - Band truncation: the cut compares a running total of character widths with the content width, so a template that fits exactly can still be cut ("Page 1 of 1" at its exact width draws "Page 1 of"). Zero- and negative-width templates and a NaN content width are not cut. The summaries of DocumentRenderer.BandTruncations, Document.BandTruncations, BandTruncationWarning and RunningBand.Template agree. - Paragraph: a break right after a word too wide for its line adds an empty line, whether or not it is the last. - Document.Margins: that edge of the content area lies at the inset plus any header or footer height, measured from the page's edge; a band on that edge starts at the inset and can lie beyond the page. - Cell.RowSpan: groups that share a row are held together as one block; a spanning cell is drawn at its own row, and a header-origin one again on each continuation page. - ListElement: the last item on a page can lose a line, a middle line when it is split. - LayoutImage: an image whose pixel width or height is not positive, as a JPEG declaring a zero dimension loads, makes the save throw ArgumentException (_img) before Width and Height are checked. - ListRenderer.Layout: its negative-start exception reaches a save only from a renderer you construct and add with Add(IRenderer). - Voice: SaveAsync's subject, the TextStyle class remark, the "#509" and "#482" Do-not wording, the FontSize tag, and chained sentences on Margins, Justify and Paragraph. Recorded for v2.3.4: the multi-run overprint, the exact-fit band cut, and the empty line after an over-wide word.
Round 13 found no high and about 9 medium defects in the text 045f5bf left, and the Document, DocumentRenderer and RendererContext lens found none at medium or above. Most were wording that round 12 wrote. The fix diff went through a contract and a voice review before commit, which found 1 high and 6 medium defects in it. No code line changes. - Justify (#548): the unit is the TextStyle instance, not the run. A standard-14 line in one instance is stretched by half the free space; runs that share an instance merge into one fragment. On a line holding more than one instance, each instance's text is placed at its unstretched width while its spaces are stretched, and can overprint the text after it, even when the two styles hold the same values. - RunningBand.Template: truncation measures each character at the advance of the glyph the font gives it. The symbolic standard-14 faces and the C0 controls in every standard-14 font measure zero and are never cut; Courier measures U+007F at 600 units where Helvetica measures it at zero; an embedded Calibri measures U+0000 and U+000D at zero. Measured: 500 tabs in a footer are not cut in Helvetica and are cut to 28 in embedded Arial. - ListItem: an item reached only as a grandchild is not measured or drawn, so nothing it holds makes the save throw. - Document.Margins: one edge at -1e308 on the left or right is enough to overflow; the top and bottom edges do not. - DocumentRenderer: a null pageSize means pdf's DefaultPageSize at construction, and null margins mean 72 points on every side. BandTruncations measures the resolved text. - Smaller: the TextStyle class remark lists example calls, Paragraph's "first trailing break", Document.Info, the LinkUri example (negative infinity), LayoutImage.Margins' derived height, ListStyle crefs.
Round 14 found no high and 11 medium defects in the text 1336bba left. About 5 were wording from earlier rounds; the other 6 were behaviour already in the code that deeper probing reached. The fix diff went through a contract and a voice review before commit, which found 10 medium defects in it. No code line changes. - Document.PageSize: an image the content area leaves too narrow to draw is a third route to InvalidOperationException, and a header or footer that leaves no content area raises ArgumentException. A page so large that positions overflow is in the Do-not set: 1e308 wide makes an auto-width table write NaN. The DocumentRenderer constructor says the same. - Output intents: the identifier and info are written as Latin-1; a best-fit character where one exists (an en dash becomes "-"), and "?" for each UTF-16 unit otherwise. - Document.Info is written to /Info as given; the XMP copy can differ. Document.Tagged: the built-in elements wrap their content, and a custom renderer does so itself. - Justify: Symbol and ZapfDingbats measure every glyph as zero (#470), so a justified line in either can run past the right edge; the half stretch and overprint are stated for the other twelve faces. - RunningBand.Alignment: justify loses the default centring and nothing reports it, as on PieChart. Template widths: Arial measures every C0 control at 750 units, embedded Calibri U+0000 and U+000D at zero. - ListItem: the constructor, AddChild and Style tags say which items raise; AddChild(ListItem) raises only when this item is top-level. - LineSeparator.LineWidth and TableElement.BorderWidth say, as the CHANGELOG does, that refusing a negative width is being decided in #482. - Smaller: ParagraphRenderer's negative start line, the BandTruncations "only report" scope, FontSize's list-item message, "black text".
Round 15 found no high and about 8 medium defects in the text f64b91a left, down from 11. Most traced to two behaviours already in the code, which this commit states once, where they arise, and points to from the members they affect. The fix diff went through a contract and a voice review before commit, which found 2 high and 7 medium defects in it. No code line changes. - TextStyle.FontRef: Symbol and ZapfDingbats measure every character as zero width (#470), so every layout step that measures text treats theirs as having no width. A paragraph in either is never wrapped, a centred or right-aligned line is placed as if it had no width, a justified line can run past the right edge, and a run after one on the same line starts where that run starts and is drawn over it (measured: both at x=104.688). HorizontalAlignment.Center and Right point there. - Paragraph: text holding only white space is laid out at TextStyle.Default's leading, whatever its style: one line for each line break, and one when there is none. Measured at sizes 5, 700, 1e308 and NaN, the next paragraph moved down 14.4 each time. Its size and leading are neither used nor checked. - ListElement: such an item's marker is still laid out in its own style, so when the marker line does not fit where the item lands, the item is placed without its marker and nothing reports it. - Document.Info: the XMP copy drops the C0 controls other than tab, line feed and carriage return, and carries VellumPdf as the producer when Producer is null. Document.Tagged: a custom renderer should wrap its own content. - ListItem.AddChild(string): its exceptions are raised only when this item is laid out as a top-level item. - Smaller: the Justify definition in parentheses, PieChart.Alignment's undefined value, the PageSize image pointer to LayoutImage.Width.
Round 16 ran under the rule that behaviour already in the code and newly found by probing is filed on #552 rather than blocking this PR. It found no high and 3 medium defects in the text 361ac49 left; four discoveries went to #552. The fix diff went through a contract and a voice review before commit, which found 1 medium in it. No code line changes. - LoadTrueTypeFont, LoadTrueTypeFontAsync, Save(string) and SaveAsync(string): the ArgumentException tags said a path holding only white space is refused. On Windows only U+0020 spaces are: a tab gives IOException, and a U+00A0 path is a valid file name that saves. The tags now say "on Windows, holds only spaces". - TextStyle.LinkUri and DrawContext.AddUriLinkAnnotation: a link is written untagged and without /Contents whatever the conformance (measured with Tagged, PDF/A-2a and PDF/UA-1); in a PDF/UA-1 document that breaks ISO 14289-1, 7.18.5 (#550). The text scoped the untagged write itself to PDF/UA-1. - TextStyle.FontRef: zero width holds at any finite size, and only a run in a different TextStyle instance can be drawn over a Symbol or ZapfDingbats run; runs sharing an instance merge into one fragment. - CHANGELOG: the white-space sentence is scoped to paragraph, heading and list-item text, with the U+00A0 exception and "where the item lands". - Smaller: Center and Right point to FontRef, AddChild(string)'s remarks say "laid out as a top-level item".
Round 17 found no high and 2 medium defects in the text 215f52e left. Behaviour newly found by probing went to #552 instead of blocking this PR, in a third comment there. A contract and a voice review read the fix diff before commit and found the same ambiguity in it, fixed here. No code line changes. - UseTrueTypeFont: a font whose unitsPerEm is 0 registers, and the save then throws ArgumentException with ParamName "value", whether or not text uses the font. The remarks said so but no exception tag did. The member now carries the tag, and LoadTrueTypeFont and LoadTrueTypeFontAsync name the same save-time cause in theirs. - LoadTrueTypeFontAsync: the remarks said every refusal faults the returned task. A missing outline table and a non-finite font metric are raised by the save, not the task; the remarks now say so. - CHANGELOG: the sentence on a list item placed without its marker is scoped to an item holding only white space. Marker and content share the item's style, so only that item's content can fit where its marker does not. - Smaller: "the link" for "such a link" on LinkUri and AddUriLinkAnnotation, "at any finite size" on FontReference.MeasureString, ZapfDingbats drawing the nested marker's "?" code as a different glyph, a cut clause on RunningBand.Alignment, and the Justify bullet split in two.
Round 18 found 1 high and 5 medium defects in the text 846f021 left. Three came from round 17's own rewording, which made sentences more definite than the code supports. Behaviour newly found by probing went to #552 in a fourth comment. A contract and a voice review read the fix diff before commit; the voice review found 4 medium defects in the new wording, all fixed here. No code line changes. - ListElement.Indent said NaN and negative infinity neither throw nor are reported. With linked item text, NaN makes the save throw ArgumentException for the link's rectangle in a flat or nested list; negative infinity does so when the text lands at a non-finite position, and a flat short item still saves. The member now carries the tag, and the finite-negative sentences say "at a finite value". - TextStyle.LinkUri, DrawContext.AddUriLinkAnnotation, CHANGELOG: ISO 14289-1, 7.18.1 exempts a link whose rectangle lies wholly outside the crop box. In the pre-review's veraPDF 1.30.2 run, such a link passed and one partly off the page failed. - FontReference.MeasureString: a Symbol run after Helvetica text can move to the next line, because the space character before it is measured in Helvetica. "Never wrapped" is scoped to a paragraph set wholly in Symbol or ZapfDingbats. - LoadTrueTypeFontAsync: every refusal, a null or empty path included, faults the task. Only a token already cancelled at the call cancels it; the token reaches the file read alone, so a later cancellation has no effect. - Smaller: the CHANGELOG Indent sentence says "can" and is split, PageSize loses a framing clause, and the #470 citation names the two fonts it is about.
Round 19 found no high and six medium defects in the text 3e0e6a8 left. Two were sweep-misses of classes earlier rounds fixed on a sibling member, and four were wording that round 18 wrote or left ambiguous. A contract and a voice review read the fix diff before commit and found one high and several medium defects in the first version of these edits, all fixed here. Behaviour newly found by probing goes to #552. No code line changes. - DrawContext.AddOutlineEntry: a context built with a null page makes the save of its PdfDocument throw ArgumentNullException, as AddUriLinkAnnotation does from the call. The member carries the tag. - Document.TextEncodingWarnings: a custom IRenderer that shows text through the page canvas is reported too, so the sentence states the rule instead of a list of producers. - LineSeparator.LineWidth and Margins: the ArgumentException tags name the link rectangle and the message, as their siblings do. - TextStyle.LinkUri, DrawContext.AddUriLinkAnnotation, CHANGELOG: the crop-box exemption says what clause 7.18.1 lifts, using the clause's own scope, the requirements of clause 7.18. - TextStyle.FontRef: "never wrapped" is scoped to a paragraph set wholly in Symbol or ZapfDingbats, in a sentence of its own. - Document.LoadTrueTypeFontAsync: an already cancelled token cancels the task whatever the path holds, so it pre-empts the refusals. The exception tag states the same window. - ListElement.Indent: the linked-text sentence is its own paragraph and takes its scope from the exception tag, NaN or negative infinity. The negative-value sentence is split.
Round 20 found no high and three medium defects in the text 5847721 left: one regression of that commit's own rewrite, one sweep-miss of the null-page class it fixed on two siblings, and one quantifier that held for each input alone but not for two combined. A contract and a voice review read the first version of these edits and found four medium defects in it; a third review read the second version and found one more. All are fixed here. Behaviour found by probing goes to #552. No code line changes. - TextStyle.FontRef: the centring sentence is scoped to a line set wholly in Symbol or ZapfDingbats. A mixed line is placed as if only part of it had no width, and the space between runs takes the font of the run before it, so no short rule for mixed lines is stated. - DrawContext.UseEmbeddedFont: tag the ArgumentNullException raised when its RendererContext was built with a null page and a non-null document, as AddUriLinkAnnotation and AddOutlineEntry are tagged. - Document.TextEncodingWarnings: state the rule as the characters passed to PdfCanvas.ShowText. Built-in elements pass it only their Standard-14 text; a custom renderer's calls are recorded whatever font is selected. - ListElement.Indent: a finite negative value can make linked text throw at save when the gutter taken from it overflows at the list's left edge, on a flat list as well as a nested one. The CHANGELOG sentence saying nothing throws at a finite value on a flat list is cut.
Every exception tag on DrawContext and RendererContext named one null value and was read as if the others were sound. Measured over 1,448 combinations of the constructor arguments and each member's own argument, that is false wherever two are null: a null handle with a RendererContext built without a page raises ArgumentNullException, not the NullReferenceException the tag promised, because the kernel looks the page up before it reads the handle. Each tag now states the condition it measurably fires under, and opens with where it lands. UseEmbeddedFont's NullReferenceException tag gains the two causes its own callee already documented. Six members that raise it from a null document said nothing about it, although the constructor's tag covers them as a class: Tagged, GetFont, AddUriLinkAnnotation, AddOutlineEntry, RegisterStructElemTree and StampStructElemPage now say so where IntelliSense shows it. The two ArgumentException tags blamed the caller's argument for a value the save never sees. What is written is the flipped value, so a finite layoutY is refused when PageBounds.Height is not finite or the subtraction overflows, and the class remarks claimed the opposite by naming an overflow of X plus Width as the only route. A page from another document is a second route the file never mentioned while RendererContext documented it for images: the link annotation is dropped, so a box the save would refuse is written nowhere, while an outline entry is still written with a null destination. Layout tests with REQUIRE_ORACLES=1: 412 run, 0 skipped, 0 failed.
Round 21 found two gaps the earlier rounds' sweeps had walked past. The constructor said a null page leaves "each structure element this type registers" without a page. RegisterStructElemTree never touches Page, so a root registered through it keeps the page the caller set and the save writes /Pg; measured both ways on one tagged document. The sentence now names the member it holds for and says what the tree call does instead. Add(string, TextStyle) gained the save-time exception tags in round 9 and its six siblings did not, although each one reaches the same code: the text overload is Add(new Paragraph(...)). Measured per overload, everything lands on the save and only a null argument throws from Add. Paragraph, Heading, ListElement and TableElement can raise ArgumentException, InvalidOperationException and IndexOutOfRangeException; LineSeparator, LayoutImage and PieChart the first two. Each tag now points at the member that holds the value rather than listing inputs here. Also from the round: the class remarks kept a derivation the three members already carry, ToPdfY claimed a refusal on a member that refuses nothing, and two tags needed splitting where a second "when" changed job mid-sentence. Layout tests with REQUIRE_ORACLES=1: 412 run, 0 skipped, 0 failed.
Heading.Level said assistive technology cannot tell level 5 from level 500 "while the outline still nests on the number you gave". The outline cannot tell them apart either. The builder hangs an entry under the most recent earlier entry at exactly Level - 1 and puts it at the top level when there is none, so after a level 0 heading both 5 and 500 land beside it rather than under it: measured on three-heading documents, where 0/1/2 nest in a chain and 0/5/500 share one parent. DrawContext.AddOutlineEntry already stated that rule, so the two members disagreed. The member now gives the rule and points at it, and keeps the advice the old sentence was there to support. Layout tests with REQUIRE_ORACLES=1: 412 run, 0 skipped, 0 failed.
DrawContext.Tagged gained its first exception tag when the context types were rescoped, so the figure moved by one. Counted again in the compiler's XML on this head: 82 methods and 52 properties, plus the TextRun type.
This was referenced Sep 20, 2026
… and Cells Paragraph.Runs, ListElement.Items and Row.Cells keep a null entry and say so in prose, but only their Add, AddCell and constructor siblings carried the exception tag. Reading each property does not throw; the save does (ParagraphRenderer.WordWrap, ListRenderer.BuildItems, LayoutValidation.ValidateCell), so the tag says which call raises it. The CHANGELOG count of members carrying an exception tag moves from 134 to 137, recounted in the compiler's XML output (82 methods, 55 properties, plus the TextRun type).
Tim81
added a commit
that referenced
this pull request
Nov 19, 2026
Review rounds on PR #542 measured Layout's public surface, and nothing held the figures afterwards: rounds re-derived partitions an earlier round had already settled. A boundary a test asserts fails loudly instead. BoundaryContractTests holds 55 cases (4 facts and 51 theory rows), each from the probe that produced the sentence it pins: which null decides when two are null on DrawContext.UseEmbeddedFont and RendererContext.RegisterImageXObject, which read their arguments in opposite orders; that a save refuses the value it writes rather than the one passed; that a page from another document drops a link annotation while the outline entry is still written; that the five Document.Add overloads that carry a TextStyle defer that style's refusals to the save; where a nested list's indent is refused and that a flat list with unlinked text is never refused; how a heading's level places its bookmark; and that Symbol and ZapfDingbats measure every non-surrogate BMP character as zero. A refusal is asserted by exception type, ParamName or a message fragment, an acceptance by the save completing, and a placement by the bytes written. The placement cases carry a control, a Helvetica line beside the Symbol one and a default indent beside the infinite one, so a change that stops drawing cannot pass them. Layout tests, Release: 467 run, 0 failed, 31 skipped (oracle cases, no oracles on PATH).
Tim81
added a commit
that referenced
this pull request
Nov 19, 2026
#542 documented Layout's public surface by measuring it, but nothing held the figures afterwards. This pins them as tests: 67 cases (5 facts, 62 theory rows) in BoundaryContractTests, each taken from the probe that produced the sentence it pins. They cover which null argument decides on DrawContext and RendererContext, the outline entry's refused flipped Y, a foreign page dropping a link annotation, the five Document.Add overloads deferring a non-finite font size and an unnamed Standard14 value to Save, the nested-list indent boundary, a heading level's bookmark placement, and Symbol and ZapfDingbats measuring zero. Several pin behaviour that later issues (#470, #476, #484) and #571 are expected to change; each such change has to change the pinned sentence too. Tests only.
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.
Closes #510.
#503 and #526 documented the members found by searching for direct throws. This PR gives the rest of
the Layout package's public surface the same contract: what each member refuses, what it
accepts but that must not be relied on, and what it silently ignores — the third set being
the one that hurts, because the call succeeds and hands back something other than what was asked
for.
What is here
The package's public API files list 429 entries. Counted in the compiler's XML output on this head,
137 public members and the
TextRuntype carry an<exception>tag: 82 methods, 55 propertiesand that one type.
Every boundary was measured against a probe built from this branch, not transcribed from the issue.
A sample:
LoadTrueTypeFontraisesFileNotFoundExceptionfor a missing file andDirectoryNotFoundExceptionfor a missing directory, from that call rather than fromSave.width, at each size probed. A paragraph set wholly in either is never wrapped, and a centred line
is placed at the exact centre of the content area as if it had no width — 297.64 on A4.
InvalidOperationExceptionat its own area widthexactly and inclusively: 451.2799 saves, 451.28 throws, and the boundary moves with the list's own
margins.
ColorRgb.FromHex(0x00FF0000)and0xAAFF0000give the same colour; the alpha byte is ignored.javascript:alert(1)onLinkUriandnot a tagonLanguageboth save.Records rewritten as explicit properties
13b1c72rewrote six shipped positional records —ColorRgb,ColorCmyk,EdgeInsets,LayoutBox,BandTruncationWarningandPieSlice— as explicit properties, because a positionalrecord gives its properties no place to carry remarks. That is a source change to shipped types, so
it is proved rather than asserted: ApiCompat against the published 2.3.2 package, and
RecordShapeTests, which pinsToString, equality,withandDeconstructagainst the values thepositional declarations produced at
574c62b. The CHANGELOG's### Changedentry says so.Review
21 rounds. The last three ran four independent lenses each — three contract lenses that measure with
probes, one voice lens for register and ambiguity — plus a pre-review of every fix diff before it was
committed. Blocking findings fell from roughly 47 in round 1 to 0 HIGH and 6 MEDIUM in round 21. One
HIGH has been raised since round 13, in round 18.
Round 21's two contract findings were both older than the text under review: a sentence from round 6
claiming a null page leaves each structure element without one (
RegisterStructElemTreenevertouches
Page, so a root registered through it keeps the caller's page and the save writes/Pg),and round 9's tag sweep, which gave
Add(string, TextStyle)its save-time exception tags and stoppedbefore the six siblings that reach the same code. Both are fixed, the second across all six
overloads with the type set measured per overload. A third finding corrected
Heading.Level, whichsaid the outline "still nests on the number you gave": the builder hangs an entry under the most
recent earlier entry at exactly
Level - 1, so after a level 0 heading both level 5 and level 500land beside it at the top level.
A pre-round sweep of the three classes behind rounds 19 and 20 found what those rounds had not. The
ArgumentExceptiontags onDrawContextblamed the caller's argument for a value the save neversees — what is written is the flipped value, so a finite
layoutYis refused whenPageBounds'sheight is not finite or the subtraction overflows. A page from another document drops a link
annotation entirely, while still writing an outline entry with a null destination.
Behaviour found by probing that no document ever described is filed on #552 rather than fixed here.
Defects this PR documents rather than fixes are #543-#551, milestoned v2.3.4.
Scope
Documentation only, apart from the six record rewrites above and five explicit parameterless
constructors that exist to carry a doc comment. Layout tests run with
REQUIRE_ORACLES=1, so nooracle case skips silently: 412 run, 0 skipped, 0 failed.