vectorcraft/crates/text
dotCooCoo 8754646784 Type: frames and paths beyond 1,000,000,000 pt hold no text, and layout limits its search for room
Opening an EPS whose threaded area type frame has a control point at
x = 8e115 failed with an internal error ("capacity overflow").
`eps_text_frames_never_panic` in `import_fuzz` found it with
PROPTEST_CASES=20000. Text layout flattens a frame to within 0.1 pt,
and for such a curve kurbo 0.13.1's `flatten` calls `reserve` for
`usize::MAX` quadratic pieces. Laying out text around a wrap shape with
such a curve failed the same way. Laying out type on a path along such
a curve panicked in kurbo's `solve_itp` ("attempt to shift left with
overflow") in builds with overflow checks, and in a release build it
did not finish within 20 s. Laying out area type in a triangle frame
that comes to a point at its top, at y = 1e20, did not finish either:
adding a lead to a baseline that large leaves the baseline where it is.

Text layout now leaves out a frame, a text wrap shape or the path of
type on a path that has a coordinate beyond 1,000,000,000 pt either
way, control points included, or a NaN coordinate in an anchor point.
Such a frame or path holds no text, and such a wrap shape is ignored.
PDF export uses the same bound (`MAX_COORD` in
`crates/pdf/src/export.rs`).

Text layout also steps a line down a frame cell at most 100,000 times
to find room for it. In a cell taller than 100,000 leads, a step is the
cell's height divided by 100,000; in a shorter cell, a step is one
lead, as before. Before this change, in a dev build, with triangle
frames that come to a point at their top, laying out text in one
2,000,000,000 pt tall took 9.8 s, and laying out a paragraph whose
Space Before is -1e300 pt in one 1,000 pt tall did not finish within
20 s.
2026-10-13 00:34:40 +07:00
..
build build(web): copy web fonts with cargo xtask, not sh 2026-10-09 17:18:54 +03:00
src Type: frames and paths beyond 1,000,000,000 pt hold no text, and layout limits its search for room 2026-10-13 00:34:40 +07:00
tests Fix #130: installed fonts are found by name whatever ran before 2026-10-06 00:49:06 +07:00
Cargo.toml Type: Thai, Lao, Khmer and Myanmar lines break between words 2026-10-11 19:31:37 +07:00
build.rs Build: generated sources are rewritten only when they change 2026-10-11 07:13:32 +07:00
web-fonts.txt Type: Noto Sans Thai from craft-fonts is the Thai fallback, on the web too 2026-10-11 19:52:08 +07:00