Rust constants
14 constants in daegun 1.2.0, as the compiler exports them. The list is generated from the source, not written out by hand.
Curves and polygons
The shapes a GPU or scanline rasterizer wants: quadratic curves for a shader, flattened polygons for edge walking, and overlaps resolved for a rasterizer that sums coverage.
MAX_CURVES_PER_GLYPHpub const MAX_CURVES_PER_GLYPH: usize = 16_384;The most quadratic curves
glyph_quadsor aQuadraticPengives for one glyph: 16,384.Past it they answer
QuadError::TooComplex. A font is untrusted input, and this bounds what one glyph can cost.MAX_FLATTEN_POINTSpub const MAX_FLATTEN_POINTS: usize = 1_048_576;The most points
flattenreturns, and the most a stroke or embolden may hold: 1,048,576.One curve can flatten to thousands of points, so without a bound a single hostile glyph could reach hundreds of millions.
prepared_outlinedraws nothing for a stroke or embolden past it.MAX_RESOLVE_EDGESpub const MAX_RESOLVE_EDGES: usize = 512;The most edges
resolve_overlapstakes: 512.It tests every pair of edges for a crossing, and a font is untrusted input. Past it the call answers
None.
Hinting
Fitting outlines to the pixel grid: the hinters HintMode chooses, and the hinted points they produce.
FLAG_CUBICpub const FLAG_CUBIC: u8 = 0x02;The
HintedOutlineflag bit for a cubic control point, which only a hinted CFF outline has.FreeType calls it
FT_CURVE_TAG_CUBIC. Two of them come between each pair of on-curve points of a cubic segment.FLAG_ON_CURVEpub const FLAG_ON_CURVE: u8 = 0x01;The
HintedOutlineflag bit for a point that lies on the curve.A point without it is a control point: quadratic unless
FLAG_CUBICis also set.
Metrics
What the font says about itself: its names, its axes, its vertical metrics. Every measurement here comes back on a 1000-unit em, whatever the font's own units are, so a value in pixels is value * px / 1000.0. Outlines are the exception and stay in font units, which upm reports.
DEFAULT_POINT_SIZEpub const DEFAULT_POINT_SIZE: f64 = 12.0;The point size shaping reads
traktracking at whenShapeOptions::point_sizeis not set: 12.
Subpixel
Subpixel antialiasing filters, described for a rasterizer that applies them itself: how many samples a pixel takes, the weights, and how far a glyph's box must grow.
MAX_OVERSAMPLEpub const MAX_OVERSAMPLE: u8 = 4;The most samples a
SubpixelLayouttakes a pixel along one axis: 4.MAX_SUBPIXEL_TAPSpub const MAX_SUBPIXEL_TAPS: usize = MAX_OVERSAMPLE as usize + 4;The widest filter window along one axis, in samples: 8.
MAX_SUBPIXEL_WEIGHTSpub const MAX_SUBPIXEL_WEIGHTS: usize = MAX_SUBPIXEL_TAPS * MAX_SUBPIXEL_TAPS;The most weights one channel holds:
MAX_SUBPIXEL_TAPSsquared, 64.SubpixelLayout::GRAYSCALEpub const GRAYSCALE: SubpixelLayout;The layout of a plain grayscale rasterizer: one sample a pixel, one channel, weight 1.
The default, and the same as
SubpixelLayout::grayscale().
daegun::format
Readers for structures many tables share: Coverage, AAT lookups and state tables, FeatureVariations, and item variation stores.
format::class::DELETED_GLYPHpub const DELETED_GLYPH: u16 = 2;The AAT class of a deleted glyph, 0xFFFF in the glyph stream: 2.
format::class::END_OF_TEXTpub const END_OF_TEXT: u16 = 0;The AAT class of the end of the text: 0.
format::state::START_OF_TEXTpub const START_OF_TEXT: u16 = 0;The AAT state a state machine starts in: 0.
daegun::paint
What a color scene is made of, and the math to draw it: gradient ramps sampled as COLR defines them, and COLR's 28 composite modes for one pixel over another.
paint::IDENTITYpub const IDENTITY: Matrix = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0];Also reachable as
paint::matrix::IDENTITY.The transform that changes nothing.