Skip to content

GraphCompose v2.5.4

Latest

Choose a tag to compare

@github-actions github-actions released this 03 Dec 01:12

v2.5.4 — 2026-12-03

  • A bottom margin no longer cuts or shifts the fill, border or clip of a row or a shape
    container, or the fill and border of a section in a row's column.
  • Behaviour change: with per-page margins, a block that cannot break now throws
    AtomicNodeTooLargeException when the page it moves to cannot hold it with its own top and
    bottom margins.
    2.5.3 placed it there anyway, even past the foot of the page.
  • A page break no longer cuts through a table cell that spans rows in a document whose pages
    all have the same margins, as long as the rows it holds together, the repeated header rows and
    the table's padding and margins fit on one page, and no keepWithNext() heading above the table
    needs the room.
  • A right-aligned, centred or right-to-left paragraph keeps to its column on every page it runs
    over.
  • A numbered line such as 1. **First** step keeps its number in text read as markdown, and
    a line break inside a rich-text run breaks the line in PDF and PPTX.
  • A table with a repeated header no longer fails on a row that cannot share a page with it.
  • A service that loads many custom font files no longer grows the PDF font caches without limit.

No API changes, and no code to change when you upgrade from 2.5.3. Check two kinds of document
that can now fail to lay out:

  • A document with per-page margins (DocumentSession.pageMargins):
    • it throws AtomicNodeTooLargeException when a block that cannot break ends up on a shorter
      page that cannot hold it with its own top and bottom margins;
    • it throws the same when a table whose first row does not fit such a page starts there, because
      the box before it no longer opens a page for its bottom padding or margin;
    • a box placed directly in the page flow that opens with a block that cannot break now moves
      with it to the page it lands on, and takes that page's column. Where side margins differ, a
      table in the box can be too wide for it and throw IllegalStateException, or its text can
      wrap onto more lines and make a block in it too tall for the page.
  • A document where a row, a layer stack, a shape container or a table row with a composed cell
    nearly fills a page and holds numbered lines read as markdown, or a line break inside a rich-text
    run.
    A numbered line now keeps its number, so it can wrap onto one more line, and a line break
    in a run now starts a new line. Either can make the block too tall for the page: it throws
    AtomicNodeTooLargeException.

A document with per-page margins or page references is laid out in several passes, and only the
layout it ends with is checked now. One that cannot fit throws when its passes are done, so the
message can name another block or page than 2.5.3's. A pass that stops on another error, such as
a table too wide for its column, throws the exception for the first block it refused, or that
error if it refused none.

In the other direction, a block that threw because it was taller than a short page already in use
now moves to the next page, if that page can hold it, and a document that 2.5.3 refused only in a
pass before the last now lays out. So does a table with repeated header rows that threw because
its header rows and a body row, each short enough for a page by itself, did not fit on an empty
page together. The entries below give the detail. Where one applies to a document, its pages
and layout snapshots, or its DOCX export, can change.

Changed

  • A block that cannot break is checked against the page it lands on, not the page it leaves.
    • This covers rows, layer stacks, canvases, shape containers, and single blocks such as a
      picture, a shape or a barcode. Such a block was compared with the height of the page it was
      leaving and then moved without a second check. With per-page margins the next page can be
      shorter: a 220pt block passed page 1's 360pt, moved to a page 2 with 100pt of room, and ran
      120pt past that page's bottom margin. As before, the height compared includes the block's own
      top and bottom margins, so on the page it lands on a block can now throw even where only its
      bottom margin does not fit.
    • Behaviour change: the layout now throws AtomicNodeTooLargeException there, naming the
      block and that page's height. To lay the document out again, make the block fit that page,
      split it into smaller blocks, or give the page smaller margins. Differences under 0.5pt are
      still tolerated.
    • A block taller than a short page that already holds something, but not taller than the next
      page, used to throw. It now moves to the next page. On a short page that is still empty it
      throws, as before.
    • A box whose first block moves this way opens on the page the block lands on, if that page also
      has room for the box's top margin and padding. Its fill is then not left on the page before,
      beside nothing. A box placed directly in the page flow then takes that page's column, so where
      side margins differ, a table in it can be too wide for that column, or its text can wrap onto
      more lines. A first block kept whole by keepTogether() is still measured against the page it
      leaves. So is a first block that can split, such as a table, a paragraph or a list, as in 2.5.3:
      a box that opens with one can still leave only its padding and fill on a page.
    • Without per-page margins every page has the same height, and this rule changes nothing.
    • Only the layout a document ends with is checked. With per-page margins or page references the
      layout runs in passes, and a pass before the last can put a block on a page it does not end
      up on. Such a pass now places the block there, past the page's bottom, and goes on; 2.5.3
      threw. If that pass then stops on another error, it throws the refusal.
    • Known limit: in a document with per-page margins whose passes never settle on one layout, a box
      that opens with a block that cannot break can be left outside its page's column. 2.5.3 settled
      some of these documents.
  • For a custom NodeDefinition, paginationPolicy can now be asked before its node is placed.
    A box whose first block is not kept whole by keepTogether(), and does not fit the rest of a
    page that already holds something, asks whether that block can split when it fits only one of
    this page and the next. It asks about the leaf prepare returns at the width the box gives it,
    never about a box or a page break, and at most once per node object in a pass. Placement may then
    place another object, place that leaf where it is not asked about, or not place it in that pass,
    which can also be one that then fails. The answer must therefore depend only on the node. The
    built-in definitions give a fixed answer for their type.
  • Under negative letter spacing, a padded block is at least as wide as its padding. Tight
    spacing can measure a short line as narrower than nothing, and a left-aligned paragraph or list,
    a page reference or a page number then took that off its padding: a -3pt line in 10pt of padding
    gave a box 7pt wide. It is now 10pt wide. Right-aligned and centred paragraphs and lists already
    took the column's width and do not change. No bundled template or example sets letter spacing
    that tight.

Fixed

  • A bottom margin no longer cuts or shifts a box's fill, border and clip.
    • In some boxes the painted area stopped above the box's bottom edge, short by the bottom margin:
      a row, a layer stack or a shape container in the flow, and any of these, a section or another
      vertical box in a fixed slot, such as a row's column, a stack's layer or a composed table cell.
      A fill and border lost that much height. The outline and clip of a shape container, and the
      clip of a layer stack, moved up by it. A box whose bottom margin reached its height lost them
      all. With a negative bottom margin they reached, or moved, below the box instead.
    • The painted area now ends at the box's own bottom edge. A box with no bottom margin does not
      change. Nor does a section in the flow, which was already right.
  • A shape container too small to draw no longer upsets what the page draws next. An outline a
    millionth of a point or less across or high draws nothing, but a padded container with one still
    closed the clip and the transform it had never opened. In the PDF that restored a graphics state
    nothing had saved. The opening and closing markers are now written together or not at all.
  • A box's bottom padding and margin no longer open a page of their own.
    • When they did not fit the rest of the last page, the box opened a new page for them. At the end
      of a document that page held nothing but the padding; otherwise the next block started that far
      down it. A box whose content ended 10pt above the foot of the page, with 16pt of each, came out
      this way.
    • In that case they now stop at the foot of the page the content ends on, and the next block
      starts on the next page, as after any full page. The fill covers as much of the padding as
      fits. Where the padding is cut short, the layout graph and its snapshots record a box on one
      page as ending where its fill does. A negative bottom margin still pulls the next block up.
    • Later content can move up a page. With per-page margins it can then start on a shorter page.
      Known limit: a block that cannot break, or a table whose first row does not fit that page, then
      throws AtomicNodeTooLargeException. 2.5.3 spent that page on the padding and placed the block
      or table on the next one. A fix is planned.
  • A page break no longer cuts through a table cell that spans rows.
    • A table was cut after the last row that fitted, even inside a rowSpan cell. The cell was drawn
      at its full height on the first page, past the bottom margin, and the next page opened with an
      empty slot where its column was.
    • The cut now moves up to the last row boundary that no such cell crosses. Cells whose spans
      overlap hold their rows together as one group. Where no body row is left above the cut, the
      table moves to the next page. A table without rowSpan breaks where it did.
    • This holds where every page ends up with the same margins. Where any page, even one the
      document does not reach, has other margins than the rest, every table in the document is cut
      after the last row that fits, as in 2.5.3, and a spanning cell can still run past the bottom of
      the page. A rule that changes nothing, or gives every page the same new margins, does not count.
    • Where every page has the same margins, keepWithNext() after a heading counts the table's
      whole first group, with the table's bottom margin and padding, and not only its header rows
      and first body row. A box that opens with the table also counts the whole group. When the
      heading and the group do not fit on one page together, while the group fits a page by itself,
      the heading starts a new page with the table, and the group is cut there under it. A heading
      with nothing above it on its page but boxes' top margins and padding, or the spacing between
      blocks, stays if the header rows and the first row, with the table's bottom margin and padding,
      fit under it, and the group is cut under it. Where margins differ, the heading counts the
      header rows and the first row, as in 2.5.3.
    • Known limit: a group that does not fit on one page with the table's repeated header rows,
      padding and margins can still split at a row boundary, and its spanning cell then runs past the
      bottom margin.
    • Known limit: under a heading, a group that would fit a page by itself is cut when it does not
      fit with the heading, and its spanning cell can run past the bottom margin: a 754pt group under
      an 80pt heading on an A4 page runs 72pt past it. 2.5.3 cut such a group too, under the heading
      where it stood.
    • Known limit: a box that opens with such a table, where the group fits a page but not with the
      box's top margin and padding, stays where it is, and the group moves on alone. The box leaves
      its fill on the page before, with none of the table beside it. 2.5.3 started the table on that
      page and cut the group there.
  • A table with a repeated header no longer fails on a row that cannot share a page with it.
    • Where the repeated header rows and the next body row did not fit on an empty page together,
      the layout threw AtomicNodeTooLargeException, naming the height of the whole table where it
      started, or of the rest of it further down. Without repeatHeader() the same table split.
    • It now splits at that row as it would without repeatHeader(): the table's own header rows
      can end a page by themselves, a page that opens with such a row carries no copy of the
      header, and the header comes back on the next page whose first row fits under it. A table
      that 2.5.3 laid out does not change.
    • Where page margins differ, a table with something above it on its page moves to the next page
      first, as before. At the top of a page it ends that page with its header, and a later, taller
      page that holds the header and the row together opens with a copy of the header above it.
    • A header, or a single body row, taller than a page by itself still throws, and so does a copy
      of the header taller than a later, shorter page.
    • Known limit: a keepWithNext() heading above such a table can be left alone at the bottom of
      a page, with the table starting on the next. Without repeatHeader() the heading moves with
      the table. 2.5.3 threw instead.
    • Known limit: the DOCX export still marks the header rows to repeat on every page and to stay
      with the row under them, so the Word file does not leave the copy out. 2.5.3 exported such a
      document without its page layout.
  • A paragraph that is not left-aligned keeps its column's width on every page.
    • When a page break split a right-aligned or centred paragraph, or a right-to-left one that sets
      no alignment of its own, each piece was only as wide as its own widest line and stood at the
      left edge of the column. Its lines were aligned inside that narrower box. In a 360pt column,
      right-aligned pieces came out 2 to 3pt narrow. In another document, the one-line last piece of a
      right-to-left paragraph stood at the left margin.
    • Each piece now keeps the width of the whole paragraph. A left-aligned piece is still as wide as
      its widest line. The committed preview arabic-article.pdf is re-rendered: three lines move to
      the right edge of the column, and no line changes its text or its baseline.
  • A list item split across pages is as tall as its own lines. Each piece was measured at the
    list style's line height, although a line holding larger text is taller: a piece with 51.8pt of
    lines had a 38.85pt box. The split already counted the real line heights when it decided which
    lines fit.
  • A word cut across lines no longer splits a code point in half.
    • A word too wide for its column is cut between characters. A cut could fall inside a code point
      stored as two halves (a surrogate pair), as most emoji are, and no font draws either half. A cut
      now always falls between whole code points. Text without such pairs breaks where it did.
    • Known limit: the unit is the code point, not the character a reader sees (the grapheme cluster).
      A skin-tone modifier, part of a joined emoji or the second half of a flag can still start a line
      of its own.
  • Tight letter spacing no longer stops a narrow block from laying out.
    • Letter spacing is added after every character, so a negative value can measure a line as
      narrower than nothing: "ill" at 10pt with -4pt spacing measures -5.34pt. The layout threw when a
      left-aligned paragraph or list, a piece of one split across pages, or a paragraph in an
      auto-width table cell took its width from such a line and had too little padding to make up for
      it. It also threw for a marker column that narrow in a hanging-indent list, and for a page
      reference or page number that narrow.
    • Such a width now counts as zero when the box is sized. A paragraph's line keeps its measured
      width, so a right-aligned line still ends at the edge of its column. Known limit: DOCX and
      PPTX exports of these blocks are not covered by tests.
  • A page reference in a table cell prints its page even when it is the document's only one. A
    reference in a composed cell (DocumentTableCell.node(...)) printed its placeholder unless the
    body also held one outside its tables' cells. It now resolves on its own, including in a table
    inside a cell. The DOCX export is unchanged: it still writes such a reference as a field that
    holds no page number until an editor updates it.
  • The PDF font caches no longer grow without limit.
    • Two caches kept an entry for every font source a process had ever loaded: the font files' bytes,
      shared by all threads, and the fonts each thread measures text with. A service that registers a
      font file per tenant kept them all until the JVM stopped. Each cache now keeps the 256 sources
      used most recently. The per-thread cache of parsed fonts was already limited, to 32.
    • A session keeps the fonts it has already loaded, even after a cache drops them. The 130 bundled
      faces fit within the limit, so a process that uses only them never drops one.
    • The limit counts fonts, not bytes. A font file must not change while its path stays the same: a
      file dropped from the cache is read again, so text could be measured with one version and drawn
      with another.
  • A numbered line keeps its number in text read as markdown. A paragraph is read as markdown by
    default when its text holds *, _ or a backtick. In such a paragraph 1. **First** step came
    out as First step on the page and in Word, and a numbered line with no marks lost its number
    too. The number and the character after it are now kept as typed (1., 3), 01.), in the
    paragraph's own style. A list item typed with its number keeps it as well. The line is wider, so
    it can wrap onto one more line. Bullet lines do not change.
  • A line break inside a rich-text run breaks the line.
    • A \n, \r\n or \r inside a run of a rich paragraph was removed before the line was set,
      so rich(r -> r.plain("First.\nSecond.")) came out as one line, First.Second., on the page
      and in PowerPoint. Word already broke the line. The paragraph now breaks there as text(...)
      does with the same characters, and the run's style and link carry on both sides of the break.
      Runs without a line break do not change, and a highlight chip still turns a line break into a
      space. The committed preview world-scripts.pdf is re-rendered: the Arabic card's caption now
      puts its font name on a line of its own under Arabic, as the other four cards do.
    • Auto-size counts such a paragraph as more than one line at every size, as it does plain text,
      so it takes its smallest size: under autoSize(24, 8), rich(r -> r.plain("Short\nShort"))
      is now set at 8pt on two lines, as text("Short\nShort") is. The DOCX export writes it at that
      size too, since it takes the size from the page's lines.
    • Template text written in inline Markdown becomes rich-text runs, so a cover-letter paragraph, or
      CV text such as a summary, a bullet or an entry body, with a line break in it now breaks there
      and can grow taller. A preset that already splits such text at its line breaks before setting it
      does not change. A single newline in such text is a hard break. CommonMark reads it as a soft
      break, shown as a space; before, the two lines ran together.
  • A markdown cell in a DOCX table keeps its line beside a plain cell of the same text.
    • This concerns composed cells, such as **Active** at 14pt followed by a plain Active at 9pt.
      The page set both as it should. The export wrote the first with its asterisks as letters, and
      gave the second the first one's line height. Each paragraph is now matched to its line in its
      own turn, before the ones after it.
    • Known limit: a markdown cell with a bulletOffset before its text is still not matched to its
      own line. It can now take the line of a later cell that sets the same text in the same faces and
      sizes, or, where the markdown cell is auto-sized, at sizes in the same proportion. That cell
      kept its line before.
  • A DOCX list whose marker is made of runs of text hangs its items where the PDF does.
    • In a hangingIndent(true) list whose marker is given as runs of text alone, such as
      marker(m -> m.style("10.", style)) or marker(m -> m.color("•", color)), the export wrote
      the marker, a space and the item. In the document measured, Word set the text 3.3pt left of
      the page's and wrapped its lines back under the number.
    • The top-level marker is now followed by a tab to the column the page sets the text in, and
      the item's lines hang there, as after a marker given as plain text. The same check applies:
      the gap must leave half a point past the width Word may set the marker in, each run weighed
      at its own size. The export report no longer counts these items as standing at a stated
      column.
    • A marker whose gap is too small for that, such as markerGap(0), one that holds a chip or
      draws a picture beside its text, one with a space at either end, and the marker of a list
      that nests items keep the space.
  • A DocxSemanticBackend reused after an export that threw now reports what a new one would.
    Some state survived the failed export. The next export on the same instance could leave an inline
    chip in a page header or footer out of its report. All of an export's state is now reset when the
    next one starts. This covers exports one after another: an instance is still not for two threads
    at once.
  • A DOCX table split for its pages' margins no longer repeats a drawing from its header row.
    • Where a page with other margins starts among a table's rows, the export splits the table, and
      the second part opens with copies of the header rows. A shape anchored in a header row was
      copied too. The file then held its drawing id twice, and Word 16 drew it again on every page of
      the second part.
    • The copies now leave the drawing out, and the first part keeps it. In the document measured,
      Word 16 now draws one shape on each of the table's pages, as the PDF does. It drew two on each
      page of the second part before.