From 8ea6d151f5e873cb7c49e36ff0c33a76e4a9c335 Mon Sep 17 00:00:00 2001 From: DemchaAV Date: Mon, 3 Aug 2026 18:04:14 +0100 Subject: [PATCH] fix(examples): the carousel sets leading in points, not multiples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every lineSpacing call in this file carried a typographic multiplier — 1.03, 1.06, 1.25, 1.4, 1.45. ParagraphBuilder.lineSpacing takes points: TextFlowSupport adds it between wrapped lines as `(lineCount - 1) * gap`, on top of the font's own line height. So the deck asked for a point and a half of extra leading on type ranging from 26 to 156 points, and rendered at effectively default leading throughout. Every slide read as a wall. The values are now expressed in the file's own design units, tapering with type size because display faces need proportionally less: 8 * SCALE on the 132pt headline, 6 on the 82pt slide titles, 5 on the 40pt lead paragraph, 4 on the 28pt card body, 3 on the chart labels and the footnote. On the 33pt card body that moves the gap from 1.4pt to 4.7pt. Measured on the rendered pages at 110 dpi: a four-line card grows 10.5pt, a three-line card 6.5pt, a two-line card 2.6pt — three, two and one inter-line gaps of 3.3pt each, which is what the arithmetic predicts. The deck stays six slides and the last card on the tallest slide still clears the bottom margin by 193pt. ./mvnw -B -ntp clean verify — BUILD SUCCESS, 692 tests in the closing module, CommittedAssetDriftTest green: this deck is an unpublished preview, so no committed asset moves with it. --- .../flagships/LinkedInCarouselExample.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/examples/src/main/java/com/demcha/examples/flagships/LinkedInCarouselExample.java b/examples/src/main/java/com/demcha/examples/flagships/LinkedInCarouselExample.java index e5033bb2..dc884be7 100644 --- a/examples/src/main/java/com/demcha/examples/flagships/LinkedInCarouselExample.java +++ b/examples/src/main/java/com/demcha/examples/flagships/LinkedInCarouselExample.java @@ -230,7 +230,10 @@ private static void cover(SectionBuilder slide) { slide.addParagraph(p -> p .text("One composition.\nTwo formats.") .textStyle(headline(132)) - .lineSpacing(1.03) + // lineSpacing is EXTRA space in points, not a multiplier: the layout + // adds it between wrapped lines on top of the font's own line height. + // Display type needs proportionally less of it than body copy. + .lineSpacing(8 * SCALE) .margin(DocumentInsets.zero())); slide.addShape(shape -> shape.size(160 * SCALE, 7 * SCALE).fillColor(VIOLET) .margin(DocumentInsets.symmetric(14, 0))); @@ -240,7 +243,7 @@ private static void cover(SectionBuilder slide) { + "backend — so PDF and PowerPoint are the same geometry, " + "not two hand-kept designs.") .textStyle(body(40, ON_DARK_MUTED)) - .lineSpacing(1.45) + .lineSpacing(5 * SCALE) .margin(DocumentInsets.zero())); slide.addRow("Formats", row -> { row.spacing(14 * SCALE).evenWeights(); @@ -258,7 +261,7 @@ private static void backendSlide(SectionBuilder slide) { slide.addParagraph(p -> p .text("PowerPoint is a\nfirst-class backend.") .textStyle(headline(82)) - .lineSpacing(1.06) + .lineSpacing(6 * SCALE) .margin(DocumentInsets.zero())); point(slide, "Fixed layout, not export", MINT, "PptxFixedLayoutBackend implements the same FixedLayoutRenderer " @@ -318,7 +321,7 @@ private static void guaranteesSlide(SectionBuilder slide) { slide.addParagraph(p -> p .text("Guarantees you\ncan run.") .textStyle(headline(82)) - .lineSpacing(1.06) + .lineSpacing(6 * SCALE) .margin(DocumentInsets.zero())); point(slide, "Deterministic layout snapshots", VIOLET_LIGHT, "Every flagship document has its geometry recorded as JSON. A layout " @@ -420,7 +423,7 @@ private static void point(SectionBuilder slide, String title, DocumentColor acce card.addParagraph(p -> p .text(body) .textStyle(body(28, ON_DARK_MUTED)) - .lineSpacing(1.4) + .lineSpacing(4 * SCALE) .margin(DocumentInsets.zero())); }); } @@ -471,7 +474,7 @@ private static void ratio(RowBuilder row, String value, String label, DocumentCo card.addParagraph(p -> p .text(label) .textStyle(body(24, ON_DARK_MUTED)) - .lineSpacing(1.25) + .lineSpacing(3 * SCALE) .margin(DocumentInsets.zero())); }); } @@ -506,7 +509,7 @@ private static ChartStyle latencyStyle() { private static ParagraphBuilder footnote(ParagraphBuilder p, String text) { return p.text(text) .textStyle(body(22, DocumentColor.rgb(130, 139, 170))) - .lineSpacing(1.4) + .lineSpacing(3 * SCALE) .margin(DocumentInsets.top(6 * SCALE)); }