You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Prepare text once and reuse the result across repeated layout passes with `Prepare` and `PrepareWithSegments`.
36
37
- Compute fast aggregate metrics with `Layout`, or materialize full line data with `LayoutWithLines`.
37
-
- Stream line geometry incrementally with `LayoutNextLine` and `WalkLineRanges` for custom layout engines.
38
+
- Stream line geometry incrementally with `LayoutNextLine`, `LayoutNextLineRange`, and `WalkLineRanges` for custom layout engines.
39
+
- Re-materialize text lazily with `MaterializeLineRange` after cheap geometry-only probing.
40
+
- Measure widest-line geometry without allocating text via `MeasureLineStats` and `MeasureNaturalWidth`.
38
41
- Handle ordinary spaces, preserved spaces, tabs, hard breaks, non-breaking spaces, zero-width breaks, and soft hyphens.
42
+
- Support `WordBreakMode.KeepAll` for CJK-focused no-space wrapping behavior.
43
+
- Build rich inline flows with `PrepareRichInline`, `WalkRichInlineLineRanges`, and `MaterializeRichInlineLineRange`.
39
44
- Support multilingual text with locale-aware segmentation on desktop targets and bidi-aware segment levels.
40
45
- Depend only on `SkiaSharp` in the core library so the package can be used outside Uno as well.
41
46
- Ship with a published `Pretext.Uno` companion library for reusable Uno host controls and obstacle-aware flow helpers.
42
-
- Ship with deterministic parity tests and a Uno sample app that demonstrates bubbles, masonry, editorial, and justification layouts.
47
+
- Ship with deterministic parity tests and a Uno sample app that demonstrates bubbles, masonry, editorial, justification, rich-inline, and virtualized markdown chat layouts.
43
48
44
49
## Core API
45
50
@@ -50,7 +55,15 @@ Key documentation:
50
55
|`Layout`| Return line count and total height for a given width and line height. |
51
56
|`LayoutWithLines`| Return materialized line text and line widths. |
52
57
|`LayoutNextLine`| Stream the next line from a given cursor for custom layout flows. |
58
+
|`LayoutNextLineRange`| Stream geometry-only line ranges without materializing text. |
59
+
|`MaterializeLineRange`| Turn a `LayoutLineRange` back into a materialized `LayoutLine`. |
53
60
|`WalkLineRanges`| Iterate line geometry without allocating full line text. |
61
+
|`MeasureLineStats`| Return line count plus widest line width for a prepared block. |
62
+
|`MeasureNaturalWidth`| Return the widest unwrapped line width for prepared text. |
63
+
|`PrepareRichInline`| Prepare multi-item inline flow with collapsed boundary whitespace and atomic items. |
64
+
|`WalkRichInlineLineRanges`| Stream rich-inline line ranges without materializing fragment text. |
65
+
|`MaterializeRichInlineLineRange`| Materialize one streamed rich-inline line when you actually need fragment text. |
66
+
|`MeasureRichInlineStats`| Measure rich-inline line count and max line width. |
54
67
|`ProfilePrepare`| Measure preparation cost for profiling and diagnostics. |
55
68
|`SetLocale`| Override locale-sensitive segmentation behavior when needed. |
56
69
|`ClearCache`| Reset cached font state and prepared segment text caches. |
@@ -63,6 +76,7 @@ Key documentation:
63
76
| Actual line text and widths |`PrepareWithSegments` + `LayoutWithLines`|
64
77
| One line at a time in a custom loop |`PrepareWithSegments` + `LayoutNextLine`|
| Rich inline fragments with atomic chips or badges |`PrepareRichInline` + `WalkRichInlineLineRanges`|
66
80
| Preparation cost diagnostics |`ProfilePrepare`|
67
81
68
82
## Quick Start
@@ -95,6 +109,8 @@ foreach (var line in lines.Lines)
95
109
}
96
110
```
97
111
112
+
If the prepared text is empty after normalization, `Layout` returns `new LayoutResult(0, 0)`. If a container in your UI must still reserve one visual row, clamp with `Math.Max(1, metrics.LineCount)` in the caller instead of expecting `Pretext` to synthesize a blank line.
113
+
98
114
The core package exposes the `Pretext` namespace and is not tied to Uno. Use it anywhere you use SkiaSharp.
99
115
100
116
The `font` argument is a CSS-like subset such as `16px Inter`, `italic 16px Georgia`, or `700 18px "IBM Plex Sans"`. Line height is supplied separately to layout calls.
@@ -108,6 +124,32 @@ var prepared = PretextLayout.PrepareWithSegments(
108
124
newPrepareOptions(WhiteSpaceMode.PreWrap));
109
125
```
110
126
127
+
Use `WordBreakMode.KeepAll` when CJK-heavy text should avoid ordinary intra-run breaks:
0 commit comments