Skip to content

Commit 312259b

Browse files
authored
docs(examples): gallery entries for inline chips, SVG, emoji, in-PDF navigation (#256)
Four v1.9.0 features visible in a rendered document had no gallery presence. Add a row + detailed showcase section + a committed preview render for each, with the API names read off the runnable *Example classes: - Inline highlight chips (RichText.code / chip / highlight) — Core DSL. - Inline SVG icons (RichText.svgIcon) — Core DSL. - Colour emoji by shortcode (RichText.emoji) — Core DSL. - In-PDF navigation (anchor / linkTo / inlineLinkTo / shapeLinkTo) — Advanced SPI. The emoji preview uses the 44 KB shortcode showcase; the full emoji-gallery render is 3.9 MB, too large for a committed README asset.
1 parent dba858a commit 312259b

5 files changed

Lines changed: 79 additions & 0 deletions

File tree

43.6 KB
Binary file not shown.
2.42 KB
Binary file not shown.
3.71 KB
Binary file not shown.
3.85 KB
Binary file not shown.

examples/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ are with the canonical DSL, then jump to its detailed section below.
6969
|---|---|---|
7070
| [Rich text](#rich-text) | Every `RichText` method (bold / italic / underline / link / colour / accent / size / append) | [PDF](../assets/readme/examples/rich-text-showcase.pdf) · [Source](src/main/java/com/demcha/examples/features/text/RichTextShowcaseExample.java) |
7171
| [Inline shapes](#inline-shapes) | `InlineShapeRun` — dots, arrows, chevrons, diamonds, stars, checkmarks and checkboxes drawn as geometry on the text baseline | [PDF](../assets/readme/examples/inline-shapes.pdf) · [Source](src/main/java/com/demcha/examples/features/text/InlineShapesExample.java) |
72+
| [Inline highlight chips](#inline-highlight-chips) | `RichText.code(text)` / `chip(text, fg, bg)` / `highlight(text, style, bg, radius, padding)` — text on a rounded padded fill (inline code + status badges), wrapping across lines | [PDF](../assets/readme/examples/inline-highlight-chips.pdf) · [Source](src/main/java/com/demcha/examples/features/text/InlineHighlightExample.java) |
73+
| [Inline SVG icons](#inline-svg-icons) | `RichText.svgIcon(icon, size)` — a parsed multi-colour `SvgIcon` on the text baseline, crisp at any zoom and carrying its own colours | [PDF](../assets/readme/examples/inline-svg-icons.pdf) · [Source](src/main/java/com/demcha/examples/features/text/InlineSvgIconExample.java) |
74+
| [Colour emoji](#colour-emoji) | `RichText.emoji(":star:", size)` — GitHub-style shortcodes resolve to inline vector glyphs via the `graph-compose-emoji` artifact; unknown codes fall back to literal text | [PDF](../assets/readme/examples/emoji-shortcodes.pdf) · [Source](src/main/java/com/demcha/examples/features/text/EmojiShortcodeExample.java) |
7275
| [Section presets](#section-presets) | `pageBackground`, `band`, `softPanel`, `accentLeft / Right / Top / Bottom`, per-corner `DocumentCornerRadius` | [PDF](../assets/readme/examples/section-presets.pdf) · [Source](src/main/java/com/demcha/examples/features/text/SectionPresetsExample.java) |
7376
| [Nested lists](#nested-lists-v16) | `ListBuilder.addItem(label, Consumer)` — depth cascade, per-depth markers, mixed flat / nested authoring | [PDF](../assets/readme/examples/nested-list-showcase.pdf) · [Source](src/main/java/com/demcha/examples/features/lists/NestedListExample.java) |
7477
| [Composed table cells](#composed-table-cells-v16) | `DocumentTableCell.node(DocumentNode)` — paragraphs, lists, sub-tables inside cells with two-pass measurement | [PDF](../assets/readme/examples/composed-table-cell-showcase.pdf) · [Source](src/main/java/com/demcha/examples/features/tables/ComposedTableCellExample.java) |
@@ -105,6 +108,7 @@ are with the canonical DSL, then jump to its detailed section below.
105108
| [PDF chrome](#pdf-chrome) | `DocumentMetadata`, `DocumentWatermark`, `DocumentHeaderFooter`, `DocumentBookmarkOptions` | [PDF](../assets/readme/examples/pdf-chrome.pdf) · [Source](src/main/java/com/demcha/examples/features/chrome/PdfChromeExample.java) |
106109
| [Page numbering](#page-numbering) | `DocumentPageNumbering` — offset / restart / roman / suppress-on-first-page for `{page}` / `{pages}` footer tokens | [PDF](../assets/readme/examples/page-numbering.pdf) · [Source](src/main/java/com/demcha/examples/features/chrome/PageNumberingExample.java) |
107110
| [Viewer preferences](#viewer-preferences) | `chrome().viewerPreferences(...)` — open with the bookmark panel (`USE_OUTLINES`), set page layout, or show the doc title in the window | [PDF](../assets/readme/examples/viewer-preferences.pdf) · [Source](src/main/java/com/demcha/examples/features/chrome/ViewerPreferencesExample.java) |
111+
| [In-PDF navigation](#in-pdf-navigation) | `anchor(...)` destinations + internal `linkTo(...)` / `inlineLinkTo(...)` / `shapeLinkTo(...)` — clickable cross-references and footnotes as native PDF GoTo actions; forward references resolve in a deferred pass | [PDF](../assets/readme/examples/in-pdf-navigation.pdf) · [Source](src/main/java/com/demcha/examples/features/navigation/InPdfNavigationExample.java) |
108112
| [Page references](#page-references) | `addPageReference(anchor)` — print the page an `anchor(...)` lands on (a native "see page N" cross-reference), resolved in one authoring pass | [PDF](../assets/readme/examples/page-reference.pdf) · [Source](src/main/java/com/demcha/examples/features/navigation/PageReferenceExample.java) |
109113
| [Table of contents](#table-of-contents) | `addTableOfContents(toc -> toc.entry(label, anchor))` — a native clickable TOC with dot leaders and auto-resolved page numbers | [PDF](../assets/readme/examples/table-of-contents.pdf) · [Source](src/main/java/com/demcha/examples/features/navigation/TocExample.java) |
110114
| [Container bookmarks](#container-bookmarks) | `section.bookmark(new DocumentBookmarkOptions(title))` — make a section / container a PDF outline (bookmark-panel) target | [PDF](../assets/readme/examples/container-bookmark.pdf) · [Source](src/main/java/com/demcha/examples/features/navigation/ContainerBookmarkExample.java) |
@@ -642,6 +646,62 @@ via `CheckmarkStyle` / `ArrowStyle`.
642646
[📄 View PDF](../assets/readme/examples/inline-shapes.pdf) ·
643647
[📜 Full source](src/main/java/com/demcha/examples/features/text/InlineShapesExample.java)
644648

649+
### Inline highlight chips
650+
651+
`RichText.code(text)` / `chip(text, fg, bg)` / `highlight(text, style, bg,
652+
radius, padding)` (`@since 1.9.0`) draw text on a rounded, padded background
653+
fill on the baseline — the GitHub inline `code` look and inline status badges.
654+
`code` ships engine defaults (monospace + a light chip), `chip` colours a
655+
badge, and `highlight` is the full primitive. A multi-word highlight wraps
656+
across lines, painting one continuous rounded fill per visual fragment. On
657+
`ParagraphBuilder` the calls are `inlineCode` / `inlineChip` / `inlineHighlight`.
658+
659+
```java
660+
.addRich(rich -> rich
661+
.plain("Run ").code("./mvnw verify").plain(" — status ")
662+
.chip(" Paid ", paidFg, paidBg)
663+
.highlight("rounded", style, fill, 8.0, DocumentInsets.symmetric(2, 8)))
664+
```
665+
666+
[📄 View PDF](../assets/readme/examples/inline-highlight-chips.pdf) ·
667+
[📜 Full source](src/main/java/com/demcha/examples/features/text/InlineHighlightExample.java)
668+
669+
### Inline SVG icons
670+
671+
`RichText.svgIcon(icon, size)` / `ParagraphBuilder.inlineSvgIcon(...)`
672+
(`@since 1.9.0`) place a parsed `SvgIcon` on the text baseline, so multi-colour
673+
vector glyphs flow inside a line of text — crisp at any zoom, carrying their own
674+
colours, with no dependence on the active font's glyph coverage. `size` is the
675+
glyph height in points; width follows the icon's aspect ratio. This is the
676+
engine path behind vector colour emoji.
677+
678+
```java
679+
.addRich(rich -> rich
680+
.svgIcon(check, 10).plain(" Deploy succeeded ")
681+
.svgIcon(warn, 10).plain(" Disk almost full"))
682+
```
683+
684+
[📄 View PDF](../assets/readme/examples/inline-svg-icons.pdf) ·
685+
[📜 Full source](src/main/java/com/demcha/examples/features/text/InlineSvgIconExample.java)
686+
687+
### Colour emoji
688+
689+
`RichText.emoji(":star:", size)` / `ParagraphBuilder.inlineEmoji(...)`
690+
(`@since 1.9.0`) resolve a GitHub-style shortcode to an inline vector colour
691+
glyph on the baseline — crisp at any zoom, no emoji font required. Glyphs come
692+
from the `graph-compose-emoji` companion artifact on the classpath. Resolution
693+
is lenient: an unknown shortcode falls back to its literal text, exactly the way
694+
GitHub renders an unrecognised `:code:`.
695+
696+
```java
697+
.addRich(rich -> rich
698+
.plain("Ship it ").emoji(":rocket:", 11).plain(" ")
699+
.emoji(":white_check_mark:", 11).plain(" ").emoji(":tada:", 11))
700+
```
701+
702+
[📄 View PDF](../assets/readme/examples/emoji-shortcodes.pdf) ·
703+
[📜 Full source](src/main/java/com/demcha/examples/features/text/EmojiShortcodeExample.java)
704+
645705
### Section presets
646706

647707
`pageBackground`, `band`, `softPanel`, the four
@@ -780,6 +840,25 @@ document.chrome().viewerPreferences(DocumentViewerPreferences.builder()
780840
[📄 View PDF](../assets/readme/examples/viewer-preferences.pdf) ·
781841
[📜 Full source](src/main/java/com/demcha/examples/features/chrome/ViewerPreferencesExample.java)
782842

843+
### In-PDF navigation
844+
845+
`anchor(name)` marks a destination on a section, paragraph, or inline run;
846+
`linkTo(label, style, anchor)` / `inlineLinkTo(text, anchor)` /
847+
`shapeLinkTo(shape, color, anchor)` (`@since 1.9.0`) jump to it as native PDF
848+
`GoTo` actions — a clickable table of contents, `[text](#heading)`-style links,
849+
and bidirectional footnotes. Anchors resolve in a deferred pass, so a link may
850+
target an anchor that appears later in the document (a forward reference).
851+
External `link(label, new DocumentLinkOptions(url))` is unchanged.
852+
853+
```java
854+
.addRich(RichText.text("See the ").linkTo("overview", linkStyle, "overview"))
855+
// …further down…
856+
.addSection("Overview", s -> s.anchor("overview") /**/)
857+
```
858+
859+
[📄 View PDF](../assets/readme/examples/in-pdf-navigation.pdf) ·
860+
[📜 Full source](src/main/java/com/demcha/examples/features/navigation/InPdfNavigationExample.java)
861+
783862
### Page references
784863

785864
`addPageReference(anchor)` prints the page a declared `anchor(...)` lands on — a

0 commit comments

Comments
 (0)