Skip to content

forme 0.9.0

Choose a tag to compare

@mgilbir mgilbir released this 07 Oct 10:54
· 89 commits to main since this release
4b93a52

Bounded shaping that admits ordinary text and documents, layout under a context and one budget, and bitmap strikes a caller can list and choose from. From #915 to #918 and #923.

Bounded shaping is charged for the work it does (#916, #919)

  • A bounded run is charged for each subtable, ligature and rule tried and each glyph a match walks over, rather than each subtable's size at every position.
  • A byte of Latin now costs about 47 units, Devanagari about 300 and Noto Nastaliq about 350, against about 460,000 and 8 million before. The 64M default admits MaxInputBytes of any of them with about fifty times to spare.
  • A font's runaway rules are still charged in full, and unbounded shaping is as fast as it was.

One budget for a document (#917, #920, #923, #924)

  • layout.ComposeContext(ctx, in, opts, limits) composes a document with every run it shapes or measures, in any of its faces, charged to one shape.ShapingBudget. It fails with the context's error or one wrapping ErrRunLimit and a zero Composed, never with a composition that stopped part way. Composed.ShapingWork is what it charged. Compose is unchanged.
  • shape.ShapingBudget (NewShapingBudget, Bound, Run) shares one budget across any number of faces a caller owns.
  • A budget's zero fields are a document's defaults, which grow with what it shapes: no bound on a run's length (layout shapes a paragraph as one run), glyphs of 32,768 or 64 per byte of the longest run, and 64M units of work plus 1,024 per byte. A field the caller sets is a fixed bound.

Bitmap strikes (#915, #918, #921, #922)

  • PaintOptions.Bitmaps paints a glyph of a face with outlines from its EBDT or bdat strike, as a face with none is painted: for a writer of a font licensed for bitmap embedding only. GlyphColourFor is GlyphColour for given paint options. A face with outlines is still measured from them.
  • Face.Strikes lists a face's CBDT, sbix and EBDT or bdat strikes, smallest first. Face.StrikeImage is a glyph's image in exactly one of them. Image.Strike says which strike a painted image is from.