The proof of `maxLength`
- The proof never cuts. With `overflow: truncate` the proof was given a cut
block, which counts as fitting, so a bound element whose box held ten
characters validated clean with `maxLength: 40` and every long value was cut
at print. The proof now runs with cutting off. When it fails, an element
that did not ask for cutting is refused as before; one that did still
validates, since cutting is what its author chose, with the warning
FIT_NOT_PROVEN at every validation carrying `measured.provenCharacters`,
the longest length proven to fit whole (found by halving: fewer characters
never fit worse), against `limit.characters`. No new code: FIT_NOT_PROVEN
already means that the fit of a bound value is not proven.
- A bound element with `maxLength` is judged for legibility, when validated,
at the size the proof shrank to (the floor when it fails and the element
cuts), not at its stated size.
The shrink search
- The size chosen is still exactly the one a search of every quarter-point
step gives, but that search is no longer made. A count that errs only
toward yes says whether a size could hold the text: lines filled at any
character, each held to a width no real line can be under, and a block to
its lines' ascent, pitches and descent. It never refuses a size that fits
and, once it allows a size, allows every smaller one, so the largest size it
allows is found by halving and only the steps from there are laid out. When
one line at the floor is higher than the box nothing is searched, and a cut
tries no line count the box is too low for.
- 1024 characters at 600 dpi from 1000 pt to 1 pt took 180 to 250 ms a fit and
now takes under 1 ms: at most 21 555 characters visited where the search of
every size visits 15.6 million.
- A text is fitted once: what `check` composed is what `paint` draws.
- The text of one scene may take 64 million steps (a character visited while
fitting is one, a character to be drawn 16, a glyph the scene draws for the
first time at a size 4096, since the runtime rasterises it once). The
element that passes it, and every text after it, is SCENE_INVALID at the
element with `textWorkSteps`, as the painted-area limit is. The count is
integer arithmetic: the same on every machine, and the same validated or
rendered. A thousand of the worst elements validate in well under a second.
Ink outside the measure
- TEXT_INK_OUTSIDE_MEASURE was an IllegalStateException thrown while
painting, which failed the whole render after part of the text was on the
label. The dots of a text are now gathered first and reach the label only
when none strayed; otherwise the one element is refused as
TEXT_DOES_NOT_FIT with `glyphsOutsideMeasure` and `dotsOutsideMeasure`. A
literal is held to the glyph bounds when the scene is validated.
- The bound is tested at 1, 2, 300 and 1000 pt as well as from 5 to 72 pt, for
every character of every face at the three resolutions; nothing strays.
Schema and vocabulary
- `fit` declares `maxLines`, `shrinkTo` and `overflow` under `properties` with
`additionalProperties: false`. The three names are in the renderer's and the
host bridge's pointer vocabularies, and a wrong member is reported at the
member (`/elements/3/fit/maxLines`, or in the override that states `fit`).
- A bound number is printed as the schema says: plain decimal digits, no
exponent, no fraction that is only zeros (`1.0E10` prints `10000000000`,
`2.50` prints `2.5`). A number that is not finite is VALUE_MISSING.
Tests
- The widest-advance check covers every character a face draws, inked or not
(a no-break space advances the pen), so a font update cannot break the proof
unseen.
- Property: `fit` equals the search of every size, block for block, over 3600
generated texts, boxes, sizes, floors and line counts.
- The goldens are unchanged. A README beside them records the JDK builds and the
FreeType each ships.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>