Repository navigation
forme 0.6.0
Bounded shaping through a clone the caller already owns, at the allocation
cost of unbounded shaping. Closes #882, filed against 0.5.0.
Face.ShapeGlyphsBounded is ShapeGlyphsContext on the receiver, for a
caller that keeps its own clones, one per goroutine:
- It makes no clone. The glyphs it shapes are recorded on the receiver, as
ShapeGlyphsrecords them, for the caller to merge. A run that fails may
have recorded some before it stopped. - Its budget is kept on the face and reset each call, so the bounds
allocate nothing per run.Clonedoes not share it. - The limits and failures are those of
ShapeGlyphsContext, which is now
this on a fresh clone. - A face already under a budget, such as the one
WithShapingLimitshands
out, refuses it.
The context is now asked every 64 work charges, not at each one, and still
at every boundary between phases. Each ask was an interface call, and a
lock for a cancellable context.
On 14-character NotoSans labels with a cancellable context (medians):
unbounded 8.5 µs 2,784 B 19 allocs
ShapeGlyphsContext, 0.5.0 11.2 µs 4,287 B 26 allocs
ShapeGlyphsContext, now 10.0 µs 4,286 B 26 allocs
ShapeGlyphsBounded on a clone 9.3 µs 2,784 B 19 allocs
The whole suite with every corpus, and go test -race ./..., passed on CI
for the pull request in this release.
Pre-1.0. This adds exported API (ShapeGlyphsBounded) and removes none.