Rendered widths¶
Measure each unit's rendered text width headlessly — the width-step that drives the walk.
lexograph.layout.widths.rendered_widths(strings, *, prop=None, size=12.0)
¶
Return the rendered width of each string, set in the given font.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strings
|
Iterable[str]
|
One string per unit (typically the sentences). |
required |
prop
|
FontProperties | str | Path | None
|
The font to measure with — a :class: |
None
|
size
|
float
|
The font size to measure at (in points). |
12.0
|
Returns:
| Type | Description |
|---|---|
FloatArray
|
A float array of widths, one per input string. Empty or whitespace-only |
FloatArray
|
strings get a width proportional to their character count so the walk |
FloatArray
|
still advances past them. |
Contract
- The result has one entry per input string, all non-negative.
- Widths are deterministic for a given font, size, and string.
Examples: