Skip to main content

Module scale

Module scale 

Source
Expand description

Coordinate representation and rounding policy.

Scale holds the arithmetic that differs between target coordinate types. Loading takes the same steps whichever one is in use.

Three are provided:

  • Scale26Dot6 matches FreeType: 26.6 coordinates, 16.16 deltas, and rounding where FreeType rounds.
  • ScaleF32 matches HarfBuzz: floating point throughout, no rounding.
  • Unscaled stays in font units, which is what an autohinter needs. It matches Scale26Dot6 at no size, without the round trip through 26.6.

Structs§

FixedTransform 🔒
A component’s 2x2 transform in the 16.16 form FreeType uses.
OffsetRounding
The axes of a composite component’s offset that are rounded to the pixel grid.
Scale26Dot6
Scales font units to 26.6 fixed point, reproducing FreeType’s arithmetic.
ScaleF32
Scales font units to floating point pixels, reproducing HarfBuzz’s arithmetic.
SimplePass
Everything Scale::load_simple_points needs beyond the glyph itself.
Unscaled
Leaves coordinates in font units.

Traits§

Scale
How coordinates are represented and rounded while loading an outline.

Functions§

fold_deltas_into_font_units 🔒
Folds variation deltas into the font unit points, rounding them off the way FreeType does.
hypot_fixed 🔒
Approximate magnitude of a transform basis vector.
read_points_and_phantom 🔒
Reads a simple glyph’s points into dest and appends the phantom points after them.
simple_deltas 🔒
Computes the deltas for a simple glyph of a varying font, and reports whether the caller should take its delta path.