Inside macOS
font smoothing
Measured on macOS 15.3
CoreGraphics’ glyph dilation, curve flattening and small-size autohinter, reconstructed in Rust. The outlines match to floating-point precision. The complete renderer comes within 3 alpha levels of native macOS.
Follow-up to Rune vs macOS, pixel by pixel. This time we modelled the smoothing precisely and checked an independent implementation against native CoreText/CoreGraphics output.
The measured result
Inter Regular, 32 device pixels, ink #1d1e22, fractional origin (¼, 1/64). Switch between the actual masks. These illustrations are enlarged 3× without interpolation.
Swash design-unit outlines → recovered pipeline → zeno coverage. No CoreGraphics calls in this Rust render.
A five-bucket formula
The input is the text colour’s linear-sRGB luminance. CoreGraphics rounds it to the nearest quarter, then chooses a size-proportional radius with a fixed cap.
Y = 0.2126 R + 0.7152 G + 0.0722 B
q = round(4 Y) / 4
d = min(ppem × (0.0058 + 0.01 q), 0.3f)
d is a radius: left and right grow by d; the top grows by 2d. The cap is the exact f32 literal 0.30000001192092896, promoted to double. There is no large-size cutoff.
Each line is one luminance bucket. All converge at a 0.3 px radius. The marker follows the controls.
| Linear Y | q | d at 32 px |
|---|---|---|
| 0 to .125 | 0 | .1856 |
| .125 to .375 | .25 | .2656 |
| .375 to .625 | .50 | .3000 |
| .625 to .875 | .75 | .3000 |
| .875 to 1 | 1 | .3000 |
Lower boundary inclusive; upper exclusive except at 1. Encoded grey boundaries are ≈ .389, .646, .812 and .943.
A 4,097-grey internal-function sweep matched the formula at every sample. A separate glyph-mask sweep confirmed the five visible steps at 16 px.
Correction to the earlier report: its .1875/.375 px estimate is close, but the exact dark-ink values at 32 px are .1856/.3712. Alpha quantization hid the difference.
Move whole pieces, then connect them
Expansion exaggerated for clarity. A rectangle becomes an eight-sided outline, not a larger square-cornered rectangle.
- Orient the whole glyph. Reverse all contours together if necessary; preserve the opposite winding of holes.
- Split curves at extrema. Convert quadratics to cubics; split into x/y-monotonic pieces.
- Translate each piece. Its displacement comes from direction signs, not a normalized surface normal.
- Join the pieces with straight lines. This creates the characteristic bevels and grows counters inward.
// y-up coordinates; P → Q is one piece
sx = sign(Q.y - P.y) × d
sy = -sign(Q.x - P.x) × d + d
translate all its points by (sx, sy)
Zero has sign zero. A diagonal receives the full x and y offsets. A monotonic curve keeps its shape and moves as a unit.
The integer-baseline mystery, explained
At small sizes the old study found puzzling changes when a baseline landed exactly on an integer. The answer: a small-size autohinter that warps glyphs vertically.
At eligible integer sizes 7–18 px, with zero vertical phase, CoreGraphics reshapes the outline vertically. It uses the bounding-box tops of the glyphs “o” and “X” to choose snapped target heights, then applies a piecewise y transform to every outline point after dilation.



Inter Regular T, 16 px, integer baseline, shown at 12×. All three use the same font and requested position.
Recovered and checked
The Rust transform matches 180 directly captured native transforms, with maximum parameter error 1.89 × 10⁻¹⁵. No validity decisions disagree.
Target selection uses a historical reference radius min(ppem × .015125, .3); the final transform uses the actual colour-dependent radius.
Also recover the flattening
CoreGraphics recursively halves curves using squared second differences. Its thresholds are .64 for quadratics and .07111111111111111 for cubics.
Flatten to lines with those rules before feeding zeno. This removes most of what previously looked like an irreducible curve-rasterizer difference.
How close is it?
Three fonts; 12 glyphs covering stems, bars, diagonals, curves and counters; ten sizes from 8–72 device px; five colours; four phases; 1× and 2× backing. Error is measured over each glyph’s tight union ink bounds plus one pixel of padding.
| Pipeline vs native smoothed CG | Mean /255 | Max /255 | Pixels >1 | Pixels >8 |
|---|---|---|---|---|
| Unhinted outline → ordinary zeno | 12.79934 | 225 | 22.3954% | 19.7794% |
| + recovered dilation | .85315 | 155 | 5.1096% | 2.8010% |
| + CoreGraphics flattening | .25892 | 155 | 1.6488% | .4665% |
| + phase before dilation | .24280 | 155 | 1.4489% | .3975% |
| + recovered autohinter | .11293 | 3 | .7458% | 0% |
| Independent Swash outlines & metrics¹ | .10949 | 3 | .7079% | 0% |
First five rows: 14,400 cases / 7,115,310 cropped pixels, using unhinted CoreText outlines to isolate each stage. ¹9,600 Inter Regular/Bold cases / 4,910,896 pixels, with the entire tested Rust path using Swash extraction and its own font metrics. Reference masks always come from public CTFontDrawGlyphs.
Not byte-exact yet. Apple uses 12-bit vertex coordinates and its own fixed-point slope and coverage arithmetic. Zeno’s line rasterizer differs slightly. An independent analytic-area experiment reduced the >1 share to .0933%, but its maximum is still 3. The remaining work is scan conversion, not a missing smoothing-strength heuristic.
What this does and does not establish
The ≤3 bound is measured for this corpus on macOS 15.3. It covers integer baselines as well as fractional positions. It does not establish universal identity for arbitrary cubics, rotations/shears, variable or colour fonts, HDR colours, other font-provider eligibility rules, or later macOS versions. Main-corpus subpixel quantization is disabled to isolate the requested phases. The earlier ¼-point flooring observation remains a separate upstream positioning concern.
A practical path for Rune / Swash
Extract at unitsPerEm, then scale in f64. Swash’s final-size outline extraction has already rounded coordinates. Feeding those points into the correct algorithm left outliers up to 65 levels; using design-unit outlines reduced the maximum to 3.
let outline = scaler_at_units_per_em.scale_outline(glyph_id)?;
let path = scale_path(&from_zeno(outline.path().commands()), ppem / upem);
let prepared = prepare_outline(&path, ppem, srgb_ink, phase, metrics);
// prepared is a polyline; rasterize it with zeno.
Cache by luminance bucket as well as font, size and phase. Composite ordinary coverage in the context’s encoded colour space to match the tested CG context. Drop the earlier compensating coverage-gamma adjustment when using this model.
Two more corrections from the experiments
Alpha-only does not mean white. An alpha-only context with explicitly black ink produced exactly the black RGBA mask; white ink produced the white mask. The previous harness happened to set white. The private setters do not override modern text weight. Dilation 0/1, several smoothing styles and contrast 0/10 all left the tested draw unchanged, because the drawing delegate temporarily replaces the settings with its colour-dependent custom style.
Prior art
Prior art helped find the right trail: Pathfinder’s historical constants, WebRender’s colour-aware masks, Skia’s mac scaler, and Zed’s 2026 luminance-bucket investigation. The current grayscale algorithm takes a different branch from the older Pathfinder factors.