Skip to content

Parity log ​

Round-by-round record of the native-parity investigations: what was measured, the probes and captures behind each rule, and what was ruled out. The open items are summarised in Outstanding work; the user-facing summary is Limitations.

Windows reference images come from scripts/gdi-fixtures. The Windows fixtures workflow (.github/workflows/windows-fixtures.yml) runs those scripts on a GitHub-hosted Windows runner and pushes the output to a windows-fixtures/<run_id> branch. See scripts/gdi-fixtures/README.md.

The 12 October 2026 native parity review records the newer baseline, portable extent-scaling and bilinear/texture fixes, and the assessment of Rust/open-source alternatives. The round-by-round measurements below retain their original dates.

Independent fractional RoundRect translation controls cover 576 paths in both arc directions; every native translation and every replay path is exact.

Windows picture sweep, 18 November 2026 ​

Against the same 910 Windows references, exact comparisons rose from 898 to 910 and differing RGB pixels fell from 371 to zero. Each comparison uses zero RGB tolerance in the common area. Render sizes and out-of-extent ink counts stayed the same for all 910 pictures.

  • ClearType adds and saturates each glyph's channel levels, then snaps the result to reachable levels before adding the next glyph. Native GDI pair and triple controls cover this order. GDI ClearType scans its oversampled outlines with the integer scan converter already used for GDI monochrome and grayscale. This resolves the remaining sample-centre ties in Arial 12 px u, Arial 36 px g and Segoe UI 18 px $. Arial ClearType Natural improved from 73 to zero pixels, four Arial variants improved from 49 to zero each, and Segoe UI improved from 32 to zero. In 8,418 independent private-font controls, 95 additional glyphs match exactly and none gets worse.
  • Installed-font GDI+ ClearType uses the native crossing rules and applies ordinary y SHPIX after IUP[y]. The text and text-contrast pictures improved from 11 and 44 pixels to zero. Mixed DrawString diagnostics gained 123 exact cases out of 2,320 and 44 out of 150. Two sets of already-inexact cases gained 116 pixels across 68 captures and five across three, respectively. The tests pin those individual bounds.
  • Installed upright fonts in default-format grid-fitted monochrome DrawString use signed nearest point moves. Both report pictures improved from one pixel to zero. A Windows sweep of 12,408 isolated glyphs under the same conditions improved from 401 pixels to zero.
  • Fractional one-pixel GDI+ grayscale underlines use the nominal-width stroke rasteriser. This removed three pixels from AntiAlias. Installed fonts also apply horizontal SHPIX to points touched in both axes before IUP. Windows shifted the right serif of Times New Roman Italic 22 px T by 6/64 pixel. That change removed the final six and four pixels from AntiAlias and AntiAliasGridFit. The two grayscale hints match at all 32 native phases. In the 31,584-capture grayscale corpus, 30 more glyphs match exactly and none gets worse.

Wider Windows captures, 18 November 2026 ​

Expanded native playback of the four wide-pen ellipse sheets and the four System and Fixedsys sheets now covers all 61,411 RGB ink pixels outside the old reference bounds. The previous converter already matched the expanded references over every painted pixel. The report moves from 902 to 910 complete matches without a renderer change.

The ellipse captures use a 500 × 380 surface at device origin (−16, −16). The raster-font sheets use 1120 × 768 at (−20, −20), which includes ink above y=0. Each wider image reproduces its original crop exactly. A second capture on a different surface reproduces the same ink for each case.

The two original text sheets need VGA Fixedsys and System. Ordinary playback on the capture machine selects the 8514 faces and disagrees with the original crops by 21,624 and 12,850 pixels. The generator extracts the VGA bitmap resources and loads them with process-private family aliases. It changes only the family name fields in temporary replay copies. The two regenerated sheets use ordinary playback with 8514. The generator writes expanded PNGs alongside the original fixture inputs. Capture sizes and origins · Environment and hashes

Current parity priorities (8 October 2026) ​

The full suite passes: 202 files, 6,777 tests (8 October 2026, after round 6 with its eight workstreams and the reinstated ClearType dropout control; 186 files and 6,328 tests after round 5). Passing the existing bounds does not mean pixel-exact playback. bun scripts/gdi-fixtures/report.ts uses available Windows fixture fonts, reports both zero-tolerance and >8-level RGB differences, includes overlap edges, and prints rendered/reference dimensions. On this machine (report regenerated on 8 October 2026 on the head that includes rounds 1 to 6; at the end of round 5 509 of 737 were exact and 503 of 737 had complete ink coverage, 420 of 625 and 417 of 625 at the end of round 4, 396 of 614 and 394 of 614 at the start of round 4; the comparison count grew by 112 with the round-5 sheets and by 132 with the mirrored-map sheets of round 6), 637 of 869 comparisons are RGB-exact over their common device area, with no render failures (round 6: the 132 mirrored-map sheets added 111 exact ones, and 15 compat-playback-* sheets whose arcs were wrong became exact); 634 of 869 also have complete RGB ink coverage (white margins ignored, alpha checked separately only where individual tests require it). No comparison omits reference ink since round 6 (the four codec-jpeg-*-playback comparisons, 12bit, arithmetic, arith-prog-420-dri2 and cmyk-photo, used to: their 280x180 render was smaller than the 300x200 reference, 9,600 pixels each; the 9,600 pixels were the probe's own magenta surface, see References), and 13 contain rendered ink beyond the captured reference (18 at the end of round 5) (the nine clipped references of References, the two regenerated raster-face captures textx-fon-system.regen and textx-fon-fixedsys.regen, whose output equals their own .regen.wide captures, src/gdi-text-regeneration.fixture.test.ts, the two mirrored sheets compat-playback-mx-r34-geo5 and compat-playback-mxy-r34-geo5, which paint 4 pixels past their 420 x 300 capture (the same unverified-extent case: no native playback into a larger surface was captured for them, so the extra ink is unverified rather than known to be wrong), and, before round 6, seven compat-playback-* sheets, the geosq9 sheets of the identity, 32x11, 34 and 43 maps and the wide7 sheets of the identity, 32x11 and 34 maps, where our output is 1 to 90 pixels larger than the 420 x 300 capture and 16 to 260 inked pixels fell outside it; round 6 played the seven natively into larger surfaces: the ink beyond the capture is at negative device coordinates (the converter canvas origins are -1 to -8 in x and -5 to -53 in y), Windows paints exactly those pixels and no others, the original overlap is reproduced pixel for pixel, and the differences over the full area stay within the ceilings pinned in playback-extents.json (0, 0, 0, 2, 7, 55 and 6 pixels for the seven sheets; the arc fix of round 6 has since lowered the sheets' own residuals in src/emf-compat-playback.fixture.test.ts to 14 pixels at most), so the extra ink was right and the 420 x 300 captures were the clipped side). Expanded native playback covers 101 formerly uncaptured extents and reproduces every original overlap pixel (src/gdi-playback-extents.fixture.test.ts); 71 of the 101 full-area controls are exact and the others differ chiefly in text. The remaining 9 captures did not reproduce the original reference; their native playback is committed as .wide.png and shows the converter extent is right. This is a local baseline, not a claim of full-image or cross-environment parity: references are composited over white, alpha is not compared independently, dimensions can differ, and old font captures have incomplete provenance.

Work in this order, using native captures and tighter regression bounds for every confirmed fix:

PriorityGapEvidence and next step
1End-to-end reference validity and coverageRounds 1 to 5 closed: the playback extents (101 expanded captures validated, all reproduce their original overlap; round 6 added the seven compat-playback-* sheets whose output extends past the 420 x 300 capture), the nine ink-beyond-reference text comparisons as clipped references, the HALFTONE transition, selection and arrangement controls and the eight pen anchor/dash reference-scaling discrepancies. Closed in round 6: the four codec-jpeg-*-playback comparisons (the 280x180 extent is right; the 300x200 reference carried 9,600 pixels of the probe's own magenta surface). Closed (round 7, workstream E): textx-fon-system and textx-fon-fixedsys: the originals reproduce exactly with the fixture font set and the regenerated captures with 8514sys.fon and 8514fix.fon added; the report's .regen rows had been rendered without them (see the raster faces item under Text). Remains, with the data that would decide it: the glyph residuals of row 2, and the two mirrored sheets compat-playback-mx-r34-geo5 and compat-playback-mxy-r34-geo5 (4 pixels of ink past the 420 x 300 capture; native playback of those two into a larger surface, as PlaybackExtentProbe did for the seven round-5 sheets, would show whether Windows paints them too). The nine remaining ink-beyond-reference text comparisons are settled as clipped references (see References below), not output-extent errors; their glyphs were recaptured on 8 October 2026 (seven reproduce directly; the Arial gaps are recorded-advance differences, see References; Segoe UI large lines, the rotated text and the two raster faces are explained there as well and still differ from their originals), then the text residuals exposed by the 94 validated expanded native captures. emfrec-ca-control-log-ramp is now pixel-exact (it was a 15.61% >8-level residual: its source takes the filtered branch). The 144 halftone-transitions, 240 halftone-selection and 50 halftone-arrangement captures all follow the selection rule in the HALFTONE section below; all 50 arrangement controls and all 240 selection controls are exact (the 48 filtered 3x stretches closed on 8 October 2026, see HALFTONE below). The eight pen anchor/dash reference-scaling discrepancies are closed.
2Text coverage and rasterisationRounds 1 to 5 closed: grayscale quarter-pixel placement and coverage, ClearType sixth-pixel x origins, natural-width flags, the size-specific x SHPIX shifts, y DELTAPs after IUP[y], the instruction-budget bug, the monochrome default dropout control and grayscale SCANTYPE 0 and 4, the rotated-glyph matrix and the raster mapper's 5x horizontal stretch limit. Closed as not reproducible by a stateless converter: the per-product versus combined projection rounding of diagonal hinting (the native arithmetic of the references changes between runs on one machine, 2,492 of 31,584 captures; see Text, "Grayscale hinting and scan conversion"). Round 6 (W1) closed: the scan converter's dropout control under ClearType (SCANCTRL/SCANTYPE on the 6 x 1 samples; it was first measured and withheld because it made two exact size-sheet captures inexact, Arial 11px g and Tahoma bold 18px y, and reinstated once the project owner accepted those two as known losses for the gain: 2,247 to 2,890 of the 3,720 size-sheet captures exact, see Text, "ClearType dropout control"), the ALIGNRP question (native honours ALIGNRP in every position; the Times New Roman Regular bowl glyphs were the storage 8 flag, see Text, "ALIGNRP around the IUPs"), storage 8 reading as 0 under backward-compatible ClearType (the Monotype fonts' small-size block of corner-squaring calls after the IUPs is never run: 2,890 to 3,059 of the 3,720 size-sheet captures exact with the dropout control, 2,247 to 2,369 without it; 14,607 to 15,050 grayscale text-real-glyphs captures, see Text, "Storage 8"), the grayscale stub rule for SCANTYPE 1 and 5 (15,050 to 15,094 of the 31,584 text-real-glyphs captures, see Text, "Grayscale stub rule"), MSIRP distances (native applies the literal distance along y whatever the cut-in; the real-font size sheet is unchanged at 3,059, see Text, "MSIRP distances"), and GDI+ ClearType of the system Courier New (a half-pixel widening of every sample row plus a one-sample leak rule: 886 of 1,976 captures exact with the two rules from none, 1,043 with the dropout control and 1,114 with the storage 8 rule, the straight-edged glyphs 237 of 248; see Text, "Courier New under GDI+ ClearType"). Round 6 (W2) negative results: DrawString placement has no defect left (96 of the 144 independent placement controls are exact and the other 48 are only the W and g glyph shapes, src/gdiplus-drawstring-placement.fixture.test.ts), and the compatible-mode playback stretch stays unapplied (it is the playing device's own eyScale / exScale; applying it would move textx-segoeui-cell-mono from exact against its reference PNG to 989 pixels off). Remains, with the data that would decide it: ClearType diagonal and curved edges (now including Courier New's bowls and what the storage 8 rule leaves of the Times New Roman Regular bowl glyphs), Courier New under GDI's own ClearType (unmeasured), the stub rule for monochrome SCANTYPE 1 and 5 (glyphs with several dropouts near one tip), the glyph shapes behind the 48 DrawString controls (the diagonal and curved hinting of W and g, the glyph-rasterisation item rather than layout), the spread of integer advances over a long ClearType string (see Text, "Open for ClearType glyphs"), and the stretch-sensitive heights of faces that follow neither rule (Georgia, Trebuchet MS, Microsoft Sans Serif; the rasteriser's own scale arithmetic would decide it, see Further parity rounds); the data that would decide each is listed under Text. textx-plus-antialias, textx-plus-antialiasgridfit, textx-plus-cleartype and gpx-rec-textcontrast retain 2.69%, 2.49%, 9.10% and 2.84% beyond eight levels in the regenerated report of 8 October 2026 (3.11%, 2.49%, 9.55% and 2.84% at the end of round 5; the parity test's own metric gives 2.734%, 2.527% and 9.236% for the first three, from 3.157%, 2.527% and 9.694% after round 5, and 10.216% for the ClearType sheet before the size-specific SHPIX and DELTAP rules; textx-arial-cleartype, textx-segoeui-cleartype and gpx-rec-textcontrast-cleartype are at 4.48%, 1.90% and 3.30% beyond eight levels). The three textx-plus antialias/ClearType PNGs were reproduced exactly with current native fonts, ruling out font drift for those comparisons. The 3,328 baseline-controlled text-coverage captures isolate glyphs from DrawString layout; 2,400 grayscale controls at quarter-pixel origins and every captured contrast mapping are exact. A further 1,664 ClearType captures verify 576 quarter-origin RGB controls and all per-channel contrast mappings. GDI+ coverage now truncates subpixel samples and reports natural widths to font hint programs. Fractional DriverString origins now preserve both grayscale phases and ClearType x phases. Of 144 independent DrawString controls, 88 closed glyph/format controls are exact. Round 6 (src/gdiplus-drawstring-placement.fixture.test.ts): 96 of the 144 are in fact exact; the other 48 are only the W (Arial 16 and 40 px, Times New Roman 22 px) and g (Arial 40 px ClearType, Times New Roman 22 px) glyph shapes, they differ by the same pixel count at phase 0 and 0.25, and no whole-pixel shift of our output in x or y lowers any of them, so the family has no placement defect left; what remains is the diagonal and curved hinting of those glyphs (the glyph-rasterisation row, not layout). Independent 1/64-pixel x origins establish nearest-quarter grayscale placement: 1,280 additional controls are exact. A further 2,304 vertical-origin captures establish nearest-quarter grayscale y placement, closing another 1,280 controls with no capture regressions. Another 384 ClearType controls pin integer vertical placement. ClearType x origins now round to the nearest sixth pixel while retaining that fraction through scan conversion, closing 384 fine-origin RGB controls and preserving all prior exact captures. ClearType x hinting now honours native's size-specific SHPIX shifts (see Text): 80 more baseline-controlled ClearType controls are exact (Arial 16 I, g, 1, 4, 8; 368 of the 832 contrast-0 captures, 288 before) and 3,720 new size/style captures go from 2,015 to 2,247 exact with one lost. Fine-origin channel differences fall from 42,600 to 22,432. Some formerly inexact captures retain larger local residuals; diagonal/base outline hinting remains open. Another 432 private diagnostic-font GetGlyphOutline controls isolate exact vector normalization and one-unit projection/movement errors. The candidate primitive correction regresses existing exact real-font controls and is not shipped. Another 1,728 independent GDI+ private-font captures pin 375 exact controls individually; the candidate still loses prior exact real-font controls and increases eleven formerly inexact diagnostic residuals. Another 576 signed native outlines and 2,304 signed GDI+ images isolate projection, original-distance scaling and movement arithmetic; 436 outlines and 1,344 signed images are currently exact with individual bounds. The candidate closes all signed outlines but increases four formerly inexact signed image residuals and still loses fifteen prior exact real-font controls, so it remains excluded from production. The fifteen are one glyph (src/ttf-diagonal-projection.fixture.test.ts): Arial 16 y under TextRenderingHintAntiAlias, fifteen origins that the two contrasts double to 30 captures, and the same candidate gains 64 captures of Times New Roman Italic 22 a (both AntiAlias and AntiAliasGridFit); over the 3,328 + 2 x 1,536 grayscale captures nothing else changes. The freedom-vector half of the candidate (fDotP = 16384 when the vectors are equal) changes no capture, so the whole effect is the per-product projection. The first divergence in Arial y is an MDRP[0xC4] at byte 565 projecting the difference (142, -475) on (-15513, -5270): combined rounding gives 18, per-product 19, and native keeps 18 (the GDI diagnostic font opcode-mdrp, built from exactly these vectors and operands, follows per-product arithmetic through GetGlyphOutline, so classic GDI and GDI+ AntiAlias disagree on identical operands). Enumerating every assignment of the four (Arial) and four (Times New Roman Italic) disagreeing projections of the two glyphs and keeping the assignments that reproduce the native image determines three of them: Arial's MDRP project (142, -475) must be combined-rounded; Times New Roman Italic's MIRP dualProject (95, -52) and MDRP project (-16, -113) must be per-product rounded. The condition is therefore not the opcode (two MDRPs), not project against dualProject, not equal projection and freedom vectors (the Italic MDRP has them equal, Arial's does not, but the Italic MIRP's dual vector also differs from its freedom vector), and not a different rounding of the sum: truncating the exact sum fits all three determined projections but loses 576 closed captures, flooring it 574 (and gains 32), and rounding the exact sum to nearest, which is the production arithmetic, changes nothing. The two leads this left were followed in round 5 and neither separates the calls: the x coordinates of the v40 (ClearType-style) interpreter carrying more than 26.6 precision (unrounded x coordinates throughout, the crudest form, lose 2,819 and 4,349 captures), and GDI+ captures of the private diagnostic fonts through DrawDriverString with the AntiAlias hint (text-opcode-coverage and text-vector-stage-coverage, 3,072 and 2,560 images), because the references themselves change between runs. Round 5 (V1) closed this item as not reproducible by a stateless converter: no arithmetic condition separates the calls, and the exclusion tracks a native state that changes between runs (see Text, "Grayscale hinting and scan conversion"). Round 8 (R2) closed: GDI+ grayscale text answers GETINFO as gray ClearType (15,747 to 17,113 of the 31,584 text-real-glyphs captures exact), AntiAliasGridFit spaces glyphs by GDI's own interpreter widths, default-format ClearTypeGridFit by the ClearType phantom-point advance rounded (1,230 of 1,230 whole-number glyphs), and the generic SHPIX helpers stop after IUP[y] (see Text, "GDI+ text (round 8, R2)"); gpx-rec-textcontrast 1,994 to 302 differing pixels, textx-plus-antialiasgridfit 513 to 14, textx-plus-cleartype 2,013 to 361. Round 9 (W2) closed: unhinted DrawString advances by design-unit-rounded tracked advances (textx-plus-singlebit 125 to 30), AntiAlias underline and strike-out bars at quarter-pixel positions (textx-plus-antialias 556 to 42), GDI+ ClearType blends with 8-bit tables and exact sixths (gpx-text-texture-cleartype 161 to 0, gpx-rec-textcontrast-cleartype 1,898 to 76, textx-plus-cleartype 361 to 26), and the recorded playback stretch of GM_COMPATIBLE text (textpb-segoeui-cell-q3 4,095 to 93); see "GDI+ text (round 9, W2)". Remains: diagonal stems of W, k, y, v (302 and 76 pixels of the two gpx-rec-textcontrast sheets, about 220 of the brushed text fixtures, 42 of textx-plus-antialias), the one-row bar's sub-scanline ends, glyph shapes of Times New Roman's unhinted monochrome serifs, and the stretch of faces other than Segoe UI. Round 9 (W1) measured, implementation withheld: why the diagonal letters differ under GDI's compatible-width ClearType (stems are shifted as the program runs; nothing is shifted after IUP[x]); the two candidate commits take textx-arial-cleartype/q0/q1/q2 from 7,127 to 6,036 differing pixels but make 7 of 1,260 exact captures inexact (see Text, "GDI ClearType past the stem (round 9, W1)").
3Path-gradient and image-sampling arithmeticRound 11 closed (path gradients): read from gdiplus.dll and ported instead of fitted (the fan of triangles for per-vertex surrounds, the bilinear-quad ramp for uniform ones, Blend and InterpolationColors curves, the round-down arithmetic GDI+ runs in, span windows, the straight-alpha tile bitmap): every committed path-gradient capture is exact but a few edge pixels of the 24 fractional-bounds tiled-ellipse colour controls (113 pixels, from 35,260 differing; round 12 closed the rest and the star fill's window, see EMF+ gradients, Round 12); the eight residual fixtures (triangle clamp, flip and tile, two focus fixtures, text) are exact. Rounds 1 to 5 closed: uniform path gradients to the pixel without a focus (step count, nested copies, float32 copy index, tiles at fractional bounds, tips, pixels outside the boundary, pen, text and fill brushes), per-vertex surrounds as Gouraud fans, the measured integer cubic weights, reductions, mirrors and wraps of axis-aligned high-quality draws, the two-stage rotated draw, cropped vertical margins, DrawImage versus DrawImagePoints, and the positive end of the unit-scale Bicubic copy interval. Round 6 closed: the float32 colour ramp of the steps (the 24 of 13,672 steps native rounds up are reproduced: all 984,120 pixels of the 12 large captures, 2,534 of which differed, and all 25,568 pixels of the step rows are exact), the isotropic focus on axis-aligned edges (applied in absolute device coordinates: the 1,058,400 pixels of the focus-edge rectangles go from 6,212 wrong to 781, see EMF+ gradients), and the rotated and sheared tiles as a measurement (only exact quarter turns are explained; not shipped). Negative result of round 6: the step grid of high-quality draws at 1.37x and 1.55x (680 draws; the plain rounded reciprocal reproduces 438 and no float32 form tried predicts the rest, see "Round 6: the step grid"). Round 7 closed: the coordinate stage of texture brushes and plain Bilinear/Bicubic images (float32 inverse and row stepper rounded toward minus infinity: the texture fixtures from 115 to 318 differing pixels to 0 to 2 and the plain Bilinear image fixtures to 0), translucent Clamp colours as literal premultiplied bytes, rotated and sheared plain Bicubic (10,296 to 44 differing pixels) and the float32 scale behind the high-quality step (438 to 572 of 680 grid draws), see "Round 7". Remains, with the data that would decide it: the ties of an isotropic focus on slanted edges (closed on axis-aligned ones: the focus is applied in absolute device coordinates, see EMF+ gradients) and the strip solver of independent focus scales (the corner-triangle sweep with independent scales is committed, path-gradient-focus-corners.json.gz); tiles with rotation, shear or per-vertex surrounds (round 6 captured the rotated and sheared ones; the same sweep at 5-degree steps for the 24 x 24 tile would find where the stretch gives way to the rotated lattice); the step of a reciprocal near a half and the few-unit position jitter (the grid of source widths and heights at 1.37x and 1.55x is captured; the same grid with DrawImagePoints, a finer height grid and single-row impulse draws would decide it); the unit-scale vertical margin of cropped draws (the float32 evaluation order of the matrix inverse); rotated wrap rings and rotated Half at 45 degrees and 0.5x (rotated draws at integral lengths; the same draw from several world transforms); reduction ties at the end of the kernel; plain Bilinear arithmetic; the 40 of 252 focus-contour controls with 57 boundary pixels. Independent FocusScales, folded contour coverage and curve subdivision are corrected. Seven rectangle/ellipse controls and seven triangle controls are within one channel level; both collapsed triangle focus lines are within one channel level. Path-gradient steps are reproduced for uniform surrounds (see EMF+ gradients): the ellipse wrap fixtures now differ at zero tolerance on 0.9% of pixels (from 51–52%) and the Blend and 50/50 focus fixtures are exact; plain Bicubic PNG is RGB-exact across all 16,000 fixture pixels (previously 7,127 differing pixels, maximum seven). All 144 native arithmetic controls are exact, including premultiplied alpha (round 4: all 288 hq-arithmetic captures and, after round 5, 172 of 192 independent ones, hq-arithmetic-bounds.json). Another 384 independent phase captures improve from 347 to 384 exact (380 before round 5) with no per-case regression. Sixty-four independent crop/mirror controls improve from 10,474 to 132 differing pixels. SVG already offers device-resolution resampling through imageResampling: 'exact'; seven Chromium image/effect/transform controls match PNG RGB byte for byte in that mode. A chained exclusion clip is corrected, closing 4,000 SVG-vs-PNG pixels; native clip/z-order residuals remain ten one-level pixels. Default renderer scaling is preserved. High-quality interpolation had widespread 1–3-level errors; the measured integer cubic weights, destination-space reductions, mirrored and wrapped draws of round 4 bring the HighQuality image fixtures within one level (see EMF+ rotated high-quality DrawImage, which lists what is still open). Across 252 independent contour/order controls, 212 are within one level; the remaining 40 retain 57 boundary/overlap pixels beyond one level. Per-vertex surround colours are reproduced (see EMF+ gradients: 98.8% of 44,454 random-polygon pixels exact, the RGB triangles from 86% to 100% of pixels within a level). Anisotropic focus, the step count under rotation and shear and the rounding of the nested copies are reproduced too (see EMF+ gradients). Still open: the pixels on a slanted copy edge with an isotropic focus (without a focus every pixel on a copy's edge is reproduced by float32 arithmetic rounded toward minus infinity, and the tip pixels and the pixels outside the boundary are closed; see EMF+ gradients) and the strip solver's coverage pixels (tiles cut from fractional bounds are reproduced, tiles with a rotation, shear or per-vertex surrounds are not; see EMF+ gradients). Linear Blend tables are already exact.
4Red-eye, CMYK and HALFTONE generalisationRounds 1 to 5 closed: the HALFTONE enlargement kernel as a closed form (8,152 of 8,159 interior rows), the engine selection for mixed enlarge-and-reduce stretches, the one-axis reductions and dithered one-axis stretches, the despeckle weights and tie rule (6,400 blocks, 500 images) and the selection at reducing, fractional and wide scales; red-eye luma weights, carry, strength steps, fallback falloff and axis group. Closed as not reproducible by a stateless converter: the red-eye strength of an all-pure-red area after earlier direct calls of the same process (process state: 7 of 30 sequences differ between fresh processes; playback of the recorded fixtures does not depend on it, redeye-playback). Round 8 closed: the red-eye fixture residuals (plus-only-effect-redeye-whole/both/left 379/59/3 pixels, now exact: a far-off centroid is replaced by the darkness-weighted centroid 255 - L of the whole area, not by the middle, and the centre, radius, falloff and sector means are float32 arithmetic that truncates toward zero, which also replaced the symmetric-scene special cases; third strength 0.66, highlight inside the disc). Round 7 closed: the CMYK values (the module's ink position map, integer weights, 8-bit rule and exact nodes were identified; see the JPEG coverage item). Round 6 closed: the tie rows at ratios just above 3, 4 and 15 and the centre phase of 15x (identifiability artefacts: the halves of such a row weigh exactly 4096 shares, the converter reproduces every raw native value), alpha under HALFTONE (dropped: destination alpha 0, colours independent of source alpha), the extension rows of the dithered filtered engines (edge rows replicated twice) and the dithered colour-adjustment residual of eleven colorfulness / tint settings (measured chroma ties). Remains: six kernel boundaries within 0.002 of a whole share (a native float rounding of about 5e-4 shares: the formula is on the native side for 4,570 of 4,773 labelled near-integer shares, no float32 site combination explains the rest), the colorfulness / tint settings that are not among the 11 measured cubes (one level in about 0.2% of the channel values; the 11 settings are exact, round 6). Red-eye Only playback is exact (0/0/0 differing pixels, left/both/whole, from 3/59/379 and 12/68/380 before round 5). The centroid weights are the redness over an integer luma round((9 G + 2 B) / 11) in every area, summed in truncating float32 over pixel indices; the carry is the previous centroid once in pixel-index coordinates, the strength steps at luma spreads above 25, 40 and 80 (1/4, 1/2, 0.66, 3/4), a unique bright pixel inside the disc is corrected completely with a halo of 5 d^2 levels, a centroid beyond the fallback circle is replaced by the centroid of 255 - L over the whole area with a falloff of at least 0.33 (1 - u), and the pixels exactly on the horizontal axis through the centroid are one sector group (the captures in redeye-stages.json.gz, redeye-fresh, redeye-zero-fraction, redeye-fallback-strength, redeye-nudge, redeye-fixture-direct, redeye-fallback-centre and redeye-scenes pin each). 191 of 192 independent (fresh-process), 72 of 72 held-out, 77 of 77 nudged and 30 of 36 seeded held-out scenes are exact. Process state (a) stands for direct call sequences only: the strength of an all-pure-red area after earlier calls is not a function of the area (redeye-state.json.gz, 7 of 30 sequences differ between fresh processes, the first call of a process is exact in 180 of 180), but the fixture residuals were never process state: native playback of the recordings is the committed reference in 32 of 32 playbacks over 17 fresh-process contexts and the direct call on the generator's images in a fresh process equals it (8 of 8). What is left: areas whose red centroid is far from the middle in bright fields (grey fields from level 151 correct nothing at 128 x 128 and 207 other pixels at 256 x 64; six of 36 seeded scenes, 8 to 952 pixels off; the sharp change between levels 150 and 151 is not explained by the darkness weights), rounding-sized pixels (one noise-field pixel, 4 and 1 pixels of black 128 and 160 fields, one carry pixel at 8e-6 above a half), and the 75%-luma-0 noise field. Another 216 central kernel captures close 72 nearest-branch controls and measure 96 filtered 2x/3x responses exactly. A fractional 2.37x impulse rejects the same integrated-tent formula (fourteen channel levels); the branch selector is shipped (including the give-up rule for heights equal to the least row count past 2,304 pixels, closed on 8 October 2026: 8,766 swept sources, halftone-boundary.fixture.test.ts), with the filtered branch for both axes enlarged by up to 5x (whole or fractional), either axis above 5x, one enlarged axis, mirrored blits, combined colour adjustments and mixed enlarge-and-reduce stretches of filtered sources (closed in round 5, see HALFTONE below). The enlargement-kernel formula is a closed form in round 5 (see HALFTONE: 8,152 of 8,159 interior rows). Keep the existing exact mixed-axis fixtures exact.
5Fractional and transformed geometryRounds 1 to 6 closed (round 6 closed the rotated pen nib, see below): the radials of played-back Arc, Chord and Pie records, which Windows measures in logical space (round 6: all 3,600 native playback paths exact, from 2,541, compat-playback-paths.json.gz; the arcs of the compat-playback-* sheets are pixel-exact, 259 differing pixels over the sheets before and none now: the last 24, all in RoundRect cells, went with the corner rule of round 7, G3), mirrored compat maps (round 6: 132 new sheets under negative x, y and x-and-y extents from 550,437 to 410 differing pixels, 55 in round 7 and 5 after G3; Arc, Chord, Pie, Ellipse and Rectangle paths exact for 864 shapes of each kind, compat-playback-shapes.json.gz), inside-frame and scaled-path geometry in EMF and WMF, the float32 arc points and the single-precision tangent lines of axis-aligned small arcs, wide pens on curves, dashed curves and scaled dashes, the RoundRect playback rules, the compat rules measured against playback (cosmetic rectangle edges, null-pen growth on whole-pixel boxes), bevel and miter joins under matrices (221 of 288 outlines, from 42), EMF+ compound and inset pens on closed figures (aliased), and the dash-walk question (an accumulated walk distance is rejected: the dash polygons are identical at 1, 64 and 512 periods). Not reproducible from outside: the 36 dash-cut ties (the native value of a cut is exposed by no outline; the item is kept open in GDI path geometry at 321 of 349 forced decisions). Remains, with the data that would decide it: 417 of 624 arcs of 0.01 to 3 degrees (round 6 captured the huge radii, arc-huge.json.gz: the rounding of the two single precision unit vectors is still not reproduced; the first of them in isolation, an arc series sharing one start radial, would decide it), a wide pen on the anisotropic 3:2 map that mirrors x (a diagonal edge pixel, 169 and 166 pixels), fractional transformed inside-frame cases. Scaled EMF inside-frame is exact (emf-scaled-paths.json.gz: every shape matches in both arc directions); scaled WMF shapes are exact (wmf-scaled-paths.json: 1,499 of 1,500 native paths match exactly; the other, a chord with a pen as wide as its box, is a FIX off at four values; a pen wider than an Ellipse or RoundRect keeps the box without the inset). Continue with half-FIX side/corner ties and arc geometry. Closed since this line was first written: the rotated GDI pen (round 6: the nib, the half-pixel perpendicular and the square-cap extension under rotated, sheared, scaled and mirrored matrices are exact, 6,432 of 6,432 flat-cap corners of rotated-pen-vectors.json.gz, 864 of 864 nibs read from long round-capped segments and all 504 outlines of the seven non-trivial matrices of general-matrix-pen.json.gz; the rules are in "Round 6: the rotated GDI pen" under GDI path geometry), and miter/bevel joins under such matrices (round 5: widened in device space with the matrix's nib, 221 of 288 native outlines exact against 42; round 6: all 288, 270 with the nib and the rest once the miter limit was tested in logical units, general-matrix-pen-joins.json.gz, rotated-pen-miters.json.gz), and EMF+ inset and compound pens on closed figures (round 5: compound arrays exact on 24 figures in both modes, Inset pens ring-shaped, aliased 52, 119 and 458 differing pixels of 240,000 for miter, bevel and round joins against 1,582, 1,581 and 1,976; round 7: the aliased sheets are exact and the antialiased ones differed by 6 pixels and are exact since round 8, see EMF+ below).

Completion requires exact full-output comparisons (including alpha and painted pixels outside the current overlap), matching native environments, independent scale/transform captures, and PNG/SVG verification. Existing tolerance bounds must not be increased to make a candidate fix pass.

Closed in this pass: native axis-aligned Bicubic arithmetic makes the PNG fixture RGB-exact across all 16,000 pixels, with all 144 arithmetic controls exact and no per-case regressions across 64 independent crop/mirror and 384 independent phase controls. Native pen playback now names a pixel source rectangle, and the generator disables process DPI virtualisation; the six anchor-cap and two scale3-dash references now match exactly. PolyTextOut now preserves C1 glyphs as native metafile playback does, reducing its recorded fixture from 39 differing pixels to 12; eight focused controls pin both record families and IGNORELANGUAGE. EMF+ coverage masks retain underline/strike-out bars, use GDI+'s 16-shade mapping, and run its grayscale subpixel interpreter. ClearType uses natural-width interpreter flags and truncates subpixel coverage. Ninety-four expanded playback references (eighty-eight when this paragraph was first written; 101 after round 6) now validate ink beyond the old native surfaces without replacing the original PNGs. Solid GDI pens under unequal axis scales now use native elliptical geometry: all 216 image controls are exact, and all 3,600 widened outlines and a further 16,128 independent direction/corner controls are exact. Path-gradient boundaries share the fixed-point flattener and match all 1,556 native Flatten vertices; gradient contour and scanline corrections tighten twenty-one PNG/SVG focus controls to a one-level channel bound. Fractional text origins close 2,400 grayscale and 288 ClearType controls; nearest-quarter grayscale x placement closes another 1,280 independent fine-origin controls and 88 DrawString controls. The end-to-end unhinted antialias text fixture falls from 1,300 to 650 differing pixels. Native captures and environment manifests accompany these changes.

EMF+ image effects ​

The 74 Dual effect fixtures (plus-effect-*) and 74 Only equivalents (plus-only-effect-*) are in the parity test. They have been regenerated on Windows with corrected metafile type constants. src/emf-plus-image-effects.fixture.test.ts also checks the effect algorithms against the effected bitmaps that GDI+ records into each fixture.

  • Not exact yet:
    • Red-eye follows the measured sector/centroid model in float32 truncating arithmetic; the fixtures are exact. Left: a direct call after earlier calls of the same process (not reproducible by a stateless converter, which reproduces a fresh process) and areas with a far-off centroid in bright fields; see the parity notes and row 4 of Current parity priorities.
    • The rotated blur's effected bitmap is exact and its playback is within 0.010% (plus-effect-blur-r3-rotate30, two pixels over 8 levels; 0.22% before the blur's first halo column was sampled at the right edge). The 11 pixels left are not effect arithmetic: nine are one level in the rotated bilinear sampling, and two are edge pixels of the rotated image (the pixel at (45, 50) is backdrop in native playback and image in the converter, the one at (101, 81) the reverse, 0.69 pixel beyond the right edge in source coordinates), which belong to the rotated-draw edge coverage rather than the blur.
    • Red-eye residuals (plus-only-effect-redeye-whole 379 pixels, -both 59, -left 3) are closed (0/0/0), and were not process state: native playback of the recordings is the reference in every fresh process and order (redeye-playback), and the first direct call equals it (redeye-fixture-direct). The 282 + 57 pure-red ramp pixels and the 80 pixels of the (x, 255 - x, 128) band came from the centre of the far-off centroid (the darkness-weighted centroid, 127.641 to 127.644 by 30.564 to 30.567 on the ramps image, not the middle), and the 17 + 3 skin-tone pixels from a pixel exactly at the radius (the float32 truncation decides it).

Blur and sharpen are exact. Large blur reproduces the native per-axis algorithm (reduce each row by the factor measured at all 957 quarter radii, filter with the centre weight applied as two rounded halves, enlarge, then the same for columns, with products kept to 1/256 of a level), and the kernel weights are float32 values formed in truncating arithmetic (accumulated offset, ordered sum, multiply by the reciprocal normaliser; see blurKernel). They match native noise images at random radii from 1 to 255, ramps, impulses, the 957-radius and two-pixel-wide captures, the 504-draw expanded capture (fourteen rectangles, twelve radii, opaque/translucent patterns) and 150 narrow and edge-reaching draws, pixel for pixel. Expanded blur follows the native reduction (a cropped source rectangle reduces from its own corner, only its own samples are enlarged, samples beyond the buffer are transparent, a lone sample is continued toward a transparent neighbour).

Sharpen strength now uses the native rational amount curve, quantized to 1/64 with half-down rounding. It matches every integer amount 0–100 and 19 radii when tested independently of blur convolution.

  • JPEG coverage: accurate integer IDCT, triangle chroma upsampling and fixed-point colour conversion now match the committed standalone JPEG and JPEG-TIFF references exactly. Arithmetic-coded JPEG is exact against the native reference, 12-bit JPEG is refused as Windows refuses it (nothing is drawn), and CMYK/YCCK JPEG, also inside TIFF, goes through a bundled copy of the Windows ICM node table with the module's own integer arithmetic (every channel of all eight CMYK/YCCK references and the TIFF strip file is exact, 30,000 held-out random inks are exact and, after round 12, every one of the 2^32 8-bit inks is exact; see parity-notes.md for the mechanism: ink position map, 1/4096 integer weights, (S + 4096) >> 20, 16-bit output table). Open: the 16-bit result of the interpolation (cmykColour16: 99.1% of 16-bit values exact, one or two off elsewhere, which only the probes use); the table grew from 196 KB to 275 KB of text (+4.1% of the bundle) because exact integer nodes cost two more bits each. Arithmetic JPEG is now verified beyond testimgari.jpg: 28 variants written by scripts/gdi-fixtures/arith-jpeg-encoder.ts (proved against Pillow/libjpeg-turbo with Huffman copies of the same coefficients, arith-jpeg-verify.py) are decoded by GDI+ and by the converter identically (23 exact; the 5 CMYK/YCCK ones equal their Huffman copies through the shared conversion), so progressive, restart-interval, DAC and 4-component arithmetic need no further data. Arithmetic JPEG with 12-bit precision, arithmetic lossless and hierarchical files are not tested (Windows refuses 12-bit; the others are not decoded). GIF and lossless TIFF references remain exact, including offset/palette GIFs, LZW/multipage/bilevel TIFF, Deflate strips and uncompressed/Deflate tiles.
  • CMYK JPEG, 8-bit nodes (round 12): the remaining one-level misses were not an interpolation or rounding error but the node table: icm32.dll's 8-bit routine (LHCalc4to3_Di8_Do8_Lut16_G16, read with the public PDB names) takes the nodes as unsigned 16-bit words and looks the sum up as S >> 18 in the output table, whose high byte is S >> 20; our table (signed, read from 16-bit probes) plus one, clamped to 0..65535, is that table except in 89 of 196,608 values. Those 89 (one to five units; none of them is a clipped node, the clipped ones agree with the table plus one) are not what the 16-bit probes read, which go through the module's other, generic N-dimensional routine, so they were found by a counterexample-guided search against TranslateBitmapBits over all 2^32 ink combinations (scripts/gdi-fixtures/cmyk-8bit-nodes.ts, the sweep takes four minutes on four processes): cmyk-8bit-nodes.ts regenerate reproduces the list from an empty directory: the first sweep (18,946 wrong inks, with a sixteenth of the inks near a boundary kept as the seed), a solve, a second sweep with 254 wrong, a solve and a third with none; its 89 corrections are identical to the committed ones. The shipped result is therefore exact for every 8-bit ink, not only a sample (random sampling had shown about 5 misses per million). The 16-bit path (cmykColour16) keeps the old table, because moving it onto the 8-bit nodes lowers the pinned exact counts (23,794 to 23,741 and 24,410 to 24,250). Bundle: dist/index.js 2,417,896 against 2,416,365 bytes (+1.5 KB, the correction list). Open: the 16-bit result of the generic routine (99.1% exact).

EMF+ rotated high-quality DrawImage ​

A rotated or sheared HighQualityBicubic/HighQualityBilinear DrawImage (a 3-point destination) is two native draws (round 3; probes HighQualityRotatedProbe.cs, HighQualityRotatedFineProbe.cs, HighQualityHalfShiftProbe.cs, HighQualityAxisProbe.cs, HighQualityAxisNoiseProbe.cs; modes hq-rotated, hq-axis, hq-half-shift; captures hq-rotated, hq-rotated-fine, hq-axis, hq-axis-noise, hq-half-shift; code resampleRotatedTwoStage, resampleHqAxisAligned). The two-impulse probe the task asked for separated the footprints at once: the response is not an area-integrated kernel over the rotated pixel, and not separable filtering along the source axes either; it is the source resampled to a whole-pixel intermediate and then rotated.

  • Rotated None draw = pre-scale + plain-kernel draw, byte for byte. Drawing the source axis-aligned into a W x H bitmap with the same high-quality mode, then that bitmap rotated to the same three points with plain Bicubic (for HighQualityBicubic) or Bilinear, equals the one-step draw exactly in 115 of 120 bicubic and 85 of 120 bilinear captures (twoDiff3; the others differ by 1 to 24 bytes of 36,864). W and H are each edge's device length rounded up (ceil(length * (1 - 1.5e-7)): 12.0000029 rounds up, 12.000001, 24.0000019 and 40.0000038 do not, so the length is a float32 result); an edge within one pixel of the source length makes the draw skip the pre-scale and sample the source with the plain kernel (the old "unscaled axis" rule is this case; no intermediate size reproduces it). The old far-edge fade table and the half-pixel shift were artefacts of the missing pre-scale: the intermediate's edge fades through the second kernel's transparent taps.
  • The second pass is plain Bicubic with the axis-aligned integer arithmetic (premultiplied bytes, 16.16 row stepper, 1/64 phase, weights in 16.16, truncating) on the 8-bit premultiplied intermediate; plain Bilinear is float-like with premultiplied bytes rounded (its interior is a level off on a rare pixel and the exact arithmetic is open). Applied to a directly requested rotated Bicubic it improves the independent captures' counts but regresses a few sums at scales below 1, so it is limited to this second pass.
  • Coverage is the destination parallelogram scan-converted from its 28.4 corners by the aliased fill rule (as NearestNeighbor), on a transparent border two pixels wide; exactly-on-edge pixels at 45 degrees are excluded as native does.
  • PixelOffsetMode Half/HighQuality: the same draw with the second pass's grid moved by -0.5 device pixels and by +0.5 intermediate texels along each of its own axes (not 0.5 device pixels: it matters when the length is not whole, as at 1.1x), and coverage tested at pixel centres. hq-half-shift.json (a search over destination translations of the None draw with the source rectangle moved by -0.5) finds the Half draw exactly, byte for byte, for axis-aligned draws and for unscaled rotated draws (destination moved by -0.5), but never for a scaled rotated one (the best translation leaves 1,674 to 20,326 summed levels over 32 draws), which is why the second pass carries the extra half-intermediate-texel term.
  • Almost axis-aligned quads (far corners within 0.02 pixels over a 48-pixel edge, ratio about 4.2e-4; 0.03 pixels is rotated; 124 captures, whatever the origin's fraction) draw as axis-aligned ones.
  • Axis-aligned high-quality kernels (stage one) follow fixed-point phases: step S = round(65536 / scale) per destination pixel, position P = k S + offset from the first covered pixel (offset d S along x, mirrored, (1 - d) S along y), weights from the phase floor((P - 1) / 512) (1/128 texel) evaluated at the bin centre for the cubic and at the bin top for the tent, the horizontal pass first and rounded to 8 bits before the vertical one. This took the axis-aligned arithmetic captures from 6 of 288 exact to 206 and the independent ones from 8 to 38 of 192 (hq-arithmetic-bounds.json tightened on 869 metrics). The tent is exact on 46,569 noise values; the cubic differs by one level on 35 (0.08%).

Results (src/emf-plus-high-quality-rotated.fixture.test.ts, 600 captures): gpx-image-rotated-highqualitybicubic 2,911 pixels (18.5%, up to 10 levels) to 10 pixels (0.064%, one level); the 20 upscaled draws of each group in the scale sweep went from 12,773 to 12,860 differing pixels (every pixel, up to 255 levels) to 54 (bicubic) and 191 (bilinear) under None, none beyond one level; no group has a pixel beyond 8 levels except the Half reductions (24 and 40 pixels, up to 31 levels). Bundle: dist/index.mjs 1,893,475 to 1,902,912 bytes.

Tried and rejected: refitting the area-integrated model (stage one alone leaves it 20 levels off at the edge); a rotated pixel footprint integral; separable filtering in the source axes (the two-impulse response is symmetric under the draw's own rotation); a Half translation of the None draw; numerical box integration of the cubic at 8 to 256 samples per texel, weights quantised to 8 to 24 bits (also as a cumulative sum), the Mitchell family around B = 0, C = 1 (the a = -1 cubic is the unique minimum) and linear interpolation between phase tables: none removes the cubic's last 0.08% to 1%.

Remaining after round 3 (each item is closed or narrowed in "Round 4" below):

  • The cubic's last 0.08% and the up to five levels under Half: closed by the measured integer table (round 4).
  • Reductions (scale below one) and mirrored draws: closed for the 8x8 and noise captures (round 4); the leftovers are listed below.
  • Plain Bilinear arithmetic was narrowed on 12 October 2026: 1/2048 fractional weights, source byte premultiplication and final byte rounding make all 144 new rectangle controls exact, and leave six one-level pixel differences in 64 independent cropped/mirrored controls. The coordinate stepping behind the recorded fixtures' residuals (float32 rounded toward minus infinity, a row stepper from the first covered pixel) and the rotated plain Bicubic arithmetic were closed in round 7, see "Round 7" below; the signed phase-boundary ties remain, see Native parity review.
  • Rotated draws with ImageAttributes WrapMode and the three destination corners: narrowed in round 4 (below).

Round 4: measured cubic weights, reductions, mirrors, wraps and the corner snap ​

Probes HighQualityCubicWeightProbe.cs (mode hq-cubic-weights, source rows from generate-hq-cubic-source.ts), HighQualityPhaseProbe.cs (hq-phases), HighQualityReductionProbe.cs (hq-reductions, scratch analysis only, not committed: 11 MB) and HighQualityWrapProbe.cs (hq-wrap); captures hq-cubic-weights, hq-phases, hq-wrap; code src/emf-plus-hq-cubic-weights.ts, resampleHqAxisAligned, hqReductionTaps, snapOriginKeepCorners; tests emf-plus-hq-cubic-weights.fixture.test.ts, emf-plus-hq-phases.fixture.test.ts, emf-plus-hq-wrap.fixture.test.ts.

Rules found, with the evidence:

  • The cubic weights are a measured integer table. Rows of designed noise (400 rows, 1,016 texels, drawn 128/127 wider so every destination column visits all 128 phase bins; about 2% of the sums fall within 0.02 of a half level, chosen offline) leave exactly one integer weight vector per bin that reproduces all 1,221,600 native values; the table is exactly symmetric (bin 127 - b is bin b reversed) and sums to 65536 in every row. 88 of the 128 rows equal the kernel integral with each texel edge rounded to 1/65536 (426 of the 1.2 million values differ for that analytic table); the other 40 differ by one unit between two adjacent taps. The deviations are ±0.1 to 0.2 of a unit at the texel edges, larger than a float32 evaluation of the cumulative polynomial gives, and no numerical-integration, bit-depth or kernel-parameter variant reproduces them, so the 64 rows (the other 64 mirror them) ship as data (HQ_CUBIC_HALF_TABLE, 640 integers). Result: axis-aligned bicubic noise upscales 35 of 46,569 values off to 0; arithmetic captures 206 to 288 of 288 exact; independent captures 38 to 122 of 192; rotated bicubic upscales and Half draws improve with the same table (Half noise: 0 exact of 20 to 17).
  • Reductions use the same machinery in destination space. Each source texel edge e (relative to the source origin) lands at s (e - P) destination pixels, P = (k S + offset) / 65536; that offset is rounded down to 1/128 pixel and a texel's weight is the difference of the kernel's running integral at its two edges' offsets: the cubic's half-grid table above (T(m) at (m + 1/2) / 128, rebuilt from the measured weights), the tent's 512 j - 2 j^2 at whole grid points. Evidence: per-column least squares of 1,200 independent noise rows recovered the weights to 1e-4 and showed centre and width varying per column (the sawtooth of the apparent centre has period 9 at 0.9x) until the 1/128-pixel offset was introduced (rms 174 to 9.6 units of 1/65536 at 0.9x); on hq-axis-noise the reduction values that were off (987 bicubic and 1,161 bilinear in scratch counts that are not pinned) become 0 and 2 of 4,536 per kernel (two tent values at 0.4x where an offset falls exactly at the end of the kernel; pinned in emf-plus-high-quality-rotated.fixture.test.ts); the 8x8 arithmetic reductions (all 48) and the hq-phases reductions at 0.9x, 0.8x, 0.75x, 0.5x (both kernels) are exact. The weights use the float32 scale for the stretch (the 0.75x tie at the left edge needs 0.75, not 65536 / round(65536 / 0.75)).
  • Mirrored x axes (a negative-scale matrix) step backwards from the far end in the source's own direction, P = (covered pixels + d - k) S for d the distance from the left edge to its first covered pixel (the flipped-source fits show the apparent - 65536 and the tent's one-bin shift as consequences of the flip), plus a few units that grow with the source width (round(srcW / 170): 3 at 512 texels, 0 at 13 or for a power-of-two step) and the left edge, not the right, is the one snapped to 1/16. The mirrored 2.25x upscales of the independent captures become exact including a 0.375 fractional origin; of the hq-phases rectangle draws 6 of 9 mirrored upscales per kernel are exact and all 4 mirrored sub-rectangles.
  • A fractional left edge steps from the unsnapped edge. The 3.4 origin of hq-phases was 26,168 of 43,272 values wrong with the 1/16-snapped edge (the 0.1 and 0.9 origins of the scratch captures likewise) and is exact with the raw one.
  • Clamp to a transparent colour is no WrapMode. All 28 native Clamp-transparent draws equal the draw without attributes pixel for pixel, in every shape. The other modes change only a ring about two pixels wide inside the quad (24,523 pixels over 140 draws). Axis-aligned draws read the wrapped (or clamp-coloured) texels through the same weights and are exact at 1.55x, 2.25x and 0.625x in every mode (over 2,000 pixels per mode off before); a rotated draw is the two-stage draw with the wrap on the source in the pre-scale and on the intermediate in the plain pass (about 1,085 pixels more than 3 levels off over four 25-degree draws down to 230).
  • Only the first destination corner of a rotated draw snaps to 1/16 pixel, the other two stay: the edge vectors absorb the snap. 16 native unwrapped rotated and sheared draws: 2,682 pixels more than one level off with the matrix kept and the origin moved (the round 3 model), 1,141 with all three corners snapped, 3,816 and 3,846 with floor or ceil, 1,021 and 3,080 at 1/8 and 1/32 pixel, 704 for this rule.
  • Real fixtures (zero tolerance, 15,741 pixels each): gpx-image-highqualitybicubic 1,084 to 121 pixels off, gpx-image-highqualitybilinear 1,145 to 34, gpx-image-pom-half-highqualitybicubic 294 to 28, the three WrapMode HighQualityBicubic fixtures 3,417 to 3,641 down to 77 to 120; every one is now within one level at tolerance 1 (gdi-parity.fixture.test.ts tightened from eight levels). Bundle: dist/index.mjs 1,915,916 to 1,922,296 bytes.

Hypotheses tried and rejected: weights from a polynomial or numerical integral in float32 or at 8 to 1,024 samples per texel (the table's off-by-one pairs are not float32 noise: of 46,392 noise values the best float32 form leaves 20 mismatches, the rounded analytic integral 16, the table 0); an unrounded step for reductions (drifts by hundreds of units at 0.9x); a reduction pre-decimated by the integer part of the ratio (the least-squares weights are a single stretched kernel); a different cubic parameter or stretch for reductions (a = -1, stretch 1 are the unique minimum, rms 5 against 11 for a = -0.9); the destination width rounded to a whole pixel for the step (a 461-pixel step for 460.8 leaves rms 4,500); tie rules for the reduction edge (floor, and ceil minus one, tried at every offset; floor fits except as noted); the 28.4 grid snap of the mirrored right edge.

Still open, with the data that would decide it:

  • The step near a half, and the few-unit position jitter. S is the rounded reciprocal, but a reciprocal within 0.004 below a half (1.37x: 47,836.496) rounds either way and which way depends on the draw's height (47,836 at heights 8 to 64, 47,837 at 336, sprobe scratch captures): a float32 rounding of the matrix inverse that the width does not fix. Positions are also off by a few units of 1/65536 that grow with the source width (sub-rectangle draws want +1 to +3, full-bitmap draws 0) and are zero for power-of-two steps: sub-rectangle draws with a whole-bin step (250 -> 256, 200 -> 256) still disagree on every column. One capture per source width and height at a step that is not a power of two (a grid of 16 widths by 8 heights at 1.37x and 1.55x) would let the float32 evaluation order of the three-point matrix inverse be fitted. Round 6 captured that grid (17 widths by 10 heights, 680 draws): see "Round 6: the step grid (negative result)" below; the plain rounding reproduces 438 of the draws and nothing tried predicts the rest.
  • Mirrored unit scale and rectangles with negative widths. Closed in round 5 (below): the converter now tells EmfPlusDrawImage from EmfPlusDrawImagePoints (DeferredImageResample.pointsForm), a rectangle is an exact mirror and points are one only for power-of-two source sizes.
  • Rotated wrap rings. About 230 pixels over four 25-degree draws (up to the full range at the far edges of the quad) remain after the two-stage wrap; the wrap period of the intermediate (a 19-texel intermediate for 18.6 device pixels) or which stage wraps the pre-scale's own overhang is not decided. Rotated draws at integral lengths (12 x 1.5 = 18) and a second source width would separate the two.
  • Rotated Half at 45 degrees and 0.5x (hq-rotated-fine, 60 pixels up to 30 levels): an intermediate of 8 x 9 reproduces it exactly while the probe's float32 lengths are 7.999999 and 8; the length arithmetic in float32 for a quad whose corners were shifted by the half pixel is not reproduced. Round 5 (below) widens the data to 528 draws and finds no float32 length formula that predicts the pre-scale size; the item stays open.
  • Reduction ties at the end of the kernel (0.65x, 0.6x and 0.3x leave a few to a few hundred values a level off in hq-phases; two bilinear values at 0.4x): which side of the grid an edge exactly at the kernel's end falls on.
  • Plain Bilinear arithmetic and the plain Bicubic arithmetic at scales other than one under rotation (independent captures modes 2 and 3) were unchanged here; both are closed in round 7 below.

Round 5: cropped sources, the record form and unit-scale mirrors ​

Probes HighQualityCropImpulseProbe.cs (mode hq-crop-impulse: one white row or column of an opaque black bitmap per draw, so the destination red is 255 x the weight of that texel and the alpha the share of the kernel on texels that exist; 22 source rectangles, both kernels, both record forms, scales 0.5 to 3, five fractional offsets, 235,620 draws), HighQualityCropAlphaProbe.cs (hq-crop-alpha: 262,144 white draws read at their edges, 65,536 at each of four whole destination offsets), HighQualityCropHeightProbe.cs (hq-crop-height: the rectangle form's unit-scale margin against the height and the top) and HighQualityHalfLengthProbe.cs (hq-half-length); captures of the same names; code resampleHqAxisAligned (rowMargin, mirroredBias) and DeferredImageResample.pointsForm; test emf-plus-hq-crop.fixture.test.ts. Before the changes 28,900 of the 235,620 impulse draws were off (the tent's vertical upscales at 1,413 to 2,355 draws per scale, the mirrored unit-scale axis at 1,889 to 2,269 draws per form and kernel with errors up to 255), after them 4,051 (the exact groups and the residual per group are pinned in the test).

Rules found, with the evidence:

  • A scaled draw's vertical pass reads the source rectangle's rows plus the kernel's radius, and no more. The tap one texel past the rectangle's end is read, the next is dropped: the last row of a cropped 3x tent draw keeps 251 of 255 alpha although the bitmap has the texels (the unit test reads the bitmap beyond a source sub-rectangle expected 255 in that row for every kernel and now expects 251 for HighQualityBilinear). Margin ceil(support / min(1, scale)) texels with support 1 for the tent and 2 for the cubic; it fits all 22 rectangles at 0.5x to 3x in both forms. The x axis has no such margin (taps past the rectangle's right edge are read). A WrapMode draw wraps instead (the gpx-image-attr-flipxy-highqualitybicubic fixture exceeded its 0.1% bound, at 0.14%, when the margin was applied under a wrap, so it is not). Independent crop draws (hq-independent): the 48 non-mirrored crops go from 30 to 36 exact.

  • DrawImage and DrawImagePoints differ for a mirrored unit-scale axis. The destination rectangle with a negative width is an exact mirror (pixel k of the covered run sits on texel covered - 1 - k; the fractional origin only moves the filter phase; a whole origin is a copy): the model drops two texels for a fractional left edge and one for a whole one (plus one unit for the cubic), and all 22 rectangles x both kernels x five offsets are exact (2,815 draws per kernel). DrawImagePoints with reversed points is the same exact mirror only when the source rectangle's width and height are both powers of two, a pure function of the two sizes (0 violations in the 15,360 white draws with the rectangle at the bitmap's origin and sw of at least 3: two kernels, two fractions, four offsets); any other size is the general path, an image translated two texels from the exact mirror (the first covered pixel of a 12-wide rectangle samples texel 12 and the last texel 1), whose phase is one unit of 1/65536 texel above the model for most sizes (four of the nineteen rounded sizes measured want none). Rounded mirrored points draws are therefore still off by one or two levels in 256 (tent) and 189 (cubic) of the 2,815 unit-scale impulse draws per kernel, in 552 and 617 of the 2x draws, and in 132 and 72 of the reductions (the same unit is added for them: 1,006 and 1,120 off at 0.5x without it). Independent captures: mirrored 44 of 96 become 88 of 96, all 192 now 172 exact (122 before), differing pixels 6,291 to 231 and summed error 228,640 to 238 (hq-arithmetic-bounds.json tightened on 182 metrics, none loosened); the hq-phases rectangle draws of mirrored fractional origins go from 4 to 5 of 5 per kernel. The interpretation (float32 rounding of the matrix inferred from three points, exact for power-of-two sizes only) is the only one the data supports: no other quantity separates the exact sizes.

  • The unit-scale vertical margin is not reproduced. Whether the last row of an unscaled cropped axis reads the tap past the rectangle (alpha 255) or drops it (alpha below) is a deterministic function that the model does not have: it is the same in any draw order (four orders of 65,536 draws each: no difference), it changes with the destination's whole offset (8, 16, 24 and 40 give four different tables), it depends on the height (at offset 8 heights 24 to 31 read it and heights 1 to 7 never do) and, for DrawImagePoints, on the width through the width's mantissa alone (widths 3, 6, 12 and 24 give one row of the table, 5, 10 and 20 another), and the rectangle form is a function of the height and the top alone (0 disagreements in 35 groups of equal height and offset; hq-crop-height). Float32 products of the reciprocals of the two sizes (six sign tests, at most 649 of 960 table cells where a coin toss scores 480) and areas do not predict it. Scaled axes are exact (above), so the unit axis keeps the unmargined behaviour.

  • Rotated Half at 45 degrees and 0.5x stays open. hq-half-length draws 528 rotated quads (11 angles from 15 to 160 degrees, 12 scale pairs at whole device lengths, None and Half, both kernels, destination at (100, 60)); the pre-scale size among the default and its eight neighbours that best reproduces each draw differs from the rounded-up float32 length in 142 of them (including None draws, where the old data held), and none of four length formulas (float32 square root of float32 squares, double hypot, float32 of the hypot, float32 square root of double squares) with eight tolerances from 0 to 2.4e-7 predicts the best size for more than 222 of the 313 draws that one of the sizes fits to within five pixels; the Half-shifted corners transformed through the float32 matrix (the candidate that gives 8 x 9 for the old draw with a tolerance of 1.0e-7) reach 59 of 111 at 1.0e-7 and 88 of 111 at 2.4e-7 for the Half cubic draws. The size depends on the float32 noise of the destination points, which grows with their magnitude; the native length computation (it is not the points' own differences) would need to be observed, for instance by recording the same draw from several world transforms.

  • The positive end of the plain Bicubic unit-scale copy interval is a power-of-two rule. Probe BicubicBoundaryProbe.cs (mode bicubic-boundary, capture bicubic-boundary: noise bitmaps of 12 x 12 and 48 x 48 texels drawn 1:1 with DrawImage(destRect, srcRect) and the source offset swept in 1/4096 steps through plus and minus 1/64: 11,058 sweep draws and 10,368 size draws). At a whole destination offset the draw is a copy from -64/4096 to +63/4096 for every rectangle size (-65/4096 never copies); at +64/4096 (a source phase of +1/64, a translation of exactly -1/64 from a whole number) it copies only when the rectangle's width and height are both powers of two (the 36 pairs of 1, 2, 4, 8, 16 and 32 copy for some offset of the other axis; the 108 pairs of the 144 sizes sampled with a width or height of 3, 5, 6, 7, 12 or 24 never do), and then for any offset of the other axis when w * h * max(w, h) is at most 256 (17 pairs: 1 x 1 to 4 x 8, 8 x 4, 1 x 16 and 16 x 1) and otherwise only when the other axis' offset is a multiple of 1/128 (the other 19 pairs, 8 x 8 among them). At a fractional destination offset the sweep around a whole source offset never reaches the copy interval (the draws are the convolution at the quantised phase floor(k / 64)). The model (unitCopyOffset) reproduces all 11,058 sweep draws and the copy or convolution of all 10,368 size draws (4,016 copies); the 384 phase captures go from 380 to 384 exact and the 936 independent copy captures from 930 to 936 (the ten residuals listed in emf-plus-bicubic-arithmetic.fixture.test.ts are gone). The dependence on powers of two and on the low bits of the other offset is the signature of float32 rounding in the transform that the DrawImagePoints mirror shows too; the rule is fitted, not derived.

Hypotheses tried and rejected: closing the positive end for every size (ten independent copy captures that were exact become wrong: 129, 276 to 285, 597 and 744 to 753); a rule on the area alone (4 x 8 and 8 x 4 copy at any offset, 2 x 16, 16 x 2, 1 x 32 and 32 x 1 of the same area need multiples of 1/128); a rule on the destination offset (the whole offset decides only whether the boundary can be a copy at all); clipping the taps to the rectangle on one side (86 to 89 of 192 independent captures exact for the top or left, 76 for the bottom or right, against 122 unclipped); applying the margin at unit scale as well (109 exact against 128); a half-bin or whole-bin extra bias for the unit-scale mirror (the sizes want none or one unit, nothing else); the power-of-two test on the width alone (the height decides as well); a record-form flag for the vertical margin (the rectangle form is as irregular, only independent of the width).

Round 6: the step grid (negative result) ​

Probe HighQualityStepGridProbe.cs (mode hq-step-grid, capture hq-step-grid, test emf-plus-hq-step-grid.fixture.test.ts): independent grey noise of 17 widths (8 to 40) by 10 heights (8 to 336), both kernels, DrawImage(destRect, srcRect) at (4, 4) with 1.37x and 1.55x (680 draws). The plain rounded reciprocal reproduces 438 of 680 (83 of 170 per kernel at 1.37x, 136 of 170 at 1.55x). Fitting an integer step and an integer start offset per axis to each draw (612 of 680 exact with them; the fitted and rejected-variant counts in this section are generator figures from scratch analysis, only the 438 and its split per kernel and scale are pinned by the test) gives:

  • 1.37x (65536 / 1.37 = 47,836.496): the x step is 47,836 for widths 8 to 32 and 47,837 for width 40, at every height. The y step is 47,836 for heights 8 to 32 and 47,837 for 48 and above, except that a height of 64 with a power-of-two width (8, 16, 32) steps 47,836: the vertical step depends on the width, consistent with a matrix inferred from three points even for the rectangle form (exact for power-of-two sizes). Heights 100 and 200 leave one wrong row after the step fit and 336 wants a start offset of -1 unit with 47,837.
  • 1.55x (42,281.29): the plain step is right for every width and height up to 100; the y axis wants an offset of -1 unit at height 200 and -3 at 336, a drift that a constant integer step cannot hold, so the per-row position of tall sources is not k S + offset.

Rejected on this data (scored against the fitted steps; the plain rounding scores 588 of 680 axis values): a fractional step kept unrounded (365 draws exact), floor (438) and ceil (304) of the reciprocal, the reciprocal in float32, the scale from the destination snapped through a float32 corner at 4 (fr(fr(4 + d) - 4) / n), a scale from d * fr(1 / n), round-down float32 divisions and reciprocals, and determinant-based 2x2 inverses of the matrix (float32 or double determinant, reciprocal or ratio). The best form (a round-down reciprocal) reaches 592 of 680 and mispredicts the widths from 9 up at 1.37x, so nothing is shipped. Data that would decide it: the same grid with DrawImagePoints (three points, so the matrix is the quantity under test), a finer height grid (every height 40 to 70) to see where the y step flips, and single-row impulse draws to read the per-row position of tall sources directly.

Round 7: source-coordinate stepping, translucent clamp and rotated plain Bicubic ​

The residuals of the recorded texture and image fixtures (1 to 2 levels on 0.1% to 2% of the pixels) were a coordinate-stage question that whole-fixture fitting could not answer, so the stage was isolated (probes TextureCoordinateProbe.cs, ImageCoordinateProbe.cs, ImageLevelProbe.cs, MatrixInvertProbe.cs, TranslucentClampProbe.cs; generators generate-texture-coordinate.ps1 and generate-translucent-clamp.ps1; tests emf-plus-texture-coordinate.fixture.test.ts, emf-plus-translucent-clamp.fixture.test.ts, emf-plus-hq-step-grid.fixture.test.ts, emf-plus-bicubic-arithmetic.fixture.test.ts).

  • The experiment. A 2 x 2 Tile texture (red = texel column parity, green = row parity, values 0 and 1; for DrawImage a stripe bitmap) is filled while the brush translation (or the destination origin) moves in 65,536 steps of a power of two (2^-14 to 2^-17 pixel). The filtered red is round(fraction) of the 11-bit weight, so a pixel flips between 0 and 1 where its quantised source coordinate crosses a half texel (rising edges at fraction 1023.5/2048, falling ones at 1024.5/2048: round half up). The draw at which a pixel flips measures that pixel's native coordinate to a thousandth of a bin, independently of any model; each capture stores the first two flip draws of every pixel. Sixteen texture sweeps (the three fixture matrices, further scales, a large offset, a fill starting at x = 40 as a rectangle and as a clip, PixelOffsetMode Half) are 61,916 flips; seven image sweeps are 27,969.
  • Vertical coordinates are exact, horizontal ones drift. Rows are independent (the vertical flips of a 0.45x/0.4x fill agree with the double-precision position to the sweep step), but the horizontal residual against the ideal grows with x: for a 0.45x row 0 bins up to pixel 36, 0.17 at 64, 1.0 at 112, 3.0 at 156, and 8 bins by texel 560 at a large offset. The slope per pixel doubles with each octave of the coordinate (about 0.001, 0.017 and 0.047 bins per pixel measured for texels 64 to 128, 128 to 256 and 256 to 512 at step 2.2222, against 0.0017, 0.0174 and 0.0488 for the remainder of the step on the float32 grid of that octave), which is float32 accumulation that rounds toward minus infinity (the 0.75x row: a constant 0.0104 bins per pixel from texel 64 on).
  • The inverse matrix is float32 with every operation rounded toward minus infinity. det = fl(fl(a d) - fl(b c)), r = fl(1 / det), then fl(d r), fl(-b r), fl(-c r), fl(a r) and fl(fl(fl(c f) - fl(d e)) r), fl(fl(fl(b e) - fl(a f)) r): 4,000 of 4,000 native Matrix.Invert results (matrix-invert.json.gz; half of them sheared) where rounding to nearest matches 898 of 2,000 axis-aligned linear elements and 1,089 of their translations, and truncation toward zero 1,218 to 1,252 of the linear elements (the existing float32-down.ts rounding of the path-gradient and Blend code).
  • The stepper. The row's first position is fl(fl(fl(a x) + fl(c y)) + e) from the float32 inverse, and each pixel adds a (the x column of the inverse) with the same rounding; the row starts at the left edge of the fill (rectangle or clip alike: 0 misses at X0 = 40 in all four sweeps), rows are independent, PixelOffsetMode Half moves the point by half a pixel and the texel back. A DrawImage measures from the device position of the source rectangle's corner (the real origin, not the 1/16-snapped one: snapped, every flip of the origin sweep is missed), adds the corner after the products, and steps from the first covered pixel. Against the sweeps the double-precision per-pixel position misses 34,903 flips (1,608 to 3,856 per sweep, none for the identity matrix) and the stepper 1,959.
  • Rejected, with the data. Fixed-point steppers of 16 to 28 bits with the step and start rounded, floored or ceiled: at most 59 of 160 pixels of a 0.45x row (Half) agree; float32 accumulation rounded to nearest: 60 of 320 flips of a 0.45x row against 270 of 320 for truncation toward zero (and more for rounding down); wrapping the start into the texture period before stepping: worse in every sweep but the identity (1,032 against 224 misses in sweep 0); the inverse translation in place of the offset-from-corner form for DrawImage leaves 16 of the 18 pixels of gpx-image-bilinear (the corner form: 0); the order of the three terms of the start changes at most one pixel of the texture fixtures.
  • Result. Texture fixtures: tile 181 to 1 differing pixels, flipx 138 to 1, flipy 163 to 1, nearest-tile 181 to 1, pom-half-tile 318 to 2, flipxy 115 to 0, hqbicubic-flipxy 115 to 0, clamp 1 to 0 (all 240 texture controls stay exact through the stepper). Image fixtures: bilinear, default, low 18 to 0, attr-clamp/flipxy/tile-bilinear 3 to 0, rotated-bilinear 4 to 0; codec-jpeg-arith-prog-420-dri2-playback 113 to 22 differing pixels and codec-jpeg-cmyk-photo-playback 407 to 386. Left in the sweeps: the first position's last bit when the start is below zero or under Half (40 to 616 of 3,472 to 5,120 flips in each of those sweeps). The second pass of a rotated high-quality draw stays on the per-pixel model (the stepper trades as many pixels as it fixes over the 600 rotated captures).
  • Translucent Clamp colour. Native reads the RGB of SetWrapMode(WrapMode.Clamp, Color.FromArgb(160, 217, 43, 129)) as already premultiplied: the clamp pixel is (217, 43, 129, 160). TranslucentClampProbe.cs draws a 4 x 3 mixed-alpha source at 1x and 2.5x with alpha 40, 160 and 255 under Bilinear, Bicubic, HighQualityBilinear and HighQualityBicubic onto straight and premultiplied surfaces over six backdrops with SourceCopy and SourceOver (576 draws). In the premultiplied domain, with a channel above its alpha saturated, literal bytes reproduce every pixel under Bilinear (without the per-line clamp to the line's alpha: with it 28 of 78 pixels differ), Bicubic (with the per-line clamp to the line's alpha; the earlier reading differed on 66 of 75 pixels at alpha 160) and HighQualityBilinear (the horizontal intermediate not clamped to the alpha); HighQualityBicubic goes from 160 to 35 differing pixels and keeps a red a few levels high on the edge columns (its negative lobes meet a clamp above the alpha). Premultiplied intermediate, feasibility: a pixel with a channel above its alpha cannot be written to a canvas, and what native does with one on a SourceOver draw is a 32-bit add of the pixel and round(backdrop (255 - alpha) / 255) per channel with carries (6,578 of 6,578 touched pixels over six backdrops, src/emf-plus-translucent-clamp.fixture.test.ts): a red excess carries into the alpha and leaves alpha 0 with colour. Reproducing that needs the unclamped premultiplied block from the resampler plus a readback of the backdrop for those edge pixels and a way to store alpha 0 with colour (not possible in a canvas); on an opaque white backdrop the saturated result is white where native garbles it. It is not built: the saturated straight result is what a transparent backdrop or a PNG of the SourceCopy case gives, and every pixel without an excess channel is now exact.
  • Rotated and sheared plain Bicubic. The 64 independent shear and rotation captures (bicubic-independent, modes 2 and 3) were 10,296 differing pixels up to 255 levels with the float convolution; a typical capture differs by one to eight levels on 97 of its 99 covered pixels and by coverage on one to three edge pixels. Native runs the integer pipeline of the axis-aligned draw (premultiplied bytes, 1/64 phase, 16.16 weights, truncated passes), steps the position with the float32 stepper above (the axis-aligned draw keeps its nearest-16.16 stepper, which fits it exactly) and covers the parallelogram by rasterizePlusFill from its unsnapped 28.4 corners, as NearestNeighbor does. Result: 44 differing pixels of at most 5 levels (21 shear, 23 rotation; 34 of the 64 captures exact). The independent-capture ceilings of 64 of the 128 captures are tightened and none rises. Mirrored (mode 1: 94 pixels) and axis-aligned (mode 0: 38) independent captures are unchanged.
  • High-quality step. The 680-draw grid of round 6 is explained to 572 draws: the dest/source scale is a float32 and its last bit decides the 16.16 step of an upscale. With a and d the scales rounded to nearest, r = fl(1 / fl(a d)), the x step is round(65536 fl(d r)) and the y step round(65536 fl(a r)) (so the vertical step depends on the width), and the extent of the quad uses the scale rounded toward minus infinity (otherwise a whole-pixel destination edge adds a column). 243 combinations of nearest, down and up rounding of the scales, determinant, reciprocal and products give at most this 572; the 108 left are tall sources (one to four rows each: 8x200 to 40x336 at 1.55x, 8x336 to 40x336 at 1.37x; for example row 285 fails in both the 200 and the 336 high draws at 1.55x) and the 8, 16 and 32 wide sources of height 64 at 1.37x (native y step 47,836 where the chain gives 47,837). The recorded high-quality fixtures do not change (121, 120, 97, 77, 28 to 49 and 34 differing pixels stay).
  • High-quality residuals (negative results). Level sequences under a swept origin (image-levels.json.gz: grey noise, HighQualityBilinear and HighQualityBicubic, one axis moving at a time) agree with the integer k S + offset model for 135 of 224 changes exactly and 155 within one draw (58-wide reduction), the rest being one draw late or early or a level apart at a 1/128-pixel phase-bin edge; a float32 round-down stepper in its place drifts by up to 12 draws by pixel 40, an unrounded or ceiled vertical step is worse (342 to 445 of 1,160 pixels differ against 30 to 62) and a floored one too (62 to 106), floor or ceil of the offset (78 and 79 exact of 224 against 135), float32 round-down evaluation of the edge offsets q of the reductions changes nothing, and truncating or flooring either pass instead of rounding it leaves 4,863 to 7,499 of 16,000 pixels (rounding both: 121 and 34). The unmatched changes are the vertical axis' ±1 level dithering between neighbouring bins, which the monotone model lacks (a pixel steps 150, 149, 150, 149 ... 140 over 21,333 draws); the fixture residual is concentrated in single rows (rows 2 and 3 of the 58 x 20 tent draw differ on 13 and 14 of 58 pixels, row 7 of the cubic draw on 23), so the vertical positions or weights of particular rows are what is left.

Round 8: reductions in 16.16 fixed point, unsnapped edges ​

Probe HighQualityReductionGridProbe.cs (mode hq-reduction-grid, capture hq-reduction-grid, test emf-plus-hq-reduction-grid.fixture.test.ts): grey noise through axis-aligned reductions, both kernels, DrawImage(destRect, srcRect): 64 x 40 to 64 x h for h 9 to 37, 40 x 8 to w x 8 for w 11 to 30, 40 x 8 to 20 x 8 at 15 fractional origins and 64 x 40 to 64 x 20 at 8 fractional tops (4 + 1/64 to 4 + 63/64), and the two reduced geometries of the gpx-image-highqualitybicubic fixture (148 draws). The weights themselves were first read as impulse intervals (one bright row or column at 255 intensities per draw, which reads each destination pixel's weight of each texel to 1/510: scratch analysis, not committed) and the edge bins were inverted from them.

Rules found, with the evidence:

  • Texel edges are fixed point. A texel edge at (t - 1/2) lands in 1/128 destination pixel at floor(((t - 1/2 - origin) 65536 - P) s16 / 2^25), P = k step + offset (the position of pixel k in 1/65536 texel), and the weight is the difference of the kernel's running integral at its two edges' bins, as before. The floating-point form floor(128 s (edge - P)) put the exact-tie edges (scales such as 20/48, 21.6/48, 0.5, 0.4 give an integer x at every third or second edge) one bin low at half of them. The multiplier s16 is round(2^32 / step) for the tent and the even number 2 round(s 32768) for the cubic: of the 29 vertical scales 9/40 to 37/40, 28 tent and all 29 cubic sweeps are exact with them (the cubic's multipliers are even in every reduction measured, about 30 scales: 27,306 for 20/48 where the tent has 27,307, 39,322 for 0.6, 29,492 for 21.6/48); the cubic edges are centre-based (centre -/+ s16 / 2) with a half scale rounded to an integer, which is why only even multipliers fit. The horizontal axis follows the same rules (the 8 horizontal reductions give the same OK ranges, vertical and horizontal, to the unit).
  • A reduction's step rounds up from a fraction of about 0.47. 65536 / s of 21/40 and 29/40 (124,830.48 and 90,394.48) step by 124,831 and 90,395 where 73,156.47 (43/48) and every fraction up to 0.40 step down (about 30 scales; the threshold is fitted between 0.469 and 0.477, HQ_REDUCTION_STEP_NUDGE); an upscale keeps the plain rounding (1.37x, 47,836.496, steps down). The mechanism is not found: float32 rounding of the reciprocal in any of 81 combinations moves it by at most 0.01, and a step derived from the quantised scale (round(2^32 / s16)) lands 1 to 7 off.
  • Edges are the unsnapped ones. The destination edge is rounded to the 1/16 grid with ties down (79.5 sixteenths is 79), and an edge that lands on a whole pixel is still tested unsnapped for coverage: 4 + 1/64 and 4 + 1/32 leave the pixel 4 out and cover 5..24 (the converter covered 4..23). The vertical phase is the distance from the unsnapped top to the first row (all 64 fractional tops of both kernels exact). The horizontal phase is 1 - dx of the unsnapped edge, except that an edge that snapped down onto a whole pixel steps from it, one step further ((1 + f) S), and one that snapped up one step less ((f - 1) S): 4 + 1/64 .. 4 + 1/32 and 4 + 63/64 (all 64 fractions of both kernels and both axes of a 40 -> 20 reduction exact, 256 of 256 draws, scratch sweep fs-*.json; the capture keeps 23 of them).
  • The float32 chain of the horizontal edge. The Half-mode fixture draw (64 to 25.6 wide at x = 64) has a left edge of 63.4999962 (3.8e-6 pixel of noise from a double sum of float32 products) and a horizontal scale of exactly 0.4, all ties: native lands 1 to 2 units of 1/65536 texel earlier than that edge gives; forming the edge as down32(down32(fr(a) srcX) + down32(e)) (the row stepper's rounding) reproduces it.

Results: hq-reduction-grid 73 of 148 draws exact (15,332 values off) to 144 (25 values off); hq-phases reductions: bicubic plain 6 to 9 of 9 exact (326 values to 0), bilinear plain 6 to 8 (85 to 10), bicubic mirror 689 to 396 values (6 of 9 exact, unchanged), bilinear mirror 354 to 359 (6 of 9 exact, unchanged: five values worse in an already inexact draw); the noise captures' bilinear reductions 2 to 1 values off. Fixtures at zero tolerance: gpx-image-highqualitybicubic/-high 121 to 12, -highqualitybilinear 34 to 7, -pom-half-, -pom-highquality- and -pom-highspeed-highqualitybicubic 28, 28 and 49 to 0 (now exact in gdi-parity.fixture.test.ts), gpx-image-attr-clamp/flipxy/tile-highqualitybicubic 97, 77 and 120 to 67, 41 and 90 (pixels beyond one level under TileFlipXY, Tile and Clamp 4, 15 and 2 to 1, 13 and 0).

Left, with the data that would decide it: the first two columns of the 64 x 48 to 58 x 20 horizontal reduction (closed in round 10: a start position one unit of 1/65536 texel early for an edge beyond 64 pixels, see "Round 10 (R10-F2)" below; the x values of 6 edges sit within 0.002 of an integer and native takes the other bin at k = 1 and 2 only; a constant -1 or -2 unit offset for every k is worse over the whole grid, 604 and 735 against 430 values, because it is not applied to the edges up to 64 pixels), one value in each of the 64 x 40 to 64 x 16 and 64 x 48 to 25.6 x 21.6 tent draws, the remaining wrap-mode pixels (the wrapped reductions; the sub-rectangle upscale of draw 3 is closed in round 10), and the mirrored bilinear reductions (359 values). The JPEG one-level pixels are float ties of the plain Bilinear stepper, not partial alpha (see EMF+ below, last bullet of "Image codecs").

Round 9 (W4): DrawImagePoints is the same sampler with different float arithmetic ​

Research. Microsoft's documentation (Graphics.DrawImage overloads, InterpolationMode, WrapMode; https://learn.microsoft.com/en-us/windows/win32/api/gdiplusgraphics/nf-gdiplusgraphics-graphics-drawimage(image_constpoint_int)) says only that a three-point overload maps the source rectangle onto the parallelogram whose fourth corner is derived from the first and second and the first and third points. It gives no sampling arithmetic, no prefilter rule for HighQualityBicubic and no edge rule beyond WrapMode; the PhotoSauce article (https://photosauce.net/blog/post/image-scaling-with-gdi-part-3-drawimage-and-the-settings-that-affect-it) is empirical and consistent with what is measured here. Wine's and libgdiplus' resamplers were not consulted for numerics: they are independent float re-implementations and cannot carry GDI+'s bit-level rounding, so nothing is inferred from them. Everything below is measured here.

Answer to the key question (measured). A metafile records DrawImage(image, rectangle) as DrawImagePoints with float32 noise in the points ((20, 10) becomes 20.000030517578125, 10.000015258789062), and native drawing of exactly those points reproduces the JPEG playback (0 differing pixels), while the same rectangle drawn as DrawImage(destRect) differs from it by 22 pixels. The sampler is the same bilinear resampler (same 1/2048 fractions, same stepping); its float arithmetic differs. Rectangle and three-point draws of one rectangle flip at origins that differ by 20 to 30 float32 units on every one of 144 columns (ImagePointsProbe.cs, generate-image-points.ps1, captures image-points.json.gz, image-points-positions.json.gz, test emf-plus-image-points.fixture.test.ts).

Shipped (axis-aligned plain Bilinear DrawImagePoints only): the vertical position runs a relative 2^-21 above the exact one (959 flip origins bisected to one float32 value in eight geometries fit e = 4.3e-7 to 5.5e-7; best 4.8e-7 to 5.0e-7; no float32 rounding of the matrix, product or sum reproduces it, and the source or destination DPI does not change it; the mechanism is unknown, so the constant is the nearest power of two), and the horizontal step is the nearest float32 reciprocal of the scale (a 100 -> 100 draw with a 10 -> 8 vertical reduction: 3,155 differing pixels of 27,648 to 2; a 360 -> 162 reduction 31 to 6; the 37 -> 260 upscale is unchanged). codec-jpeg-arith-prog-420-dri2-playback 22 to 12 differing pixels, codec-jpeg-arithmetic-playback 2 to 1, codec-jpeg-cmyk-photo-playback 7 to 3; all image fixtures otherwise unchanged. Negative result: accumulating x rounded to nearest (the round-7 hint) is worse on every points geometry (12 -> 9,172 differing pixels in the JPEG-sized noise draws) and was not shipped.

Still missing (open). The 12 JPEG pixels left are columns (57, 66, 176, 185, 194) whose native position moves by up to 44 float32 units (8e-5 pixel, 0.02 of a bin) when the origin's y changes by 2^-16 pixel, independently of the row read (row 30, 60, 95 and 150 give identical shifts) and with no dependence on the origin's y at 10.0, 10.5 or multiples of 1/128. It is not a function of the matrix entries the model has (the model's x position does not depend on y), so the arithmetic that couples them is unidentified. The same round did not touch the HighQuality reductions, wrap-mode residuals or texture single pixels (attr-tile/clamp/flipxy HQ 90/67/41, hq 12/12/7, rotated 5, texture 2/1/1/1/1 pixels): no new evidence was gathered for them, and the reduction-step nudge (reciprocal fraction 0.47) is not explained by the 2^-21 bias (it would push 73,156.47 up, which native does not do).

Round 10 (R10-F): the wrap of a cropped draw's fifth kernel row ​

The 67, 41 and 90 pixels left in gpx-image-attr-clamp/flipxy/tile-highqualitybicubic were all in one row, the last destination row (y = 93) of the third draw (the 14 x 10 sub-rectangle at (2, 3) of the 20 x 16 bitmap upscaled to 90 x 44), differing by one or two levels (every pixel of that row for Tile, 41 to 67 of 90 for the others); no step-grid jitter, no alpha, no horizontal edge (the same draws under Bilinear are exact, and so is the first row). The remaining 12, 7 and 5 pixels of gpx-image-highqualitybicubic/-high, -highqualitybilinear and gpx-image-rotated-highqualitybicubic are not wrap pixels (columns 99 and 100 of the 58 x 20 reduction for the first two, scattered rotated pixels for the last) and are unchanged.

Probe HighQualityWrapCropProbe.cs (mode hq-wrap-crop, capture hq-wrap-crop.json.gz, test src/emf-plus-hq-wrap-crop.fixture.test.ts): DrawImage(destRect, srcRect, unit, ImageAttributes) of a bitmap that is grey (0 or 128) with one white row or column per draw, Clamp colour opaque green, seven geometries (whole bitmap, inner crops, crops at an edge, 1x to 6.4x), Tile, TileFlipX, TileFlipY, TileFlipXY and Clamp, both high-quality kernels (5,600 line captures; the grey 128 background makes the cubic's negative lobes readable). Measured: the x axis and every row but the last two of the rectangle are as the model had them; the last destination row has a fifth tap (weight about -0.008, one level) at the bitmap row srcY + srcH + 2 which the bicubic table already carried. Native does not read that row from the bitmap: Tile reads row srcY - 2 (geometry 0: row 15 reads row 1; geometry 5, a 16-row rectangle at row 8 of a 32-row bitmap: row 26 reads row 6; a rectangle at row 0 reads row 0), the flips read its mirror image and Clamp puts the weight on the clamp colour (the baseline of a non-tap impulse in the last row moves by +1 red and -1 green, the signature of a weight of -1/127 on (0, 255, 0)). The rows past the vertical margin (ceil(support / min(1, scale)), 2 for the cubic) therefore wrap inside the rectangle extended by the margin on each side and cut to the bitmap (period srcH + 4 inside a bitmap, the bitmap itself when the rectangle is the whole bitmap), then inside the bitmap. Shipped in resampleHqAxisAligned (the margin used to be unbounded under a WrapMode). All 5,600 captures are exact with the wrap (before it, the 2,800 bicubic captures held 124 mismatching destination pixels, all in the last row of the vertical axis: tile and flips 1 to 20 per geometry, Clamp 18 to 34; both kernels are exact now). Fixtures at zero tolerance: attr-tile 90 to 0, attr-clamp 67 to 0, attr-flipxy 41 to 0; the other 907 fixtures are unchanged, and the three bounds in gdi-parity.fixture.test.ts are now exact. generate.ps1 mode hq-wrap-crop must run under Windows PowerShell 5.1 (powershell.exe): WrapMode is not forwarded in PowerShell 7.

Left, with the experiment that would decide it: the two columns of the 58 x 20 reduction (known from round 8: the sampling position one 1/65536 unit early at k = 1 and 2) and the 5 rotated pixels were the open items; both experiments were run in round 10 (R10-F2, next section).

Round 10 (R10-F2): the start position of a reduction at a far edge, and the rotated ties ​

The 58 x 20 columns (closed). The prescribed impulse grid (one white column at 255 intensities, source widths 60 to 66, destination widths 54 to 62, first three destination pixels) could not decide it: a one-unit position error moves a weight by under 1/255 in the kernel's tails, so every fitted interval of every draw contained the converter's position (scratch run, not committed). Noise does decide it (sums of several weights times random texels), through a constant offset of the position fitted to every column of a draw. Probe HighQualityReductionPositionProbe.cs (mode hq-reduction-positions, capture hq-reduction-positions.json.gz, test src/emf-plus-hq-reduction-positions.fixture.test.ts, 1,131 draws): 64 x 48 noise into D x 20 for D 50 to 63 (every scale a dyadic fraction, so every texel edge is a tie and a draw is exact only if the position is) at 19 left edges from 4 to 2,000 pixels, the dyadic 48, 96 and 128 wide sources at four edges, the 64 to 58 scale at ten fractional edges, a dense sweep (every edge from 56 to 140 and every tenth to 700) and the vertical axis (48 x 64 noise into 48 x D at 10 top edges), both kernels. Measured: the fitted offset depends on the edge alone, not on the scale, the width or the kernel: 0 for a left edge up to 64 pixels, -1 unit from 65 (the last -1 edge measured is 256), -2 from 260 (the last -2 edge measured is 512; 257 to 259 were not measured); past 512 (first measured 520) it reads -4 or -5, and -9 or -10 at 1,500 and 2,000, with an extra that depends on the scale and is not modelled. A fractional edge follows the same steps (98.0625, 98.125, 98.25, 98.5, 98.75 and 98.875 read -1, 300.5 reads -2, 700.5 reads -4) except 98.9375, which reads 0 or more. The vertical axis starts the same number of units later (+1 from 65 to 256 pixels, +2 or +3 from 300 to 512), and the sizes match a float32 step of the edge in 16.16 (the ulp just below edge x 65536 is 1/4 unit up to 64, 1/2 up to 128, 1 up to 256, 2 up to 512; the sub-unit sizes would round away from zero at a half): the mechanism is inferred from the sizes, not read from native code. Shipped as hqStartShift in resampleHqAxisAligned for edges up to 512 (the 15-sixteenths fraction excluded): 929 of the 936 draws with an edge up to 512 are exact (434 without it): all 420 of the whole-edge 64-wide draws (348 without), 18 of 18 fractional-edge and 366 of 366 dense-sweep draws (4 and 27 without), 39 of 42 other dyadic scales (25 without; the 96 to 80 scale carries a separate +1 start of its own at edge 4, so it fails there for both kernels and, once the shift is applied, for the cubic at 98: 3 draws) and 86 of 90 vertical draws (30 without; the 64 to 50 scale past 256 reads +3 where the model gives +2: 4 draws). Fixtures at zero tolerance: gpx-image-highqualitybicubic and -high 12 and 12 to 0 (now exact in gdi-parity.fixture.test.ts), gpx-image-highqualitybilinear 7 to 1; hq-reduction-grid 144 to 146 of 148 draws exact (25 to 2 values off). The one pixel left in -highqualitybilinear is the Half-mode 64 to 25.6 x 21.6 draw (edge 63.4999962, a position of -3 units at k = 20 only, every other column exact: not a constant offset, so it belongs with the float32 chain of that edge that round 8 left open).

The rotated pixels (negative result, evidence kept). Probe HighQualityRotatedFixtureProbe.cs (mode hq-rotated-fixture, capture hq-rotated-fixture.json.gz, test src/emf-plus-hq-rotated-fixture.fixture.test.ts): the fixture's own corner floats (30, 10), (90, 30), (15, 55) with its pattern and eight noise sources, each as the one-step native draw, as the native pre-scale to 64 x 48 and as the plain Bicubic draw of that native intermediate. The native one-step draw equals its two-step form to one pixel of 16,000 (zero for one source), so the pre-scale is not the residual; the converter misses the same pixels for every source (the fixture's five, three to five per source), so the cause is geometric. The inverse of this quad is exactly 0.96 and 0.32 per pixel, and every one of the five samples the intermediate at an exactly whole v (8, 16, 24, 32 and 40: a tie of the 1/64 phase). Our 16.16 row stepper starts at the padded image's first pixel, rounds the start up (0.44 unit) and steps by 20,972 against the true 20,971.52, which lands exactly one unit below the tie (errV -1 at all five); native lands on or above it. Tried, all measured on the same data: a start one unit later closes all five (and the nine sources), as does a stepper that starts at the first pixel of the unpadded quad, but each loses exact captures of hq-rotated and the scale sweep (over the 450 rotated captures of hq-rotated and the 168 scale-sweep draws: the one-unit start 671 to 751 differing pixels, 420 to 383 exact captures; the unpadded start: 650 pixels, 398 exact; starting 1 pixel before the unpadded first pixel: 635 pixels, 415 exact), with the losses in the 10, 45 and 60 degree draws (checked on the 60 degree 1.5x noise draw: its pixels at (40, 21) to (40, 23) sit 0.0035 to 0.01 unit above a whole v, where our stepper is one unit below and native stays below too: the same stepper error as the fixture's five with the opposite native side); exact per-pixel positions instead of the stepper, and a truncated or ceiled step, are far worse (767 to 1,566 differing pixels summed over the nine sources against 40), so the rounded integer step is right and the start is what differs. Not shipped (it would lose exact captures); the one-unit variant is on branch r10-hq-images-2-candidate. What would decide it: a rotated quad with a long run of exact ties from the first pixel (an inverse whose per-pixel step has a fractional part near 0.5 and a start on a tie, swept over the row's offset from the left edge) to read the native start independently of the quad, or the native scanline code's own start rule.

Round 10 (R10-G): the small non-text raster residuals (negative result, stage isolated; the texture and gradient parts were closed in round 11, R11-F, below) ​

The residuals left in the report are all one level in one channel (codec-jpeg-arith-prog-420-dri2-playback 12 pixels, codec-jpeg-cmyk-photo-playback 3, codec-jpeg-arithmetic-playback 1, plus-effect-blur-r3-rotate30 and plus-only-effect-blur-r3-rotate30 6 each, gpx-texture-pom-half-tile 2, gpx-texture-tile, -nearest-tile, -flipx and -flipy 1 each), except the blur pixel (98, 83), which is one level in three channels (two in the plus-only twin). They were dumped pixel by pixel against the references and the counts reproduced on the unchanged head. Stage, per group:

  • JPEG playbacks: the draw, not the decode. The decoders are pinned exact on these very files (image-codec-native.test.ts, 50 tests), the CMYK table is exact, and the differences sit in a handful of whole columns: the 12 pixels of the arithmetic progressive file are in columns 57 (4), 66 (2), 176 (2), 185 (1) and 194 (3); the three CMYK pixels in columns 158 (2) and 57; the arithmetic pixel in column 185. The model's source fraction in those five columns is 543.4863, 1118.4941, 409.4766, 984.4844 and 1559.4922 of 2048, that is 0.0137, 0.0059, 0.0234, 0.0156 and 0.0078 bin below the half-bin rounding boundary, so a crossing of that boundary needs native's x position at least 3e-6 to 1.1e-5 texel higher there. The recorded points are (20.000030517578125, 10.000015258789062), (280, 10.000015258789062) and (20.000030517578125, 180): the far corners are exact, so the scale is (280 - 20.0000305) / 37 where the earlier flip-origin captures moved the far corner with the origin (ox + 260) and measured a slightly different matrix. A step changed by minus one to plus two float32 units (scratch run) or lowered by 1e-9 or 1e-12 per pixel changes no pixel of the three fixtures, so the residual is not a last-bit error of the step.
  • Blur: the rotated draw, not the effect. The effected bitmap was already exact (see EMF+ image effects). The six pixels are at columns 64 (rows 75, 78, 79), 77 (row 78) and 98 (rows 81, 83); the first covered pixel of those rows is 53, 58, 60, 58, 63 and 67, so the position has been stepped 11, 6, 4, 19, 35 and 31 pixels from the row start: the same row-start and stepper family as the textures, at a rotation of 30 degrees.
  • Textures: the stepper. All six differing pixels (four positions: (114, 5) in three fixtures, (115, 39), (103, 30) and (113, 45)) are in the rotated rectangle (75, 0, 85, 55) of GpxTextureFill (the converter's sampler box starts at 74, one pixel left of the fill edge: starting the row at 75 fixes gpx-texture-flipy and changes nothing else in the pom-half fixture, adds (117, 15) to the tile, nearest-tile and flipx fixtures, so the start column is not the cause).

The experiment that isolates it (TextureBisectProbe.cs, generate-texture-bisect.ps1, captures texture-bisect-{scale03,scales,random,upscale}.json.gz, 115 matrices and 6,238 flips, test emf-plus-texture-bisect.fixture.test.ts). The round-7 sweeps resolve a pixel's coordinate to a few float32 units of u; this probe bisects the brush translation over consecutive float32 values for single columns of a one-row fill (2 x 2 Tile texture, filtered red flips at the half texel, no world transform), so the first translation that flips a pixel is its native coordinate to a few units of 2^-22 texel (the translation spacing times the inverse entry). Facts, with the shipped model as the baseline:

  • The stepper is exact from a fill start of 7 pixels and fails below it. For the 0.3 scale at fill starts 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12 and 16 the model reproduces 1, 2, 2, 2, 2, 2, 41, 120, 120, 120, 120 and 120 of 119 or 120 flips. At u of about 20 to 26 at the start (70 scales, 40 isotropic and 30 anisotropic, 0.1 to 2.5) 61 matrices are reproduced for every flip (1,759 of 2,379 flips in all) and nine are not (for example 4 of 161 and 7 of 224). The round-7 sweeps had the same split without showing it: the committed sweeps that start at pixel 0 miss 224 (0.45x), 27 (rotated), 96 (1.37x), 40 (0.75x), 616 (0.3x) and 104 (0.9x) flips, and 496 and 335 under PixelOffsetMode Half, while the 0.45x and 0.3x fills that start at 40 (as rectangle and as clip) miss none and the rotated one 21.
  • The native chain depends on where the fill starts, not only on where a pixel is. The first flipping translation of pixel 30 of the 0.3 scale is 37, 32, 31, 31, 28, 28, 24, 24, 19, 19 and 9 float32 units of the translation below the one of the start-16 capture for fill starts 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and 12 (a spread of 2 to 3 units per pixel of chain, the rounding loss per step, which the model reproduces from start 7 on).
  • The step is lower than the float32 inverse entry, by an amount that depends on the matrix. A chain whose step is the inverse's x entry lowered by k float32 units takes the small-start misses of the 0.5 scale (k = 2), 0.25 (2), 0.125 (2), 0.4 (1), 0.2 (1), 0.6 (3) and 0.3 (3) from 173, 348, 698, 271, 510, 118 and 787 to 14, 90, 164, 36, 162, 17 and 149, and the 15 enlargements (2 to 16x, fill start 0, 148 flips, 8 of them reproduced by the shipped step) to 3 missed flips with k = 1 to 3 per matrix (6, 10 and 16 need none). Fit as a continuous step the lowering is 0.8 to 2.3 times 2^-23 of the true reciprocal and has no single value. Candidate formulas tried (determinant, reciprocal and product each rounded down, to nearest or up; the matrix entries raised by 0.5 to 3 times 2^-23 before inversion; 1 / (m + k ulp); Newton-refined reciprocals) reduce the 2,710 misses of the shipped step over the 73 isotropic captures of the enlargement, scale and random sets to 911 at best and the 791 of the first three rows of the round-7 sweeps to 659, and none matches all 17 fitted values. None reduces the recorded fixtures (applied to the texture sampler the best of them takes gpx-texture-tile, -nearest-tile and -flipx from 1 to 2 pixels and leaves the other two unchanged), so none is shipped.
  • The loss per step is one float32 unit of the current value, and it is deferred when the fill starts late. For the 0.5 scale (inverse entry exactly 2) at fill start 0 the coordinate lags e + 2x by 1.5, 5.5, 11.5, 31.5 and 103.5 units of 2^-22 at pixels 2, 5, 7, 11 and 19, the loss per pixel doubling at pixels 5, 7, 11, 19 and 35 (u of 7.5, 11.5, 19.5, 35.5, 67.5), which is the float32 spacing of u at each step; at fill start 8 the same pixels lose 0 at pixels 8 to 10 and 16 at pixel 11 (the 4 + 4 + 8 of three steps at once), then 8 per pixel to pixel 18 and 16 per pixel beyond. A float32 chain that rounds down loses nothing when the step is exactly representable, so the native step cannot be that exact value.
  • The translation is on a 2^-19 grid however large u is. For the 0.5 and 0.25 scales at fill start 8 every flip lies at the same residue (1 and 2) modulo 8 units of 2^-22 of the distance from the inverse translation to the threshold (60 and 120 flips), although the float32 spacing of u grows from 4 to 64 units over those pixels. A float32 chain on u itself would lock the flips to the coarser spacing; the coordinate behaves as the translation plus an offset that carries the lattice. At fill start 0 the exceptions are 6 of the 60 flips of 0.5 and 6 of the 118 of 0.25 (the rest sit on the same residues, 1 and 2); at fill start 2 the dominant residues move to 3 (52 of 60) and 6 (89 of 120), so the phase depends on the start.

Ruled out (all against the 115-matrix captures, the 16 sweeps and the fixtures): a different start formula (term order, one fused rounding, nearest rounding, the half-pixel centre, a start 1 to 16 pixels earlier or aligned to 4, 8 or 16: none lowers the 1,959 missed flips of the sweeps or the bisect misses; the shipped form is the best of them); per-pixel evaluation (27,821 missed flips of the sweeps against 1,959); a tiny negative bias per step, 2^-30 (it is exact for the 0.3 scale from start 4 and takes the rotated sweeps from 27 to 7 and from 21 to 5 missed flips, but breaks the others, 1,959 to 21,449, and takes the recorded texture fixtures from 1 or 2 pixels to 109 to 750); fixed-point steppers at 2^-18 to 2^-24 combined with the float32 chain (best 1,915 missed flips of the sweeps against 1,959); a bias of 2 to 64 added to u before the chain (8,877 to 29,150 missed flips of the sweeps); a chain started on a 16 pixel boundary (6,346; the sweeps' fills start at 0 or 40, so boundaries of 4 and 8 change nothing). For the image path the same experiment on image-points-positions.json.gz (720 column flips of the 37 -> 260 geometry, far corner moving with the origin): the shipped model reproduces 232, any scalar step 358 at best (the nearest float32 reciprocal plus 1 to 1.5 float32 units), a chain with the dx product rounded up and the step 1.75 float32 units higher 373, per-pixel evaluation 21, and a single-rounding evaluation 26; where it misses, the native coordinate exceeds the model's by about one float32 unit of the step per pixel of chain length (0.25 unit of 2^-24 per pixel), in jumps of one float32 spacing of u (16, 32 and 64 units of 2^-24 at u of 8 to 16, 16 to 32 and 32 to 64).

What the data say and what would decide it. The coordinate is not formed by a float32 chain on u: the loss per step follows the spacing of the running value, the phase is locked to a 2^-19 grid in the translation, the fill start enters, and the step is a few float32 units below the inverse entry by a matrix-dependent amount. A fixed-point accumulator with a floating exponent and a two-term (integer part plus fraction) form would predict different dependences on the fill width and on the start, and no capture varies the width (all end at pixel 160 to 200): the same bisection with the width varied is the next experiment for the texture family. For the JPEG draw an exact-geometry probe was tried and abandoned: with the recorded points (far corners fixed at 280 and 180) and the origin bisected over a window of plus or minus 1.1e-3 pixel it found no crossing in any of the 258 columns, because a parity source flips only where a column's coordinate is within 0.3 bin of a half texel (the five fixture columns are not), and widening the window changes the scale; ImagePointsProbe moves the far corner with the origin, so its 720 flips are neighbouring matrices of the recorded one. The probe and the captures of the texture family are committed so the next round can start from them.

Round 11 (R11-F): the 1-level brush residuals closed by reading gdiplus.dll ​

Method: the span classes of C:\Windows\System32\gdiplus.dll were read with public-symbol names only (DpOutputLinearGradientSpan::OutputSpan and its constructor, GpMatrix::MultiplyMatrix, Invert, Rotate, CalcLinearGradientXform, GpMatrix::InferAffineMatrix, the DpOutputBilinearSpan constructor and OutputSpan, DpOutputNearestNeighborSpan::OutputSpan, slowAdjustValue, FPUStateSaver::RoundSat), the arithmetic was rebuilt in TypeScript, and every claim below was then tested against native captures; no disassembly is committed. Result: gpx-texture-tile, -flipx, -flipy and -nearest-tile 1 to 0 differing pixels, -pom-half-tile 2 to 0, gpx-lin-sigma 2 to 0, gpx-pen-lingrad 13 to 0, gpx-text-lingrad 3 to 0 (839 of 910 report lines exact, from 831; every other fixture unchanged), and gpx-lin-blend-ellipse stays exact under the new rules. The mechanisms and what confirmed each:

  • Texture brush: a span is a start, an end and a step (DpOutputBilinearSpan::OutputSpan; confirmed: all 6,238 bisection flips and all 61,916 sweep flips are reproduced). Round 10's chain added the inverse entry once per pixel and could not be made to fit. Native transforms the span's two end pixels x0 and x0 + n through the float32 inverse (u = (y m21 + x m11) + dx, v = (x m12 + y m22) + dy), divides the difference by n (a float32 quotient) and adds that step to the start once per pixel; every product, sum, quotient and addition is a float32 operation rounded toward minus infinity (down32). The step is therefore not the matrix entry (it is the entry plus the rounding error of the two ends over n, which is why it looked "a few float32 units below it, by a matrix-dependent amount"), the start and the loss per addition depend on the span's own range (the dependence on the fill start), and the "2^-19 grid" is the rounding of the end positions. A scratch search over the rounding mode of the inverse, the transform, the quotient and the additions (nearest or down, 16 combinations) found exactly one that reproduces 6,238 of 6,238 flips (all down; the next best 5,836, the others at most 2,029). Per pixel the filter is the one the model had (11-bit weights, floor(frac * 2048 + 0.5), 22-bit blend).
  • Spans are runs of covered pixels (writeTextureRect). OutputSpan is called with (y, x0, x1) per scanline run, so a clipped or non-rectangular fill starts its chain at each run. The converter passes the coverage mask to the sampler (optional sixth argument of DeviceBrushSampler) and a run of non-zero coverage is a span; with no mask the box row is the span. The rotated texture rectangle of GpxTextureFill had been sampled from the box edge one pixel left of the fill (x 74, not 75), which changed the end and the step of every row. Not tested: antialiased fills (native's antialiasing scan converter may split spans differently; non-zero runs are the assumption) and spans longer than the scan buffer (native clamps the pixel count to the buffer; the fixtures are narrower).
  • PixelOffsetMode Half is part of the matrix. The two Half sweeps of texture-coordinate.json.gz (7,820 flips) miss 678 when the half pixel is applied to the positions (the model of round 7: add 0.5 to the device point, subtract 0.5 from the result) and none when the matrix m is replaced by T(0.5) m T(-0.5) (its translation: t + 0.5 (m11 + m21) - 0.5, all float32 rounded down) before it is inverted. The three orders of those operations tried agree on the data. The 14 non-Half sweeps, 1,959 flips off the per-pixel model of round 10, are exact too.
  • Nearest-neighbour textures. DpOutputNearestNeighborSpan::OutputSpan was read as far as its stage: it forms the span ends in float32 like the bilinear one and converts them to 16.16 (x 65536 + 0.5, floored) before stepping, so its positions are fixed point. The converter still gives a NearestNeighbor texture the bilinear positions and gpx-texture-nearest-tile is exact with them (its single failing pixel of round 10 was the same position error); a native sweep of NearestNeighbor positions has not been taken, so the fixed-point step is read, not confirmed.
  • Linear gradient: the device-to-ramp matrix is a float32 chain (DpOutputLinearGradientSpan constructor; confirmed: the 8,196 steps of linear-ramp-origin.json.gz and the 7,986 steps of the new linear-ramp-world.json.gz are all exact). OutputSpan itself was the model already: per pixel p = x du + y dv + u0 in 32-bit integers, (p >> 16) & mask selects a knot of the 32, 128 or 512 entry doubled table, (p >> 8) & 255 the blend of two knots with ((256 - f) a + f b + 128) >> 8. The three coefficients are floor(m + 0.5) of a float32 matrix: the ramp-to-rectangle matrix T (sx = ((x + w) - x) / (N 65536), translation (x + w) - sx N 65536, from the float32 rectangle) times the brush matrix times the world-to-device matrix, then Invert, every product, sum and the reciprocal rounded toward minus infinity. Round 9 had tried a float32 composite inverse and found 27 steps wrong; it used another order and rounded the quotient to nearest. A scratch grid over the rounding of the six stages found one that fits (all down, 0 wrong steps; rounding any one stage to nearest leaves 1 to 69, all of them to nearest 153). gpx-lin-sigma was this: its origin was a hair off.
  • Where the canvas sits matters (gpx-pen-lingrad, gpx-text-lingrad). The converter's canvas starts at the metafile's bounds, which can lie left of or above the frame (gpx-pen-lingrad: bounds from y = -18; gpx-text-lingrad: x = -12), while GDI+ forms the matrix for the device pixels. Folding the canvas shift into the matrix changed the float32 rounding of its translation (the 13 and 3 pixels of those two fixtures); the sampler now receives the whole-pixel shift separately (canvasShift) and applies it in integers after the float32 chain. A scratch search over a constant offset of u0 on them had found 8 and 4 to 5 units (0 differing pixels at +8 and at +4, no common value), which is what a translation rounded in the wrong place looks like.
  • A brush recorded without a matrix is not the identity (CalcLinearGradientXform + GpMatrix::InferAffineMatrix; confirmed on 69 managed brushes of every rectangle size and sign, and on gpx-lin-blend-ellipse). The EMF+ object omits the transform for a horizontal brush, but GDI+ gives the brush the matrix that maps its rectangle's corners onto themselves, formed in float32 rounded down: diag(0.99999994) for 50 x 60, diag(0.9999999) for 160 x 100, exactly 1 for 1 x 1, off-diagonal terms of 1e-8 to 1e-7 for fractional rectangles (defaultLinearBrushMatrix). Mathematically the identity, and visible only at pixels within a few units of a table fraction boundary: the 7 pixels of gpx-lin-blend-ellipse, which a double precision chain had matched by luck and the float32 one would have lost. The reference PNG is a direct draw and equals native playback of the recording (DrawImage of the metafile onto a bitmap: 0 differing pixels), so both agree.
  • RotateWorldTransform is GpMatrix::Rotate (confirmed: 132 native Translate-and-Rotate world matrices; rotateWorldTransform). The angle times the float32 constant 0.0174532924, sinf and cosf, and the products and sums all rounded down (prepend: m11 c + m21 s, m12 c + m22 s, m21 c - m11 s, m22 c - m12 s). A double precision rotation rounds cos(-25 degrees) to the float above GDI+'s (0.9063078165 against 0.9063077569), which moved the pixels of gpx-lin-blend-ellipse; rounding to nearest misses 112 of the 132 matrices, rounding down none.

New captures: LinearRampWorldProbe.cs / generate-linear-ramp-world.ps1 (linear-ramp-world.json.gz, 162 scenes of 49 steps, 97 for the fixture's own: a brush rectangle moved in 2^-16 pixel steps under Translate and Rotate (every 5 degrees, 60 random angles, 30 scaled with random brush angles), three scanlines per step, the world and brush matrices GDI+ holds recorded; test emf-plus-linear-ramp-world.fixture.test.ts). emf-plus-texture-bisect.fixture.test.ts now pins every one of the 6,238 flips and emf-plus-texture-coordinate.fixture.test.ts every flip of its 16 sweeps (bounds 0); the bounds of emf-plus-linear-ramp-origin.fixture.test.ts are 0.

Left: the DrawImage path (emf-plus-image-resample.ts) uses the same OutputSpan for plain Bilinear, so the 16 JPEG playback pixels and the 12 rotated-blur pixels of round 10 are probably this family (their stepper still adds the matrix entry and starts at a corner-relative position); this round did not touch that path. Nearest-neighbour fixed-point positions are read but not isolated. The OneD gradient span (DpOutputOneDGradientSpan, used for some rectangle gradients) was not exercised by any fixture.

EMF+ gradients ​

Round 11 (R11-D): the path-gradient converters, read from gdiplus.dll ​

Rounds 1 to 10 fitted the path gradients empirically (the paragraphs below are that measurement history; the nested-copy model they describe, emf-plus-path-gradient-copies.ts, is gone). Round 11 read the system library instead and ported what it executes: emf-plus-path-gradient-fan.ts (per-vertex surrounds), emf-plus-path-gradient-oned.ts (uniform surround, with or without a focus), emf-plus-path-gradient-curves.ts (Blend and InterpolationColors) and gdiplus-float.ts (the arithmetic). Functions read: GpPathGradient::CreateOutputSpan, PrepareBrush, Flatten, InitializeBrush, SetSurroundColors, SetBlend, SetPresetBlend; DpOutputPathGradientSpan (constructor, OutputSpan), DpTriangleData (SetTriangle, SetXSpan, GetXSpan, OutputSpan) with InitializeEdges, InitializeInactiveArray, InsertNewEdges, RasterizerCeiling, GammaLinearizeAndPremultiply, adjustValue, slowAdjustValue, interpolatePresetColors; DpOutputOneDPathGradientSpan (constructor, OutputSpan, SetupPathGradientOneDData), DpOutputOneDGradientSpan::AllocateOneDData, GpBilinearTransform (SetBilinearTransform, GetXSpans, GetSourceParameter), GpQuadAnalyzer::SetQuadAnalyzer, GpMatrix::Transform and VectorTransform. Each reading below was confirmed against native captures (the disassembly was a hypothesis until a capture agreed).

  • Rounding. GDI+ loads the SSE control register with 0x3F80 (round toward minus infinity) in the routines that guard its entry points, so every single-precision add, subtract, multiply, divide and square root of the renderer rounds down. This is the "float32 rounded toward minus infinity" that rounds 6 to 10 found stage by stage (float32-down.ts). Confirmed: the fan model below is exact on all 174,084 painted pixels of the 333 captures of path-gradient-vertices.json.gz with round-down and leaves 0.5% (rgb, 159 of 33,632) to 5.9% (shape, 1,035 of 17,484) of each group wrong with round-to-nearest.
  • Which converter. CreateOutputSpan builds the Gouraud fan when the surround colours differ and the one-dimensional ramp when they are all equal (SetSurroundColors keeps that as a flag; FocusScales and curves do not change it). The five grad-path-triangle-* and gpx-text-pathgrad fixtures use the fan; grad-path-focus-*, the ellipse and rectangle ones the ramp. Confirmed on the fixtures and on the 23 captures of path-gradient-vertex-blend.json.gz.
  • Fan arithmetic (FanTriangle). Device vertices transform as (x m11 + y m21) + dx in single precision, then become 28.4 coordinates as ceil(round(v 256) / 16) (multiplied by 16 twice, plus 1/2, floored, plus 15, shifted right by four: not ceil(16 v)). The three edges (centre to vertex i, vertex i to i + 1, vertex i + 1 to the centre) are walked top to bottom from ceil(yTop) with an integer quotient and remainder of dx / dy; the start x is stepped through the 16 - (y & 15) sub-rows with the error term, ceiled to a pixel, and the error shifted right by four. An edge's parameter is t = |c - c0| / steps in single precision with c the scanline (y-major edge) or the edge's pixel x (x-major), c0 the floor of the edge's first vertex on that axis and steps its truncated length; the vertex weights are (t, 0), (1 - t, t) and (0, 1 - t). A span steps the weights from the left edge's to the right edge's value over its n pixels (the right edge's value belongs to the first pixel past the span), each pixel ((c1 - c0) a + c0) + (c2 - c0) b per premultiplied channel ((alpha / 255) channel in single precision), clamped to [0, alpha] and floored after adding 1/2. A span cut by the window it is requested for (the surface, the fill) starts from the weights interpolated at the cut, which differs from stepping in single precision: 10 pixels of the x-major and vertex-to-vertex probes need it. This replaces the round 9 fitted edge and span formulas (99.36% of the pixels exact) with 174,084 of 174,084, every pixel of the 108 span captures, the four edge-stage sets and the two flat-grid sets, and 23 curve captures.
  • Curves on the fan. A Blend curve adjusts the centre's weight 1 - a - b and the other two weights are scaled to share what is left; an InterpolationColors ramp is read at that weight and replaces the vertex colours. SetBlend and SetPresetBlend store the factors, colours and positions reversed and subtracted from one. Written from the disassembly before any capture existed, then 23 native captures (five Blend curves on triangles and quads over white and black centres, two preset ramps, uniform controls, a focus, a rotation) were exact on the first run (PathGradientVertexBlendProbe.cs).
  • Ramp arithmetic (OneDGradient). The ramp is a table of N + 2 colours, entry i the blend at t = i / N (a sum of single-precision 1 / N steps), N = ceil(|d1| + |d2|) for the two diagonals of the brush bounding box under the linear part of the matrix (rampSteps, which pathGradientQuantum now calls: the 70 rotated, sheared and scaled counts are reproduced). Each boundary edge A -> B, both rounded to 1/16 pixel with ties up, is a bilinear quad (F_A, A, F_B, B); with no focus F_A = F_B = centre and the quad is the triangle (centre, A, B), with FocusScales (fx, fy) they are centre + (A - centre)(fx, fy) and a second quad (centre, F_A, centre, F_B) of constant t = 0 paints over the first. A scanline of a quad runs between the ceil of its edge crossings at the integer row; each pixel is solved at its integer position for t (a quadratic with the root choice, the tolerance -0.02 .. 1.02 on both parameters and the fall-back of GetSourceParameter: a pixel whose solve fails repeats the previous pixel's t, zero at the cut) and takes the table entry floor(N t + 1/2). Quads paint in order. This replaces the nested copies of boundary vertices scaled about the centre, the strip solver, the tie rules (tieSide, floatCopyIndex, focusCopyIndex) and the containment trade of round 10: every one of them approximated this solve. Exact on every pixel of the committed uniform captures: the 1,058,400 pixels of the focus-edge rectangles (781 wrong before), the 130,152 of the focus thresholds (246), the isotropic corner triangles (129 of 72,549), the independent-scale corner triangles (25,913 of 119,083 before, 424 of them unpainted), the slanted-edge ties (617 of 103,470), the focus shapes (the diamond, triangles and random shapes: 311, 143 and 400 wrong before, 72 of them unpainted), the small focus squares (39), the 240 alpha controls (230 pixels before), the steps probe's rows and images, the 70 rotated captures (15 pixels unpainted before) and the focus contours (12, 2,351 and 838 pixels before).
  • Outside the boundary. The ramp and the fan paint wherever their quads and triangles reach, not only inside the boundary's bounding box: a centre outside the shape paints its quads below the shape (the 72 pixels of rnd33 of the focus-shape set that the bounding-box cut left unpainted).
  • Wrap modes. CreateOutputSpan hands a Clamp brush, or a fill whose region lies inside the brush's bounds, straight to the converter; any other wrap renders the brush into a straight-alpha ARGB bitmap of round(right) - round(left) by round(bottom) - round(top) pixels (at most 1000 each) and draws that as a texture with the wrap mode (the fractional-tile model of rounds 6 and 7). The window of the converter is the tile's, and the premultiplied bytes convert to straight alpha as floor(p (255 / alpha)) with the reciprocal in single precision: the 24 translucent tiled controls that read one level high are exact with it (292,631 of 320,000 translucent colour pixels exact, against 222,321). A flipped tile is the bitmap mirrored texel for texel, which is the one-pixel lag of foldIntoTile.
  • Windows. The converter is asked for the spans of the shape being filled, one scanline at a time, and a span that starts inside a triangle is interpolated from its start. The sampler is given the fill's bounding box as the window, which is the native window for a rectangle; PathGradientClipProbe.cs (16 captures: a small rectangle, a rectangle half off the surface, an ellipse and a ten-point star under a fan, a ramp with a focus, and the tiled pair of each) shows 15 of 16 exact and the star's fan 2 pixels off, exact with each row's own span as the window. Open: a sampler that receives the rows' spans (the coverage rasteriser already has them).
  • Results. gdi-report.txt goes from 831 to 839 exact of 910 with no fixture worse: grad-path-triangle-flipx (16 differing pixels), -flipxy (18), -flipy (18), -tile (16), -clamp (4), grad-path-focus-ellipse-100-25 (2), grad-path-focus-triangle-75-25 (2) and gpx-text-pathgrad (15) are all 0. The colour-control bounds in path-gradient-color-bounds.json tighten from 105,570 to 35,260 differing pixels (colours) and 230 to 0 (alpha), none loosened.
  • Items 1 and 2 closed in round 12 (see "Round 12: tiled ellipses and span windows" below). (1) 24 of the 120 colour controls (91 to 94, 96 to 99, 101 to 104, 106 to 109, 111 to 114 and 116 to 119: a tiled ellipse whose bounds are on fractions of a pixel, 346 to 3,470 differing pixels each, at most two levels): the tile bitmap's boundary is flattened by native under the bitmap's matrix (a curve's vertices are quantised to 28.4 after the transform) and ours is flattened in brush space and scaled; flattening under the tile matrix alone takes control 91 from 448 pixels one level off to 217, the rest is the texture stage. (2) The window of a non-rectangular fill (2 pixels of the star). (3) The sampler returns straight alpha, so a translucent fill is premultiplied again by the surface; the premultiplied bytes it works from are exact.

Round 12: tiled ellipses and span windows ​

Native probes were not needed: the 120 colour controls (path-gradient-colors.json.gz) and the five tiled ellipses of path-gradient-tiles.json.gz hold the stage in isolation (the painted alpha of the tiled ellipses is equal to native on every pixel; the opaque pixels differed on 70 of 67,907; all of the residual sat on partly transparent edge pixels). Three changes, each measured on those captures:

  • The tile bitmap's outline is flattened under the bitmap's matrix, and its bounds are the path's. The brush now keeps the first figure of a curved boundary as recorded (source); a tiled brush with fractional bounds scales that path into the round(right) - round(left) by round(bottom) - round(top) bitmap and flattens it there (28.4 after the transform, as the fan and ramp already do), and takes the scale from the unquantised extent of the path instead of from its flattened vertices (whose extreme points sit up to 1/16 pixel inside). Float32-down arithmetic for the matrix made no difference to any pixel (the 28.4 grid absorbs it). On the five tiled ellipses 58,985 exact pixels of 78,494 became 64,856 with the outline alone; the capture at origin (20.3, 15.7), whose scale was wrong by the quantisation, went from 7,433 to 14,347 exact of 15,776.
  • The edge texels are filtered as bytes. Filtering the straight-alpha texels as native does reproduces both captures with: each texel's channels premultiplied and rounded to a byte, the four-texel sum (weights to 1/2048) rounded to a byte, and for a neighbourhood that is not fully opaque the channel divided by the rounded alpha and rounded to nearest. The tiled-ellipse readback (straight alpha, truncating) then matches 78,402 of 78,494 pixels (all within one level but 7; the alpha of the remaining 92 is one off) where the old real-valued p * 255 / coverage gave 74,115 within one level. Variants tried on the 16 opaque-centre and 8 translucent controls (texel premultiplication none, floor, round, ceil; sum none, floor, round, ceil; divisor the rounded alpha or the real coverage; quotient floored, rounded or by the single-precision reciprocal): the shipped one is the only one that is best on both groups (71 and 42 differing pixels; the old formula 2,100 and 33,253). Floor on the quotient is best for the straight readback alone (78,402) and loses the translucent controls (23,833), because the surface premultiplies again; the test reproduces the surface's round trip.
  • The converters are given each row's span. The sampler's optional coverage argument (aliased fills) now sets the window of a clamp fill (or a tiled fill inside its tile) to the run of covered pixels containing the pixel, which is what native hands the converters: the ten-point star's fan of PathGradientClipProbe goes from 2 wrong pixels to 0, and the 15 other captures stay exact (src/emf-plus-path-gradient-clip.fixture.test.ts). Antialiased fills still receive the bounding box (no coverage mask of runs; nothing measured there).

Results: the 120 colour-control bounds (path-gradient-color-bounds.json) fall from 35,260 to 113 differing pixels, none loosened, the maximum stays two levels; the 240 alpha controls stay exact. Still open: the 113 pixels (24 controls, edge pixels where the filtered alpha is one off, 92 of them on the tiled-ellipse captures); the data that would decide them is edge texels with chosen alphas through a texture brush, to read the filter's rounding.

Path gradients with uniform surrounds are closed to the step and, but for some of the pixels exactly on a copy's edge, to the pixel; ones with per-vertex surround colours are Gouraud fan triangles. GDI+ draws a path gradient as N = ceil(2 * hypot(w, h)) nested copies of its boundary (w x h is the device-space bounding box: a 600 x 80 rectangle has 1,211 steps, 2,422 under a world or brush scale 2, and a diagonal that is a whole number of quarter pixels is not rounded past itself), each a step closer to the centre colour, and a pixel takes the colour of the innermost copy that holds it. pathGradientQuantum and quantisedPathArgb (emf-plus-brush-gradient.ts) rebuild that: the ratio rounds to a whole step, the outer half counts steps from the boundary colour and the inner half from the centre colour (they round a level apart at half-way; round 6 replaced both halves by the float32 accumulation from the centre described below), premultiplied channels and alpha interpolate together, and Blend and InterpolationColors curves are read at the stepped position. The sampler in emf-plus-exact-fill.ts passes the step count; the nudge that selects a left-inclusive span no longer moves the sampled ratio.

How it was found: the probe in PathGradientStepProbe.cs captures whole rows through white-to-black rectangles, where the path-gradient geometry is trivial (a row is the plane 255 x / half-width up to rounding). 97% of values matched round(255 t); the remainder looked like noise until it was seen to depend on the rectangle's HEIGHT (rows of identical width and different height fall into groups whose boundaries sit where floor(4 * L) changes, L the half diagonal). Left and right of the centre mirror exactly; the left half is round(255 k / N) and the right half 255 - round(255 k / N) for the step count k = round(t N). The step count follows the half diagonal of the bounding box for rectangles of every size and centre, for triangles and ellipses (centred or not), under world/brush scales (device-space bounds), with Blend and preset curves read at k / N, and for isotropic focus (contours scaled about the centre). 72 rows reach 25,390 of 25,568 pixels; the 64 images 99.25-100%; the earlier 120 colour, 240 alpha, 252 focus-contour captures rise by 98,306, 20,132 (translucent), 35,628 (uniform alpha) and 18,270 exact pixels (see parity-notes.md for the totals), with every per-capture ceiling in path-gradient-color-bounds.json tightened (176 of 360 entries) and none loosened.

Per-vertex surround colours are not nested copies at all. GDI+ fans the boundary into triangles (centre, vertex i, vertex i + 1) and Gouraud-shades each with a whole-pixel scan converter; emf-plus-path-gradient-vertices.ts reproduces it. Found by isolating one channel at a time (a red-only vertex makes each channel the weight map of one vertex; the three channels of an RGB triangle are independent and identical to the three single-channel captures) and then reading how the colour behaves along one scanline of one fan triangle: (1) a span runs from ceil(xLeft) to ceil(xRight) at the integer row, with no sub-pixel correction, so the colour at the first pixel is the left edge's colour rather than the colour at the crossing (this alone is the x shift of about -0.5 pixel that a plane fit to the colour shows, and it is why a smooth fan model is up to four levels off on slanted edges but not on a horizontal one); the right edge's colour belongs to ceil(xRight), the first pixel past the span, so the per-pixel step is the end difference over xe - xs, not over the true width. (2) Each edge is walked along its major axis (x when |dx| > |dy|) in trunc(|d|) whole steps from floor of its first vertex, taking the edges in the order centre -> vertex i, vertex i -> vertex i + 1, vertex i + 1 -> centre; the edge parameter at a column or row u is |u - floor(a)| / trunc(|b - a|) (the colour at x = 32 on one edge was k / 11 for six rows, with the denominator trunc(11.69); rows give k / 13 for a 13.75-row edge). (3) The span interpolates in 16.16 fixed point with the step taken by floor (a toward-minus-infinity shift), the ends truncated, and the pixel rounded half up: a tie such as a constant 127.5 row rounds up while a drifting row loses a fraction to the floored step, which is why ties looked like they round toward the centre colour in an earlier fit. (4) Alpha and the premultiplied channels interpolate together (translucent captures: 2,180 of 2,181 exact against 2 of 2,181 for straight-alpha interpolation). (5) Device vertices reach the scan converter rounded UP to 1/16 pixel (ceil(16 v) / 16; rounding to nearest, truncation and floor all lose 10-20 points of exactness on scaled and rotated captures; quarter turns, 0.75 and 0.6 scales and 10, 25, 30 and 90 degree rotations are the evidence). (6) FocusScales do nothing when the surrounds differ per vertex: 40 captures with isotropic (0.5, 0.5) and anisotropic (0.25, 0.75) scales are 98.7% exact (14,577 of 14,766, none beyond a level) from the plain fan, against 0.5% for the previous model, and the differing-pixel ceilings of the 240 alpha controls (80 of them with a focus) fall from 255,177 to 33,604 in total. Measured on 320 captures (path-gradient-vertices.json.gz, src/emf-plus-path-gradient-vertices.fixture.test.ts): 120 random polygons on a 1/16 grid 98.78% exact (44,454 pixels, none beyond one level; 0.83% before), 60 translucent ones 99.31% (0.08% before), the four RGB triangles (black and white centres, scales 4 and 0.5) 99.7% (29% before), eight triangle orientations 94.2% (22% before), the single-channel set 98.9% (52% before), quad 97.3% and pentagon 97.7% (11% and 21% before), scaled and rotated sets 95.8-99.0% (0.2-1.0% before); every pixel of these is within one level. grad-path-triangle-clamp falls from 1,421 to 13 differing pixels at zero tolerance (none beyond a level), the tiled triangles from about 6,000 (38%) to 70-72 (0.45%); all 120 per-vertex captures of the 240 alpha controls tighten.

Rotated, sheared and anisotropically scaled uniform path gradients take their step count from the UNtransformed bounds: N = ceil(|M(w, h)| + |M(w, -h)|) for the brush-space bounds w x h and the linear part M of the brush-to-device matrix (the sum of the two device diagonals of the bounds; it is ceil(2 * hypot(w, h)) for an unrotated scale, and a rotation does not change it). PathGradientRotateProbe.cs captured 70 gradients (a rectangle, a triangle and a wide rectangle, centre off the middle, fractional translation) as world and as brush transforms (the two give identical pixels): rotations of 0 to 200 degrees, a 1.5 x 0.7 scale, a 30-degree rotation of a 2 x 1 scale, shears of 0.25 to 2 in either axis and mixed matrices. Scoring every step count from 60 to 700 against each capture put the best count at the formula's in all 70 (no other count within 12 of it scored as well); the device bounding box of the rotated shape (which grows with the angle, 194 against 145 for a 60 x 40 rectangle at 30 degrees) scored 61% over the first 48 captures, the untransformed bounds 74%, the column norms of M 84% (right for rotation and scale, 3 to 6 steps too many under shear), and the diagonal sum 90%. The rest of the 10% was the rounding of the copies, next paragraph (fractional geometry puts a pixel within a few hundredths of a step of a copy edge often: an unrotated rectangle scored 95%). The step count was the only thing wrong with rotation: the nested copies are scaled about the centre in brush space and transformed, which the sampler already did.

Which copy holds a pixel is decided by the geometry GDI+ actually scan-converts, and that closed the ties and near-ties the ratio model rounded the wrong way (emf-plus-path-gradient-copies.ts, pathGradientStepColor). (1) The boundary's vertices and the centre are rounded to the nearest 1/16 pixel in device space (28.4 fixed point) before anything is scaled; copy m is then the exact scale of those points about the rounded centre by (m + 1/2) / N, with no rounding of its own, and a pixel takes the innermost copy holding it (an isotropic focus f scales a copy by f + (1 - f)(m + 1/2)/N, independent focus scales do it per axis). Scoring four fractional-geometry captures (a rectangle and a triangle, each at two rotations, 7,423 pixels): rounding the points to nearest and scaling exactly 100.00%; rounding nothing 91.1%; rounding the copies as well to 1/16 82%, to 1/256 91%; rounding the original points up 81% or down 77%. Over the 46 world-transform captures of the rotated set (107,809 pixels) the exact-scale model is 100.00%, where the smooth ratio with the right step count scores about 90%. (2) A step's colour rounds a value exactly half way between two levels toward the centre colour: 59% of the pixels of an opaque capture with a small colour range (alpha control 236: red 173 to 155, green 43 to 125, blue 6 to 123 over 164 steps) were on the ramp with half-up rounding and 99.93% with the tie rule; 186 of the 240 alpha controls and 20 of the 120 colour controls tighten, and the sum of the 240 alpha differing-pixel ceilings falls from 255,177 to 1,389, and a wider tie margin (1e-4 to 1e-2 of a level) scores worse, so the 0.01-0.02 margin the step-count round measured was the geometry's near-ties. (3) Independent focus scales are the same copies scaled per axis: ten scale pairs on a rectangle (100% of 100,000 pixels in step-reading captures, 99.93% by colour: the rest are one-level ties of a fully focused axis), on a diamond (98.9%) and on a triangle (99.6%), and 40 random triangles and quads (99.2%); the focus-contour captures' anisotropic exact pixels rise from 1,594,271 to 1,725,250 of 1,728,000 with every per-capture ceiling held or lowered, grad-path-focus-* rectangles with scales 75/25, 25/75, 50/0 and 0/50 are pixel-exact, grad-path-ellipse-clamp falls from 14 differing pixels to none and gpx-pen-pathgrad from 48 to 2.

Hypotheses rejected, with evidence: (1) a function of the ratio alone quantised to a fixed number of steps, or to any 2^k, in any rounding (rows of equal width and different height differ); (2) a fixed-point linear ramp with a rounded slope and offset per row (no linear fit exists for either half); (3) the linear-gradient knot table with 8- or 16-bit interpolation (best 259 misses of 8,677 values against 259 for plain rounding); (4) the vertex-distance quantisation as a scale L / Lq on the ratio (no better than plain rounding); (5) a 16- to 24-bit fixed-point weight or reciprocal for the sub-level residual below (best 405 misses of 138,188 left-half values against 637 for exact arithmetic); (6) float32 barycentric or edge-DDA arithmetic, edge left/right inclusion and a dx-sign rule for the exact half-step ties (each fits some of the 493 tie pixels and none all: the same geometry in the opposite vertex order flips about half of them); (7) whole-triangle Gouraud or fan-apex Gouraud models for per-vertex surrounds as exact barycentric fills (50% of pixels and errors up to four levels): the fan model was right, the missing piece was the scan converter (see above). (8) rounding the copies to 1/16 or a finer grid, or rounding the original points up or down, and float32 evaluation of the copy scale or of the vertex arithmetic in any of ten orders (see above; none changes the integer-sized ties); (9) a wider tie margin for the colour rounding; (10) a step count from the device bounding box of a rotated shape, from the untransformed bounds, from the column norms of the matrix or from its determinant (61%, 74%, 84% and 75% against 90% for the diagonal sum on the rotated captures, before the copies model took the set to 100%).

Pixels on a copy's edge are float32 (emf-plus-path-gradient-copies.ts, floatCopyIndex; found after the binary-fraction rule below, which it supersedes for every uniform path gradient without a focus). The single-edge, slope and corner captures put 76,000 pixels exactly on a copy's edge in front of the arithmetic, and the rule that fits all of them is: with a the first vertex of the fan triangle's boundary edge relative to the centre, e the edge vector and d the pixel relative to the centre (all in 1/16 pixel multiples, exact in float32), u = (ay dx - ax dy) / (ex dy - ey dx), b = a + u e componentwise (the product u e rounded, then the sum), the pixel's larger coordinate of b (by magnitude, the x coordinate when equal) picks the component, r = |d_c / b_c|, and the copy is floor(N r + 1/2), where every operation (the products and difference of the numerator and denominator of u, the division for u, the product u e, the sum, the quotient, the product with N, the sum with 1/2) is a float32 operation rounded toward minus infinity. The captures cannot say whether native rounds the products and differences of u: computing them exactly, or rounding the difference only, gives the same copy for every pixel of every committed capture, including twelve shapes of 300 to 700 pixels at fractional vertices (PathGradientLargeProbe.cs, 984,120 pixels, where the products do need more than 24 bits). A step colour is the float32 ramp of the step (round 6, closed): the 24 of 13,672 steps seen in the large captures (N between 954 and 1,278) that native rounds up when 255 k / N is 0.0005 to 0.009 below a half level are reproduced, and with them every one of the 984,120 pixels of path-gradient-large.json.gz (2,534 differed) and the 76 inexact pixels of the step rows (25,568 of 25,568 exact). Native accumulates the ramp from the centre colour: the step 1 / N and the running sum are float32 rounded toward minus infinity (centreWeight), so ring j from the centre sits a little short of j / N, about 6e-6 levels per ring, and a value exactly half way between two levels falls toward the centre colour (the tie rule of round 5, now a consequence). Found by scanning accumulation forms over the 13,672 (N, k, red) triples: a shift linear in j is feasible for 9 of the 12 shapes and not for the others, which ruled out any closed form; closed-form fixed-point steps floor(255 / N * 2^b) / 2^b from the centre best 11 wrong (b = 17 on a 256 scale), weights k / N to 8 to 24 bits best 18, float32 products 24 to 34, float32 accumulation of 1 / N rounded to nearest or up 29 to 56, from the boundary or from both ends 27 to 58, and rounded down from the centre 0. How it was found: the clean data was a fan triangle with the centre ON a vertex (PathGradientCornerProbe.cs: a single linear colour function, one edge in play, 1,720 captures) and sheared rectangles (PathGradientSlopeProbe.cs, 684), whose slanted ties were 82 to 86% explained by the binary-fraction rule and 76% by ray-and-edge fixed-point models. A search over rounding modes applied to every operation of the ray-and-edge computation (toward zero, to nearest, down, up; 64 combinations of per-stage choices in fixed point had topped out at 85 to 97%) put "all float32, all rounded down" at 99.76% of the corner ties and 97% of the rectangle ones in one step; the last 3% were the diagonal pixels (|dx| = |dy|) of a vertical or horizontal edge, which the rule 'the larger coordinate of the boundary point' (not of the pixel) resolves, and the result is 100% of 27,748 labelled non-natural ties in four independent sets and every pixel of 404,004. Rounding down is why the ratio of a pixel on a left or top edge differs from its mirror on a right or bottom edge (negative values round away from zero) and why the binary-fraction rule held for the exact-coordinate pixels (the quotient of two small integers is exact exactly when it is a binary fraction, else it falls short). Rejected on the way, each with the data: round to nearest in every operation (at most 1,432 of 2,096 corner ties); a fixed-point ray (best 94.6% at a 25-bit parameter, a 16-bit position and a 24-bit ratio, a fit rather than a rule); polygon scan conversion of copies with vertices rounded to 1/4 .. 2^-40 pixel in any direction (at most 63%); the row-interpolation form of the fan triangle with quantised edge values (73% of the slanted ties, 64% of the along-the-edge ties); and the barycentric sum of two truncated weights (it contradicts the exact-coordinate rule).

Pixels exactly on a copy's edge (emf-plus-path-gradient-copies.ts, tieSide) were found on single-edge captures (PathGradientEdgeProbe.cs, path-gradient-edges.json.gz, src/emf-plus-path-gradient-edges.fixture.test.ts): 400 white-to-black rectangles from 2 x 2 to 40 x 40 with the centre on a pixel and on a pixel centre, the same 400 counter-clockwise, 64 captures of eight sizes from each starting corner in both windings and 180 translated by whole and sixteenth pixels, so that for every step count N the pixel sitting exactly on a copy's edge can be read (red and alpha only). (1) The outcome is a function of relative geometry (translation by whole pixels changes nothing, nor does the starting vertex) and of the winding (a counter-clockwise rectangle mirrors a clockwise one). (2) Pixels that read the exact coordinate of their edge (x-major on a vertical edge, y-major on a horizontal one, strictly) depend only on (2q + 1) / (2N), and for 38,872 of them the answer is "outside when that fraction is a binary fraction, inside otherwise": the denominators of the reduced ratio decided it (a table of ratio against N was all "o" for 1/2, 1/4, 1/8, 1/16 and all "I" for 1/6, 1/10, 1/12, 1/14, 1/18, 1/20, 3/10 and so on), which is what a ratio truncated in binary fixed point and rounded half up gives. (3) The other pixels of an edge (the pixel's major axis is the edge's own) go through the position along the edge: on the edges directed right or straight down the part before the centre's foot ((p - c) . e < 0) is inside unless the position u along the copy's edge from its first vertex is a binary fraction (R-edge pixels above the centre, t a binary fraction: 319 inside of 319 when u is not and 0 of 25 when it is), and outside after the foot; on the other edges the first rule gives about 88%. The foot classification is the pixel's own x-major/y-major test, which is why the boundary is the 45 degree line through the centre whatever the aspect. Diamonds (45 degree edges, all dyadic) confirm it without a free parameter (4 of the 7 diamonds have ties; 15,050 of 15,056 pixels exact, the six left are in diamond 20). (4) 62 of 62 labelled tie pixels of the 360 colour and alpha controls on slanted non-45 degree edges that share the edge's major axis agree with (3); the 161 that do not stay on the half-way colour (every candidate for them made some capture worse than its bound: the along-the-edge rule on every pixel of a slanted edge made 8 alpha captures worse, the exact-coordinate rule on the others 13 to 14). Hypotheses rejected for the edge ties, with evidence: (1) float32 or float64 evaluation of the scale ((q + 1/2) / N in seven orders, q * step + step / 2, reciprocal products), the ratio (d / hw, d * (1 / hw)), with strict and non-strict comparisons and the 1 - t form: best 485 of 615 column groups, 79%, against 400 for "always outside"; (2) a fan-triangle Gouraud walk like the per-vertex surrounds (centre 0, vertices N or 1, 16.16 fixed point, every rounding of the ends and the step): 39% of all pixels and 28% of the ties, and a variant with exact sub-pixel interpolation of the ratio 81% of a sample of ties; (3) the ray-hit pipeline in integers or floats (hit_y = dy * hw / dx, t = dy / hit_y, signed or absolute, 4 roundings of each of 3 divisions, 8 to 24 fractional bits, units of 1 and 1/16): best 3,716 of 4,124 along-the-edge ties, 90%, against 89% for the sign rule alone; (4) a tiny shear or rotation of the copy (the right edge would fit a slanted line through the centre row, but the left edge would then be inside for every row below it and only one row is); (5) rounding the copies to 1/16 or taking the first instead of the last matching fan triangle (axis pixels of a diamond: slightly worse); (6) a rule by the quadrant alone (89% of along-the-edge ties) or by the fractional part of the ray's hit point (no pattern).

Independent focus scales were rechecked on a native probe (PathGradientFocusSmallProbe.cs, path-gradient-focus-small.json.gz, src/emf-plus-path-gradient-focus-small.fixture.test.ts: 54 centred and 54 off-centre squares and rectangles from 12 x 12 to 32 x 16, nine scale pairs including 0.5/0.25, 0.25/0.5, 0.5/0, 0/0.5, 1/0.5 and 0.5/1, so one step is five to six levels). The copies are the boundary scaled per axis about the centre point by f + (1 - f)(m + 1/2)/N, not about the middle of the shape or a corner of the focus rectangle (the off-centre captures agree with the centre-point model as well as the centred ones: 16,894 of 16,992 pixels exact before the tie rules, 16,989 after). What the strip solver did not decide are the ties: a pixel on a vertical or horizontal edge of a copy follows the rules of the uniform copies (binary-fraction rule for the pixel that reads the exact coordinate, position along the edge for the others); a pixel on the edge of a fully focused axis is a tie of every copy at once and the innermost copy that holds its other extent takes it (all 20 rectangle captures of path-gradient-focus-shapes.json.gz become exact, 99,930 to 100,000 of 100,000 pixels); a pixel only near an edge (the solver is good to a few thousandths of a step) is inside by the scaled boundary's own span rule when it is within 0.0005 of a whole step (76 of 76 right in the focus-shape captures; from there to 0.005, 8 of 626 are wrong, two of them two levels off in alpha controls 26 and 32, so the band stays at 0.0005). The 252 focus contours: 2,013,232 to 2,013,637 exact pixels of 2,016,000, 33 per-capture ceilings tightened; 35 of the 240 alpha controls and 9 more after the isotropic-focus ties tighten (1,352 to 1,271 differing pixels in total at that step, 846 after the float32 copy rule). Rejected, with evidence: (1) the exact per-copy containment test for every pixel instead of the strip solver (rectangles exact, but triangles 36,988 and random shapes 55,769 exact against 37,409 and 56,220, with 26 and 232 unpainted); (2) the strips between consecutive copies as quads painted outer to inner or inner to outer (triangles 37,028 and 37,284 exact); (3) rounding the scaled copies' vertices to 1/16 (nearest, down or up) before the containment test (21 to 23 alpha controls worse than their bounds); (4) the containment decision for every near-tie up to 0.005 of a step and for pixels on slanted edges (2 alpha controls two levels off; the slanted on-edge ties are 50% right, 55 of 110 on triangles and 127 of 218 on diamonds); (5) "the last copy that holds the pixel, plus one" for the pixels of a non-nested copy sequence (0 of 106 residual pixels); (6) the focus polygon as an extra fill of the centre colour (24 residual pixels lie inside it; the one checked, triangle 0.75/0.25 pixel (29, 2), sits exactly on its slanted right edge, where native keeps it in and the span rule leaves it out).

Tiles cut from fractional bounds (PathGradientTileProbe.cs, path-gradient-tiles.json.gz, src/emf-plus-path-gradient-tiles.fixture.test.ts: white-to-black rectangles of 40 x 30, 40.5 x 30.25, 37.75 x 22.5 and 24 x 24 pixels at origins (20, 15), (20.25, 15), (20.5, 15.5), (20.3, 15.7) and (20.75, 15.25) in the four tile modes, and five tiled ellipses; 1.5 million rectangle pixels) are neither stepped from their fractional bounds nor a smooth ramp. Native renders the gradient, with its steps, into a bitmap of round(right) - round(left) by round(bottom) - round(top) pixels (half up; 41 x 30 for 40.5 x 30.25 at (20, 15) but 40 x 30 at (20.5, 15.5) and 40 x 31 at (20.75, 15.25), found by fitting the tile size for each capture), with the shape scaled into it, and then draws that bitmap as a texture from the real bounds' corner at the scale real bounds over bitmap, with a bilinear filter. Evidence: (1) a whole-pixel tile at a fractional origin is the whole-pixel gradient shifted by the fraction (the centre row of the 24 x 24 tile at origin 20.25 reads 6, 17, 37, 58, ... 250, 239, which is 0.75 of the whole-pixel row 23, 41, 64, ... 255 plus 0.25 of its neighbour); the distinct levels of a tile rise from 31 (40 x 30) and 13 (24 x 24) at the integer origin to 62 to 144 and 23 to 56 at fractional ones; (2) the period is exactly the real width (tiles repeat at 40.5 pixels, the boundary pixel pairs 60, 61 read 7, 7 about 60.5); (3) the tile size by round(right) - round(left) fits every capture within a few dozen pixels, where round(width) fails the origins (20.5, 15.5) and (20.75, 15.25) by thousands of pixels; (4) the weights are not exact: with exact fractions 1,101 of 230,400 pixels of the three trickiest origins differ, with weights rounded to 1/2048 75 of 384,000 pixels of the plain-tile captures (1/4096 truncated 123, 1/8192 truncated 117; float32 coordinates are worse, 1,810 against 1,122 over the 1.5 million); snapping the origin to 1/16 first makes it worse (75,036 against 4,321), so the translation is the real float. The mirrored tiles reflect at the texel edge (index 2n - 1 - m) and fit as well as the plain ones. fractionalTileSampler (emf-plus-exact-fill.ts) reproduces it: the rectangles go from 772,603 exact pixels of 1,536,000 with the smooth ratio to 1,535,770 (max one level), the ellipses from 36,555 exact and 4,064 unpainted of 78,494 to 58,985 exact and 140 unpainted. None of the existing parity fixtures reaches this path (their tile bounds are on whole pixels): the 12 pixels of grad-path-ellipse-tile and the vertex-tip pixels of grad-path-triangle-tile are not a fractional-bounds effect but the pixel on the ellipse's leftmost and rightmost point (and a triangle's apex) in each tile, which native leaves unpainted. Rotated, sheared and non-uniform-surround tiles still use the smooth ratio.

Still open, in order of size: (a) Pixels exactly on a copy's edge are closed for uniform path gradients without a focus: the float32 rule (see "Pixels on a copy's edge are float32" above) reproduces every pixel of the single-edge, slope, corner and tip captures (about 1.5 million pixels, 76,000 of them exactly on a copy's edge). Round 6 closed the isotropic-focus case for the axis-aligned edges and left a measured residual on slanted ones: under an isotropic focus native applies the focus in ABSOLUTE device coordinates (focusCopyIndex, emf-plus-path-gradient-copies.ts). The boundary point O = down(C + b) and the point I where the ray meets the focus polygon (vertices down(C + down(f (V - C))), then the same ray-and-edge chain) are positions on the pixel grid, t = down((P - I) / (O - I)) along the larger coordinate of the boundary point, and the copy is floor(N t + 1/2), every operation float32 rounded toward minus infinity except the two differences (nearest; exact gives the same copy). Found with PathGradientFocusThresholdProbe.cs (path-gradient-focus-thresholds.json.gz): the focus swept over the 17 float32 neighbours of 0.6, 0.3, 0.1, 0.7, 0.2 and 0.4 on eight rectangles shows, per axis pixel, the exact float32 value at which a tie flips, and that threshold depends on the sign of the offset from the centre and on the mantissa of the boundary distance (3, 6, 12 behave alike, 4 and 8, 5, 10 and 20) but not on the other rectangle side, N, or the pixel offset; no chain relative to the centre fits (the best of 4^6 roundings of (d - f B) / (B - f B) and of the (d/B - f)/(1 - f) form miss 210 to 251 of 18,768 pixels, the ceiling forms, copies forms (smallest m with d <= B s_m) and an edge-position form 204 to 233), while the absolute form fits all 130,152 pixels of the set on the axes. Evidence on the rest: path-gradient-focus-edges.json.gz (PathGradientFocusEdgeProbe.cs, 400 rectangles at six foci, 1,058,400 pixels) goes from 6,212 wrong pixels to 781 (per focus 52, 156, 72, 392, 484, 5,056 before; 36, 43, 50, 51, 33, 568 after), every pixel on an axis or whose larger boundary coordinate is the edge's own exact one is right but 7; the corner triangle of PathGradientFocusCornerProbe.cs (path-gradient-focus-corners.json.gz) from about 600 wrong pixels of 72,549 to 129; the alpha controls with a focus from 846 to 784 differing pixels (9 captures tighten). Open: the pixels whose larger boundary coordinate is the inexact one (y-major on a vertical edge, x-major on a horizontal one, and every slanted edge): about 8% of the pixels within float noise of a copy's edge are on the wrong side, in both directions (on the corner triangle every miss at the dyadic foci is one step too far out, on alpha control 151 three pixels are one step too far in: its pixels (46, 20), (44, 22) and (49, 25) have N t + 1/2 1.5e-5 short of an integer, 1.5 ulps of t times N, which would loosen that capture's ceiling from one level to two, so a pixel within the float noise of the chain, N (ulp(I) + ulp(O)) / span, of the edge on a slanted edge keeps the measured tie rules). The rest of the chain is not what decides them: no combination of the roundings of the ray parameter, boundary point, focus point, differences, quotient and product (6,000 to 8,000 combinations, with the focus polygon's ray recomputed or reusing the parameter, the boundary point from the centre or from the vertex) gets the 5,788 near-tie pixels of path-gradient-focus-slants.json.gz (PathGradientFocusSlantProbe.cs: the corner triangle at 16 slopes with the focus at every float32 neighbour of 0.5, 0.6 and 0.3) below 446, and on a rectangle the right edge is explained completely by the down-rounded chain (of the f = 0.5 ties with an inexact boundary point, all 83 below the centre go out and all 83 above go in) while the left edge is mixed (below the centre 67 out and 16 in, above 35 out and 48 in). What would decide it: the same sweep with the three vertices at integers and a pixel on each of the three edges, so that the ray parameter is the only inexact value, then the parameter's own rounding can be read per pixel as the focus thresholds were. (b) The strip solver of independent focus scales gives pixels that native paints differently: 26 of 37,556 triangle pixels and about 80 of the 40 random shapes' 56,654 are more than a level off or unpainted (72 of them unpainted: pixels on the row of a copy's vertex where the span is empty and native still paints one; 33 of the 106 residual pixels take the innermost copy that holds them, which the strip solver misses, and 24 lie inside the focus polygon, the one checked on its slanted edge), and the pixels outside the boundary that its folded strips cover are not native's. Replacing the solver by a per-copy test needs the vertex-row rule and the slanted-edge tie rule for scaled copies: the data that would decide them is the single-edge sweep of path-gradient-edges repeated with a focus and a shear. Round 5 re-tried (b) with the float32 finding and rejected two more models, each with its data: the ray also meeting the focus polygon scaled per axis, t = (d - F) / (b - F) with F found on the scaled polygon's edge (it is the isotropic model above and is wrong for independent scales, because the copies are the boundary scaled per axis, not points on the ray: the 252 focus contours fall from 1,725,649 to 1,515,150 exact pixels, the 54 + 54 small rectangles from 16,956 and 16,989 to 15,344 and 15,062, the diamond and triangle focus-shape sets from 31,689 and 37,413 to 15,223 and 22,253), and a per-copy polygon test with the copy vertices c + (f + (1 - f)(m + 1/2)/N)(v - c) evaluated in float32 (rounded down, to nearest or exact) and the scan converter's span rule, taking the smallest copy that holds the pixel (step-exact pixels: diamond 31,850 of 32,000, triangles 36,842 of 37,556, random shapes 54,655 of 56,654, against 31,689 + 311 within a level, 37,413 and 56,254 colour-exact for the strip solver). Round 10 measured where the remaining independent-scale pixels are: every differing pixel of the twelve grad-path-focus-ellipse-* / -triangle-* fixtures (one level, in symmetric pairs for the ellipses) is a pixel whose strip-solver copy index lies 0.0005 to 0.005 of a step from a whole number, i.e. exactly the pixels that got the half-way colour (CONTAINMENT_TIE). Letting the exact containment of the per-axis scaled copy decide every pixel up to 0.005 (STRIP_TIE) takes the twelve fixtures to 4 differing pixels in total (2 on grad-path-focus-ellipse-100-25, 2 on -triangle-75-25), the 240 alpha controls from 613 to 230 and the 252 focus contours from 2,351 to 254 differing pixels, and breaks five ceilings by one two-level pixel (alpha controls 26 and 32, contours 47, 75 and 82), and was first withheld as a trade, then shipped once the project owner accepted it (round 10, the five ceilings raised to the two-level pixel: alpha 26 goes from 5 to 2 differing pixels and 32 from 10 to 3, max 1 to 2, and no capture that was exact becomes inexact). Of the 643 distinct pixels of the controls and contours that fall in that band, 632 are right by containment and 11 are one step off, all of them between 6.4e-5 and 4.9e-4 pixels (measured along the row) from the scaled copy's span end, while the pixels nearer than 6e-5 and those farther than 5e-4 are all right; keeping the half-way colour only for pixels in that noise band (NOISE_NEAR, NOISE_FAR) breaks no ceiling and shipped first (it has since been replaced by containment everywhere, the accepted trade above): the twelve fixtures go to 22, 3, 12, 3, 13, 4 (ellipses 0-50, 100-25, 25-100, 25-75, 50-0, 75-25) and 5, 1, 1, 8, 2, 3 (triangles 0-50, 100-25, 25-100, 25-75, 50-0, 75-25), the alpha controls to 339 and the focus contours to 1,259 differing pixels, 40 alpha ceilings tightening. The band edges are fitted to those 11 pixels, so they are a hedge, not a mechanism. Ruled out as the cause of the 11, each measured on the same 643 pixels (11 wrong at the exact scale): float32 rounding of the scaled vertices, the scale or the span crossing (no change), the copy scale accumulated step by step in float32 from the inside or the outside, starting at the first copy or half a step in, with the step and the sum rounded to nearest, down or up (39 to 67 wrong against 11; the best settings leave the alpha controls at 258 and the contours at 290 to 326 against 230 and 254), and a 16.16 / 20 / 24-bit fixed-point edge walk of the copy's span (slope and start floored, rounded or ceiled: the best, 24 bits with a floored slope, equals the exact result and every coarser grid is worse). The sweep was run (PathGradientFocusScaleSweepProbe.cs, path-gradient-focus-scale-sweep.json.gz, src/emf-plus-path-gradient-focus-scale-sweep.fixture.test.ts): two integer-vertex triangles with FocusScales (f, 0.25) and (0.25, f), f swept in 2e-6 steps over 301 values around 0.6, so each pixel's copy flips at the f where the scaled copy's edge crosses it. Of 217 flips more than 10 pixels from the centre, the exact model flips at the same sweep step (and no other) for 169; none of 54 float32 variants (the scale f + (1 - f)(m + 1/2)/N, the scaled vertices and the crossing each in float32 rounded to nearest, down or up, in three orderings) beats 172, and over all 236 flips (including those near the centre) the exact model gets 171 while rounding the scaled vertices to a 2^-b grid (b = 8 to 20, three roundings) never gets more than 173. The misses are native noise of up to a few 1e-5 pixels perpendicular to the edge (more, up to 4e-4 in the contours) that does not follow from float32 arithmetic of the scaled edge, and the pixels within 10 pixels of the centre flip many times in the sweep (several copies pass them), so the native algorithm is not the per-copy edge test at all. Expressing the noise band in perpendicular rather than horizontal distance (4.6e-5 to 4e-4) fits worse (alpha controls 534 differing pixels with 38 ceilings broken, against 339 and none). So the band stays a fitted hedge; what would decide the native algorithm is the same sweep on a pixel next to the centre, where the copy index changes by many steps per f step and the function of f can be read directly. What would decide the arithmetic of (b) beyond that is the arithmetic of the per-axis copy test in float32 (the order of the per-axis scale, the product with the vertex and the edge walk), which a corner-triangle sweep with independent focus scales would expose the way the corner sweep exposed the uniform rule.

(c) The tip pixels of tiles are closed for whole-pixel tiles (a native sweep of a triangle apex and a whole ellipse at every 1/16 offset, PathGradientTipProbe.cs, path-gradient-tips.json.gz, src/emf-plus-path-gradient-tips.fixture.test.ts: 528 captures, none with a pixel we paint and native does not or the reverse; what differs, 110 of 185,646 clamped triangle pixels, 216 of 27,666 tiled triangle pixels and 31 of 316,689 clamped ellipse pixels, is one step on slanted-edge ties, item (a), mostly on the rows two above a triangle's base and at apex offsets of 0 and 1/16 pixel; the pixel on a tiled ellipse's leftmost and rightmost point and on a triangle's apex, which native leaves unpainted: a whole-pixel sample the copies or the fan leave outside the boundary is no longer given the smooth ratio, emf-plus-exact-fill.ts; the four tiled ellipses go from 12, 12, 16 and 16 differing pixels to none and the four tiled triangles from 72 to 54, all within one level). Open: tiles with a rotation, a shear or per-vertex surround colours, which keep the smooth ratio (40 to 57% exact, 88 to 95% within two levels). Round 6 captured the rotated and sheared ones (PathGradientTileRotateProbe.cs, path-gradient-tile-rotations.json.gz, src/emf-plus-path-gradient-tile-rotations.fixture.test.ts: the 40 x 30, 40.5 x 30.25 and 24 x 24 rectangles in Tile and TileFlipX through brush rotations of 10, 30, 45, 90 and -20 degrees, a brush shear, a scaled rotation and world rotations of 30 and 90 degrees): the tile lattice is the rotated one (at 30 degrees the white peaks are 24 pixels apart along (cos 30, sin 30)), the values between creases are smooth rather than stepped and the peaks are blurred (245 to 247 for 255), so native resamples a tile bitmap; sampling the brush-space bitmap through the rotation is 28 to 58% exact and 92% within two levels. At exactly 90 degrees the bitmap is not rotated: it is stretched, as a W x H brush-space bitmap with the bilinear weights of an unrotated fractional tile, onto the device bounds of the rotated tile (30 x 40 for a 40 x 30 tile), and the mirror of the brush's x axis flips the device rows; the 40 x 30 tile is then 98.9% exact (Tile) and 99.1% (TileFlipX), where rotating the bitmap scores 50% and 35%, the 24 x 24 tile (stretch and rotation agree) 100%, and the fractional 40.5 x 30.25 tile 52.5% exact and 99.5% within two levels (the size of the bitmap and the origin of the stretched cell are not settled: device-rounded sizes, swapped sizes and rounded origins all score lower). Not shipped: only exact quarter turns are explained, and the general angle (supersampled bitmaps of 2, 3, 4 and 8 times, half-pixel offsets, nearest-neighbour and 8-, 11- and 16-bit weights all tried) is not. What would decide it: the same sweep at 5-degree steps for the 24 x 24 tile, whose stretch and rotation agree, to find the angle at which the stretch gives way to the rotated lattice. The data that would decide the tip pixels is the same single-vertex sweep (an ellipse and a triangle with the tip at every 1/16 offset in a tile and in clamp mode). (d) Gradients inside text and pens are closed as a question about the gradient: PathGradientFillProbe.cs (path-gradient-fills.json.gz, src/emf-plus-path-gradient-fills.fixture.test.ts) paints one brush through 1-, 6- and 20-pixel pens, ellipse outlines, single-bit text and fills, and all 56,503 painted pixels equal the full-canvas fill at the same place, so the step count is that of the brush path, not of the pen's widened outline, the glyphs or the layout rectangle. gpx-text-pathgrad is 5.92% without the fixture fonts and 0.692% with them (0.978% before the tip fix): glyph shapes, not the gradient. gpx-pen-pathgrad is pixel-exact.

Linear Blend tables are closed: buildLinearRampTable reproduces all 4,352 native three-point ramps (opaque and translucent) exactly; GDI+ forms each knot in float32 arithmetic that truncates toward zero.

EMF+ page units and the header DPI ​

Issue #30: a 72 DPI EMF+ file drawn in points rendered 96/72 too large and was cropped. Probe: 37 synthetic EMF+ files, varying one thing at a time: header DPI, EmfPlusFlags, page unit and scale, container rectangles and EMF reference-device size. GDI+ played each one (System.Drawing Graphics.DrawImage of the Metafile), and the colour bounding boxes of the fills were compared. 35 match exactly after the change, against 9 before. The other two differ only through the harness: the native bitmap was a fixed 120 x 80 where the converter's canvas is the 109 x 57 header bounds, and one file was drawn into GDI+'s frame-derived 161 x 108 bounds (one pixel of rounding).

  • DPI source. Page units convert at the EmfPlusHeader LogicalDpiX/Y (UInt32 per MS-EMFPLUS 2.3.3.3; the converter read them as Float32 and discarded them). Point at 72, 96 and 144 DPI, Inch at 120, Document at 72, Millimeter at 150 and Point at 72 x 144 all fill the header bounds exactly. With a 72 DPI header on a 96 DPI reference device (szlDevice / szlMillimeters), the header wins. .NET's MetafileHeader.DpiX reports the device value, not the header's.
  • Display and printer devices. EmfPlusFlags bit 0 set (video): Display is one pixel. Clear (printer): Display is DPI / 100. Playback starts in Display, and so does a container (the converter used Pixel, which only differs on a printer). A container's destination rectangle is in the enclosing page units.
  • Rejected page transforms. SetPageTransform with World (0), unit 7 or scale 0 leaves the previous unit and scale in force (Point then World x 2 still draws in points). Negative and NaN scales are treated the same way; this was not measured separately.
  • Container source units. Pixel, Point, Inch at the header DPI; Display as the page unit; World is DPI / 100 on video and printer alike.
  • Comment batches. The page unit and scale already carried across EMR_COMMENT records (since v3.5.0), and the header DPI now does too. The issue's report of a per-comment reset was against 2.0.2.
  • Pen units. 59 probes: DrawLines with a pen in each PenUnit at 72 and 144 DPI, under page units Pixel and Point, world scales 1 and 2, an anisotropic and a 30-degree rotated world, plus slot reuse. World, Display and unit 7 pens are world units. A Pixel pen is a fixed device width with a round device nib (a 6 px Pixel pen stays 6 px under diag(1, 3) and the rotation). Point, Inch, Document and Millimeter pens draw nothing, and such a pen created in slot 0 after a valid one leaves later draws through slot 0 blank. The converter drew those pens as World pens and scaled Pixel pens. All 59 are now pixel-exact.
  • Font units. 43 probes: DrawString "HHH" in Arial with each SizeUnit, same grid. World, Pixel, Display and unit 7 em sizes are page units (world x page). Point, Inch, Document and Millimeter convert at the header LogicalDpiY and are scaled by the world transform only: 20 pt is 20 px at 72 DPI and 40 px at 144 DPI, under a Pixel or a Point page unit alike. The converter used the em size as page units for every unit and sent physical units to the canvas fallback. With Windows' Arial passed as fonts, every unit's output now equals a World font of the same device size, pixel for pixel. Both still differ from native by the DrawString placement residual in Outstanding work.

GDI+ DrawString placement from a point ​

Probe: DrawString "HHH" and "HxH" with a 0 x 0 and a 180 x 120 layout rectangle, played by GDI+ one device pixel per pixel. Arial at em 8 to 80 under five hints, then Arial, Times New Roman, Tahoma, Segoe UI and Courier New SingleBitPerPixelGridFit at every em 8 to 80 (365 captures). Each capture was compared by the integer shift that best matches the converter's output.

  • Harness. Graphics.DrawImage maps the metafile's Bounds onto the destination, and GDI+ makes those bounds one pixel larger than the picture (201 x 161 for 200 x 160). Drawing into a W x H rectangle therefore shrinks the picture by W / (W + 1). This showed up as a line pitch of 2353.65 design units for Arial's 2355 at H = 1800 (1800 / 1801), and it moved hinted baselines and half-pixel starts at 200 x 160. Drawing into the metafile's own bounds plays it one to one. A first round of this probe used the shrinking destination; its rules (a half-down start, 28 unexplained baselines) were artifacts and were withdrawn.
  • Not the empty rectangle. A 180 x 120 rectangle has the same offsets. Single-bit misses were whole-line one-pixel shifts with no glyph residue.
  • Baseline. The converter's realized ascent equals native GetTextMetrics tmAscent for all 365 face and size pairs. The native baseline is the layout position plus max(round(em winAscent / upem), tmAscent), the rule the converter already used for integer-size ClearType: 365 of 365, against 144 for the old ceil(em winAscent / upem).
  • Start position. The start (layout x plus em / 6) rounds half up, as before.
  • Multi-line paragraphs (30 lines of H separated by newlines; em 13, 28, 37 and 48 one to one, em 8 to 48 through the shrinking destination): line n's baseline is round(y + (winAscent + n (hhea ascender - descender + lineGap)) em / upem). The first line uses the design ascent, not tmAscent, and the pitch is the hhea line spacing exactly (Arial and Times New Roman). The converter does not lay out multiple lines yet.
  • Pinned. text-drawstring-singlebit-baseline.json.gz (Arial "HHH", 43 sizes; generate-drawstring-singlebit-baseline.ts): 43 exact, 25 before.
  • Not changed. ClearTypeGridFit has no placement offset; its differences are the ClearType glyphs. At em 72 and up, a 180 x 120 rectangle wraps "HHH" natively, and the converter does not wrap. AntiAlias and AntiAliasGridFit at em 76 and 80 are 1 to 2 px low. Native SystemDefault equals ClearTypeGridFit on this machine, direct and in playback, while the committed textx-plus-systemdefault reference (a direct drawing from the same run as the ClearType textx-arial-q0-default) is single-bit.

GDI+ single-bit glyphs and SystemDefault ​

  • Glyphs. Native GDI+ SingleBitPerPixelGridFit glyphs nearly equal GDI's NONANTIALIASED_QUALITY glyphs: x in Arial and Tahoma at 12 to 40 px is identical in 11 of 12 cases, and so are all the glyphs of the textx-plus strings except Arial 16 w (1 px). Probe: xwvyAkMWKVXZ4&% in Arial, Tahoma, Times New Roman and Segoe UI at 9 to 36 px (1,680 glyphs, GenericTypographic). Exact: 1,442 with the previous GDI+ monochrome arithmetic, 1,658 with GDI's. Of GDI's interpreter rules only three matter here: split projections (1,488 alone), x/y movement rounding (1,538 alone) and both (1,657); ISECT adds one. 15 glyphs are exact only the previous way, so GDI+'s arithmetic is neither. The scan converter matters less ("HxH" sizes exact for Arial, Tahoma and Times New Roman): GDI's converter on the old outlines gives 42, 39 and 56 (51 for Times New Roman with the old converter), and the old converter on GDI's outlines 70, 73 and 67 against 71, 73 and 72. Upright regular faces asked for at single-bit now hint with GDI's arithmetic and GDI's converter; italic faces (Times New Roman Italic 22: 8 px worse) and AntiAliasGridFit glyphs that gasp makes monochrome (the grayscale corpora lose exact glyphs) keep the previous path. "HxH" from a point: Arial 42 to 71, Tahoma 39 to 73 and Times New Roman 51 to 72 of 73 sizes exact. The report goes from 899 to 897 exact: textx-plus-singlebitgridfit and -systemdefault are 1 px (Arial 16 w), accepted by the project owner.
  • SystemDefault. With ClearType on, native SystemDefault draws exactly as ClearTypeGridFit, both directly and in metafile playback (the fixture strings: 953 fringe pixels, identical images). The committed textx-plus-systemdefault reference is single-bit, from a session whose GDI DEFAULT_QUALITY captures are ClearType. SystemDefault now follows fontSmoothing (cleartype, gray and mono to ClearTypeGridFit, AntiAliasGridFit and SingleBitPerPixelGridFit; gray is not measured), and that reference is compared with fontSmoothing: 'mono'.

GDI+ DrawString paragraphs ​

Probe: single-bit Arial in a layout rectangle at (10, 10), played one to one: a 34-character sentence at widths 60 to 180, newlines at em 12 to 32, CRLF, a 14-letter word at widths 40 to 100, runs of spaces, heights 20 to 70 (em 16) and 100 to 150 (em 24), and kerning pairs in single lines and wrapped ones.

  • Breaking. At CR, LF and CRLF, and greedily after spaces; the spaces at a wrap are dropped; a word longer than a line breaks between characters. A line fits when its tracked design advances (default tracking 1.03) plus its unrounded kerning are at most the width less both margins. The painted hinted advances fit one letter too many ("HHH" at width 40); without kerning "HELD MY WAX" does not fit at width 120.
  • Lines. Line n's baseline is round(y + (winAscent + n (hhea ascender - descender + lineGap)) em / upem): the first line uses the design ascent, not the realized cell ascent a single line reserves. 30-line paragraphs give a pitch of exactly the hhea line spacing.
  • Kerning. Wrapped lines are kerned from the kern table, each pair rounded to whole pixels ("HWAWAH HWAWAH" at 16 px: the last H 3 px left; "HAVAVH HAVAVH" at 24 px: 6 px). A single line is not, in a 0 x 0 or a 180 x 140 rectangle alike (36 single-line captures of WA, AV, Ty, LT, Yo and To).
  • Visible lines. A line is laid out when a quarter of it is inside the rectangle: (n + 1/4) line spacing <= height gives every line count of both height sweeps (em 16: second line at 23, third at 42, fourth at 60; em 24: fifth at 118, sixth at 146). With Character trimming (the default; StringFormat Trimming is now parsed) the last visible line takes the rest of the text, broken between characters.
  • Clipping. A paragraph is clipped to the rectangle: the last line's descent is cut at the bottom edge even when all its lines fit. A single line that fits is not clipped (the tight-rectangle alignment controls keep their overhanging ink).
  • Result. text-drawstring-wrap.json.gz (generate-drawstring-wrap.ts): 28 of 32 exact; the four character-trimmed captures are pinned (24 to 386 px). Inside a trimmed line native widens the spaces (a pixel at 16 px, two at 24 px) and does not kern; no position model tried (hinted, design advances with or without tracking and kerning) fits both sizes.

Windows parity on 18 November 2026 ​

  • DrawString alignment. The 27 new single-bit grid-fit captures cover explicit line breaks, word wraps, a long word, kerning, a fractional layout rectangle, and four fonts. Center and far alignment position each line using its hinted advances, with the design width for one glyph. Float32 placement accounts for the opposite half-pixel decisions in the Arial and Tahoma probes. The 18 aligned captures fell from 15,313 to 970 differing pixels. Fifteen match within one pixel, including eleven exact matches. The one-pixel Tahoma and Times New Roman differences also appear under near alignment and varied between native capture runs. The glyph black-box adjustment varies the start of one centered Arial line. Courier New still differs in glyph advances.
  • DrawString trimming. When character trimming extends the last line past a word break, use the measured layout position to place the next word after a single space. Keep hinted advances and kerning within each word. The original paragraph captures went from 28 to 31 exact out of 32. The remaining Arial 24 px capture fell from 386 to 172 differing pixels.
  • Fractional path-gradient tiles. The horizontal texture span supplies the texel phase. The rounded phase was off in nine columns, causing 113 differing pixels in the colour controls. The 120 colour and 240 alpha captures now match exactly. The independent 85-tile sweep fell from 438 to 22 differing red or alpha pixels. The remaining differences are one level. Applying the TextureBrush phase vertically changes an exact path-gradient row, and a different vertical phase candidate regressed a fresh ellipse holdout.
  • HighQualityBilinear rectangle crops. At unit height, the inferred float32 destination controls both the last readable source row and the fixed-point start of the vertical span. The 32,768-case hq-crop-height sweep matches every recorded alpha and coverage result. The phase change introduces zero regressions in the 235,620 crop and mirror impulse replays. The public EMF replay test checks three bottom-edge alpha values against Windows.

Run the paragraph alignment capture with bun scripts/gdi-fixtures/generate-drawstring-wrap.ts --aligned. In the local 910-picture report, the 897 exact RGB comparisons and all other per-picture results were identical before and after this pass. The more targeted captures exercise the changes above.

The next pass closed the colour blend in textx-color-cleartype. In a partly covered GDI ClearType pixel, an exact half tie rounds down when the brighter colour contributes five-sixths of the channel mix. A fresh Windows ExtTextOutW sweep across all 256 by 256 channel pairs and seven coverage levels went from 10,036 differing values to zero. The picture went from 141 differing pixels to zero. The full report rose to 898 of 910 exact, with the other 909 picture comparisons unchanged.

EMF+ pens on closed figures (round 5) ​

emfplus-pens captures GDI+ playback of 24 closed figures per sheet (rectangle, ellipse, triangle, concave star, closed curve, rounded path; widths 3, 6, 9, 14) aliased and antialiased: centered miter control (exact), compound arrays ({0, .3, .6, 1} and a five-band one; exact now, 1,423 and 6,790 pixels before) and Inset pens with miter, bevel and round joins. Two rules were wrong and are fixed (src/emf-plus-pen-figures.fixture.test.ts): (1) the inner side of a compound band on a closed figure meets where its offset lines cross, where the end points of both segments overlapped on an open polyline left spikes at the corners; (2) an Inset pen strokes the ring between the figure and the figure offset inward by the whole width (insetCollapses leaves no hole when the pen fills the figure), not the band swept along each edge, which put a spike outside every acute corner of a polygon: aliased 1,582 to 52 (miter), 1,581 to 119 (bevel), 1,976 to 458 (round). GDI+ refuses the Inset and compound combination (Not implemented on recording), so there is no such capture. Round 7: the inset pen is exact aliased and within 6 pixels antialiased. GraphicsPath.Widen of an Inset pen returns a polygon on whole-pixel coordinates (whole numbers even when the path is scaled up sixteen times), so GDI+ does not offset the figure at all: it draws the pen at twice its width, centered, and clips it to the figure with its hard clip. Native check: SetClip(path) + DrawPath at 2w gives the same pixels as the Inset DrawPath (0 differing pixels on a triangle, ellipse, rectangle and closed curve), and the converter's rule (2w stroke AND the figure's aliased pixels) is exact on all six aliased sheets (458, 119 and 52 pixels before) and on the 120 random polygons, flattened ellipses, rounded rectangles and closed curves of inset-outline.json.gz (inset-outline-probe; src/emf-plus-inset-outline.fixture.test.ts). The antialiased DrawPath equals an antialiased fill of that Widen polygon pixel for pixel on polygons (72 of 72 with a miter or bevel join; the round-join ones are drawn by a different outline, see below), so the work is the polygon: it is the staircase around the surviving pixel squares (pixel centres on whole numbers) with some corners cut. Read off 65,000 corners of Widen outlines of random triangles and polygons, the cut is a local rule on the corners of the loop (cutCorners in src/emf-plus-inset-outline.ts: a corner at the top of its vertical edge stays; at the bottom of a one-row edge it is cut; at the bottom of a longer one it stays, with a horizontal edge of two or more where the loop turns away; valleys and isolated pixel runs have their own small rules). That took the three antialiased sheets from 8,573, 8,649 and 8,944 differing pixels to 6 each, and 107 of the 120 random shapes are exact (186 pixels differ in the rest). The 6 pixels per sheet were at the bottom tip of the triangle's hole, where the hole's last pixel touches the rest of the hole only at a corner. Round 8 closed them: flipping the pairing at every such corner cost more elsewhere because the pairing depends on what the corner joins. 3,000 random Inset polygons (inset-contacts.json.gz, inset-contacts-probe) show that GDI+ splits a hole whose own loop touches itself at a corner into separate holes (791 of 791 contacts where the two pairings differ), and keeps the set pixels apart at every other corner (the hole of a different loop, or an outer loop); splitAtRepeats in emf-plus-inset-outline.ts. All six gpx-pen-inset-*-aa sheets are exact, 114 of the 120 random polygons are exact (130 pixels, from 186), and the 3,000 polygons went from 10,305 to 6,421 differing pixels. The round join's extra 92 pixels per width on the rounded path was not the inset at all: a round join through a turn of under about 8 degrees (cosine above 0.99) is a smooth vertex in GDI+, only the incoming offset point on both sides, so the straight edge beside it lies 1/16 pixel inside once the 28.4 conversion rounds the tiny excess up (ROUND_SMOOTH_DOT in src/emf-plus-widen.ts; 360 of 360 native polylines in round-join-small-turn.json.gz exact, from round-join-probe; the shift starts at about 2.5 degrees for a width-6 pen and 1.5 for width 14, which is where the excess reaches half a 1/256 step). It also made gpx-rec-beziers-aa and gpx-rec-beziers exact (43 and 3 pixels before). Round 8 (pen leftovers). (1) gpx-rec-curve-aa (5 pixels) was the round end cap of a width 4 to 5.5 pen: the cap's Beziers were flattened with an older approximation of the HFD instead of flattenBezierGdiplus (GDI+'s bit-exact Bezier32), one vertex off for radii of 2.03 to 2.73; cap-widen-probe (CapWidenProbe.cs, cap-widen-round.json.gz) draws 400 random lines and 100 Beziers with Round, Flat, Square and Triangle caps: Round lines of width above 1.5 are exact now (172 of 172, aliased and antialiased; on the first capture 5 of 26 antialiased lines of width 4.5 and 11 of 26 of width 5 were exact), and a round join is cut into equal Beziers of at most a quarter turn (a 106 degree join is two of 53 degrees, not 90 and 16, which Widen of a custom line cap showed). A Square cap has only its two corner vertices (an extra vertex on the line was rounded to 28.4 off the edge: 0 of 8 antialiased lines exact at width 5, 8 of 8 now). (2) gpx-rec-customcap and -aa (2 and 47 pixels) are exact: the body of a custom-capped line gets a clipped miter beyond the miter limit instead of the plain pen's bevel, clipped where each offset edge is the limit (a Euclidean distance) from the vertex with nothing else of the join (cap-widen-custom.json.gz: 300 pens with arrow, fill-path and line-path caps on lines, polylines and Beziers, 299 of 300 exact aliased and 297 antialiased; the exception is a 1-pixel pen whose shortened end is 1/16 pixel off), and the last 36 pixels of the antialiased sheet were a blend: the pen's box reaches pixels outside the metafile frame, where the canvas is transparent, and gdiplusBlendPixels then declined the whole box; it now keeps GDI+'s exact blend for every opaque pixel. (3) Inset: see "Round 8" above; a dashed Center pen with a Round or Triangle dash cap on a closed figure keeps the straight part of each dash at its END (an open line keeps it at the start): the whole pattern sits one pen width later, 0 of 40 exact before and 8 of 40 now (the custom pattern with a 0.5-width dash is the rest). Still open: gpx-pen-lingrad (13 pixels, one level, a gradient rounding), seven of 98 Bezier curves with Round caps (1 to 33 pixels, not caps), and the junction corners of overlapping Inset rings.

Round 9 (workstream W6, pen leftovers). Research first, in three tiers. Documented by Microsoft: the GraphicsPath.Widen page (https://learn.microsoft.com/en-us/dotnet/api/system.drawing.drawing2d.graphicspath.widen) says only that the method outlines the path at the pen's width and that its flatness argument is the curve flatness; PenAlignment (https://learn.microsoft.com/en-us/dotnet/api/system.drawing.drawing2d.penalignment) says Inset is "positioned on the inside of the theoretical line". Neither says how dashes, caps or restrictions combine. Inferred from an independent re-implementation (read for behaviour only, nothing copied; Wine dlls/gdiplus/graphicspath.c, https://github.com/wine-mirror/wine/blob/master/dlls/gdiplus/graphicspath.c, LGPL): the path is flattened first, dashes are cut on the flattened polyline BEFORE widening and every dash is widened as its own open figure, the pen's start cap goes to the first dash of an open subpath and its end cap to the last, a one-point dash is skipped, and alignments other than Center are not implemented. Measured here (DashWidenProbe.cs, dash-widen.json.gz, 672 native GraphicsPath.Widen outlines with their pixels; src/emf-plus-dash-widen.fixture.test.ts): the "before widening" and "own open figure" parts are confirmed (one closed polygon per dash); the dash is cut on the flattened curve (the converter already walks the flattened path); with a Round or Triangle DashCap the dash is straight for its length minus the pen width and the caps reach half a width past both ends; a dash shorter than that is a dot with a straight part of 0.001 pen widths (all 142 dots of 193 round-capped dashes on open lines) that still takes the cap's whole length of the pattern; the caps are Beziers (point types 3 in the Widen path) flattened like any fill Bezier, so filling the native Widen path with flattenBezierGdiplus reproduces 479 of 480 aliased and 475 of 480 antialiased native renderings (the rasteriser is not the gap); an open line's last dash whose cap would reach the line's end ends at its straight part under the line's end cap, and the first dash starting within half a width of the line's start takes the start cap; an Inset pen with a Triangle DashCap draws the band cut flat. Results against the round 8 head: Inset round dashes 4,543 to 36 aliased pixels (60 cases), Center round dashes 3,353 to 6 (40 cases), round dashes on open lines 154 to 2, on polylines 314 to 2, closed figures 109 to 8; Triangle caps 277, 177, 73 to 2, 5, 6; Inset Triangle 11,286 to 80; gpx-pen-inset-dashround-aliased 113 to 76 and -aa 445 to 231 (report.ts, nothing else moved). Negative and open results: (1) the thin-strip hypothesis for crossing Inset rings is rejected: 240 native thin triangles (inset-slivers-probe) are exact aliased and antialiased, and axis-aligned crossing rectangles are exact; across 3,000 random paths (1,500 single, 1,500 of two or three overlapping figures; 1.59 million corners, analysis only) the corner rule is wrong at 978 of 308,740 corners of single figures and 26,468 of 1,028,198 on crossing paths, mostly unit staircases where the other of the two diagonals is the native one, and a tie-break by figure order for boundaries shared by two figures' masks made things worse (3,347 to 3,436 or more pixels, 5 variants); (2) walking the dashes of an Inset round-dash figure along the offset path instead of the figure's edges (the dash then runs past a concave vertex, which is what the width 14 star shows) is far worse (36,471 pixels over 48 cases, rectangles included), and scaling the shortened length by 0.5 to 1.25 only gets worse than the current pen width (141 pixels at 1); (3) the first dash of every open line taking the start cap (not only one within half a width) is worse (144 against 2 pixels); (4) rounding the cut points to float32 does not help; (5) the one large mismatch of the 98 round-capped Beziers (cap-widen-round.json.gz case 480, 17 aliased and 43 antialiased pixels; Widen re-captured for the Beziers to see it) is a near reversal of the flattened curve where native extends a clipped miter 13.7 pixels (the miter limit times the half width), which the converter bevels; one sample, not modelled.

Round 10 (workstream R10-D, Inset pens with dashes). Questions: how dashing interacts with the doubled width, the dash caps and the clip, and how the antialiased outline combines with it. Measured with DashCurveProbe.cs (dash-curve.json.gz, inset-dash-polygons.json.gz; src/emf-plus-dash-curve.fixture.test.ts) and scratch probes. Dash lengths and offset: native DrawPath of the flat-dashed Inset sheet figures (24: rectangle, ellipse, triangle, ten-point star, closed curve, rounded path; widths 3, 6, 9, 14; Dash and DashDot; offsets 0 and 0.5; miter and round joins) equals SetClip(figure) plus a Center pen of twice the width with the same dash lengths in pixels (the pattern in pen widths halved) and the same offset in doubled widths: 0 of 24 differ aliased. That is the converter's rule (lengths in the pen's own width, offset in the doubled one). With round dash caps the same construction differs by 157 to 1,384 aliased and 531 to 1,746 antialiased pixels per figure: the native round cap is a semicircle centred in the band (a width 10 rectangle dashed 3, 1 shows rows symmetric about the middle one), radius half the pen width, which is the existing band model. The oracle: GraphicsPath.Widen(pen, new Matrix(), 0.25) is what DrawPath draws, so its polygons are the right reference for stroke geometry (dashed ellipse, closed curve and rounded path at widths 6, 14 and 28, aliased: 0 differing pixels against a fill of the flatness 0.25 outline, 2 to 2,784 for 0.001, 0.01, 0.05, 0.1, 0.2, 0.3, 0.5, 1 and 2). The one-argument Widen(pen) of the earlier dash, cap and inset probes returns the coordinates of a path with a curve ceiled to sixths of a pixel (a line at y = 51.0625 comes back at 51.1667, its end at x = 125.3125 at 125.3333; 10,386 of 15,253 y coordinates) and puts dash cuts on curves up to 0.3 pixel off (about 5,550 of 6,433 cuts within 0.3 pixel of the converter, against 6,462 of 6,466 within 0.15 with the matrix). Those captures are exact on lines and polygons; the Bezier cases of cap-widen-round.json.gz were not repeated with the matrix. Reading the one-argument outline as the truth led to a phantom: the native dasher seemed to count a curve 0.15 pixel short (113 clean readings, mean -0.15, range -0.57 to +0.93), and none of unrounded chords, the true arc length, a coarser step count, a floor or round of the chords to 1/16, a global shift of the dash phase or ceiling the vertices to sixths explained it (ceiling the vertices of a curved figure before dashing took the flat sheet from 28 to 212 pixels). What was missing (found by feeding the native Widen polygons of four sheet cells through the converter's fill and clip, which gives 0 differing pixels in all four, then diffing the polygons): (1) a flat dash end whose corner would lie behind the offset point before it ends at that point (the last segment 1.1 to 1.6 pixels after a vertex, smooth join, inner side: the end edge is 27.89 to 27.93 pixels long, not 28); (2) the rounded-rectangle path of the sheets holds a degenerate Bezier (AddArc leaves one at the end of the second corner arc: points 8 to 10 of the path are the same point), and a dash crossing it is two polygons, whose union differs under the nonzero fill from one polygon with the zig-zag of its inner joins. Results (report.ts over 910 fixtures, none worse): gpx-pen-inset-dash-aliased 28 to 0 (exact), -dash-aa 136 to 55, -dashround-aliased 76 to 75, -dashround-aa 231 to 226; per case, 15 of the 2,224 renderings of the 1,112 dash-widen and inset-cases dash cases became exact and none got worse. The multi sheets are paths of overlapping closed polygons, not compound-array pens (GDI+ refuses Inset with a compound array), and were not changed (multi-aliased 2, -aa 133). Negative results and what is left: (a) the antialiased corner rule differs from the native Widen polygons at 21 of 3,033 vertices of the flat sheet figures (a one-pixel notch whose left corner native keeps where the rule keeps the right one, or a step end shifted 1 to 5 pixels along its row), 23 of 11,967 of the 120 random Inset polygons, 0 of 10,756 of the 240 thin slivers and 91 of 11,050 of the round and triangle dash figures; a lookup on the five edges around a corner does not separate them (the same context is kept in some and cut in others). (b) The dot of a Center round-dash pen (a dash shorter than the pen width: a straight part of exactly 0.001 pen widths along the line) has polygon corners 0.001 to 0.004 pixel off: the two sides of the straight part are displaced along the line against each other (native points at s = 5.49905, 5.50096 and 5.50297 for a dot at 5.5 of a width 2 pen, the converter's at 5.5000 and 5.5020); 840 of 4,722 vertices of the closed round-dash cases differ by more than 0.001, none by 0.01. It is a rotation of the whole dot by an angle that is the same for every dot of a line (39 lines, 184 dots: -0.0039 to +0.0024 radian, up to 0.004 at width 2 and up to 0.0003 at width 12, the size of a single precision rounding of the direction of a segment 0.001 pen widths long); the unit direction rounded to 2^-8 up to 2^-22, and the tiny segment's endpoints rounded to single precision, did not reproduce the angles. This is enough to flip a 28.4 rounding at the scattered single pixels of the round-dash sheets. The round cap's Bezier control points are the plain 4/3 tan(sweep/4) ones (0.55228 to 0.55229 of the radius in every case). (c) The two width-14 star clusters of gpx-pen-inset-dashround (22 and 28 pixels at concave vertices) are not the band's join: forcing a miter join on both sides of the band takes that cell from 51 to 66 pixels, meeting the inner offset lines from 51 to 428; the second cluster fits a disc of radius 7 to 8 centred 4.6 pixels outside the figure's edge near the reflex vertex (2 mismatching pixels in the window against 21), the first is not a disc (8 against 22). A native probe that would decide it: the star with a single dash, moved along the closing segment in 1/16 steps, to see which dash piece draws the extra shape. (d) Splitting the dashes of every path at the junction of two segments (curve to line, curve to curve) is wrong: it takes the flat sheet from 5 to 24 pixels where only the degenerate Bezier splits.

Round 11 (workstream R11-E, Inset pens, read from the binary). Functions read in gdiplus.dll: GpPath::GetWidenedPath, GetWidenedPathInternal, CreateDashedPath, getDashData, GpPen::AdjustDashArrayForCaps and GetDashCapInsetLength, GpPathWidener::Initialize, Widen, SetCaps, SetRoundCap, SetDoubleRoundCap, SetTriangleCap, CalculateNormals, CalculateGradients (the vertex arithmetic of getMiterBevelJoin was not ported), DpRegion::Set, DpRegion::GetOutlinePoints, RegionToPath::ConvertRegionToPath, DiagonalizePath, FetchNextPoint, WritePoint, ConvertRegionOutputToWinding, Contains, ComputeBoundingBox. Mechanisms and how each was confirmed:

  1. Order: dash, then widen, then clip, then outline. GetWidenedPath (pen alignment 1 only) copies the pen twice; the copy for closed subpaths has its width doubled and its alignment set to Center; for every subpath it calls GetWidenedPathInternal (flatten at 0.25, CreateDashedPath, widen), and for a closed one DpRegion::And of the widened subpath with the region of the whole path (both forced to the Winding rule while the regions are built), then GpPath(DpRegion) and ConvertRegionOutputToWinding, and AddPath into the result (Winding). Confirmed by the flat-dash sheets (rounds 7 and 10), the overlapping-figure captures (inset-cases.json.gz: the ring of one figure is kept where the whole path's even-odd interior holds the pixel, 77 of 80 exact) and the mixed captures below.
  2. Dash layout. CreateDashedPath multiplies the pattern by half the doubled width (0.5 for an Inset closed subpath), calls AdjustDashArrayForCaps with that width (even entries minus one width, odd plus one, the minimum 0.001 of a width), and passes getDashData the offset width x DashOffset - 2 x GetDashCapInsetLength for a closed subpath (0.5 of the width per Round or Triangle cap, so one width) and nothing for an open one; getDashData starts a closed figure at its last vertex along the closing segment and cuts a dash inside a segment when the dash remainder is not more than the segment remainder (equality cuts at the vertex). Confirmed: the dash sweeps of inset-dash.json.gz are exact, which fixes the positions to within a pixel sweep of 0.025 pen widths.
  3. Round dash caps. GpPathWidener::SetCaps calls SetDoubleRoundCap when the Inset flag GetWidenedPathInternal passes is set: fourteen points, two semicircles (each two Beziers with the constant 0.552284777 as a float) of radius a quarter of the doubled width, centred a quarter of it either side of the centre line, from one edge of the band to the other through the centre line. Confirmed by the star sweep (61 dash offsets, every dash that ends within a pen width of a reflex vertex has the tail the band model lacked) and the L sweep (25 offsets around a dash that starts or ends exactly at the vertex), all exact aliased and antialiased; the sheet clusters of 22 and 28 pixels are gone. A Triangle cap shows nothing: 15 of 15 star offsets exact without a tip, but the code of SetTriangleCap does build a tip, so this is measured, not read.
  4. Region to outline. DpRegion::GetOutlinePoints walks the span boundaries of the region band by band (a band is a run of identical rows; a loop is started at the first boundary that has not been visited, walked down its left side, along the bottom and up the other side; the link to the next band picks the boundary of the same parity that the current one meets, and stops where the neighbouring band does not continue it), so whether set pixels that touch at a corner are joined is decided by where the walk meets them. RegionToPath::DiagonalizePath then slides a window of three corners over each loop (counterclockwise from its top left corner) and drops the middle one when the edge into it is one pixel long (a one-pixel step right before a vertical edge up, or a one-pixel step down) or the edge out of it is a one-pixel step against the turn, writing the following corner instead. Both are ported (traceRegionLoops, diagonalizeLoop in emf-plus-inset-outline.ts) and replace the hand-fitted rules of rounds 7 and 8: the antialiased inset-outline.json.gz 120 of 120 exact (114), inset-contacts.json.gz 300 of 300 (249), gpx-pen-inset-dash-aa 55 to 0. As a check on the pipeline alone, the native mask of the whole gpx-pen-inset-dashround sheet through the converter's outline and fill is the native picture with 0 differing pixels, aliased and antialiased.
  5. Loop reversal and the fill. The outlines of all the figures are one path filled nonzero, aliased too (the aliased stroke was a union of masks before). ConvertRegionOutputToWinding flips a loop when another loop's bounding box contains its own (edges included); the refinement that fits all the captures is that a loop is a hole when an odd number of the containing boxes belong to loops that are not holes themselves (the plain parity fits 299 of 300 contact cases). A loop that is inside a box without being inside the loop is reversed anyway, and where regions of two figures overlap the reversed one cancels the other's winding: gpx-pen-inset-multi-aliased 2 to 0 and -aa 133 (4 before this step, 20 with the plain parity) to 0; the overlapping-figure paths of inset-cases.json.gz 49 to 77 of 80 exact aliased (721 to 34 pixels), 45 to 77 antialiased (1,253 to 73). The 3 left are width 2 pens.
  6. Open subpaths. GetWidenedPath gives an open subpath the second copy of the pen (its own width, Center), adds its outline without the intersection, and the outline winds the other way round from the regions' (reversed in widenedPen), so the stroke of an open polyline across a closed figure cancels the figure's ring where they overlap. Confirmed by 12 captures (a closed rectangle with an open line or polyline, solid and dashed, Miter and Round): all exact. The clip counts the open figure as closed.

Results against the round 10 head (report.ts, 910 fixtures, none worse, 831 to 834 exact): gpx-pen-inset-dash-aa 55 to 0, -dashround-aliased 75 to 5, -dashround-aa 226 to 32, -multi-aliased 2 to 0, -multi-aa 133 to 0. dash-widen.json.gz, Inset Round caps on the 48 sheet-figure renderings: 20 exact and 141 aliased and 495 antialiased pixels differing, to 48 exact and 0 and 0; Triangle caps 16 and 80 and 521 to 46 and 2 and 6; inset-cases.json.gz round dashes 38 exact and 36 and 202 pixels to 47 and 18 and 106, flat dashes antialiased 26 pixels to 6. New captures: inset-dash.json.gz (inset-dash-probe, InsetDashProbe.cs, src/emf-plus-inset-dash.fixture.test.ts). Left, with the experiment that would decide it: the 5 aliased and 32 antialiased pixels of gpx-pen-inset-dashround (4 of 5 on an ellipse or a closed curve, one on the star) are single-pixel flips of the stroke mask whose nearest polygon edge is at least a pixel away from the sample, so they are not rounding of one vertex; the widener runs in single precision, and a bit-exact port of getMiterBevelJoin, getRoundJoin and WidenLinePoints (neither was ported) is the experiment, checked against the 672 Widen outlines of dash-widen.json.gz, whose vertices the converter now reproduces to 1e-5 to 1e-4 pixel only. Static reading and measurement disagree on the Triangle dash cap (item 3); and the loop-reversal refinement of item 5 is fitted, not read: the code toggles by plain parity, which fits 299 of 300 contact cases, so the one case that needs the refinement (a one-pixel hole inside the box of a void it does not belong to) means the native loop list differs from the converter's there, found by no pairing difference in the 10 loops of that case.

Round 12 (workstream R12-inset-pen, the single precision widener). The 5 aliased and 32 antialiased pixels of gpx-pen-inset-dashround (round 11 left them as single-pixel flips of the stroke mask) were located first: the first of the five aliased pixels was traced and is a 1/16 pixel flip of a sample next to the end of a round-capped dash (the sample at (206, 99) lies 0.06 pixel inside the cap's Bezier end at (206.4696, 99.18945); the y coordinate is 99.5002 of a 1/256 step, and the 28.4 conversion rounds a value over the tie up to 99.25 where a value under it gives 99.1875). So it is the float32 rounding of the cut and the cap, not the join; both fixtures are exact after the port. Read from gdiplus.dll: getDashData, CalculateGradientArray, GpPen::AdjustDashArrayForCaps, GetDashCapInsetLength, GpPathWidener::SetRoundCap, SetDoubleRoundCap (arithmetic in parity-notes.md, EMF+ section). Ported as emf-plus-widen-f32.ts and checked bit for bit against GraphicsPath.Widen of 239 Round-capped dashes of the dash-widen lines before it was used for the Inset pen (the dasher's cut points, the unit direction, the side start point and the 7 control points of both caps: all equal). Results (report.ts, 910 fixtures, none worse, 885 to 887 exact): gpx-pen-inset-dashround-aliased 5 to 0, -aa 32 to 0; inset-cases.json.gz round dashes 47 exact cases and 18 and 106 pixels to 59 and 1 and 8 (one case is left; the flat dashes of the same file have the same counts, [59, 1] and [59, 6], and were not changed). Not ported, and not needed for these fixtures: getMiterBevelJoin / getRoundJoin / WidenLinePoints (the interior vertices of a dash on a flattened curve stay in double precision) and the Center-pen path (the Round and Triangle dash caps of dash-widen, which would use SetRoundCap and the same dasher on open lines: the open-line cut points and caps are already bit exact in the new module, but the Center pens are not switched over).

GDI color adjustment and HALFTONE ​

  • Colour adjustment is reproduced from native colour cubes: curve stages (gamma, reference black/white, contrast, brightness, log, negative) are exact, illuminants 1-5, 7 and 8 use native cubes, and colorfulness/tint match the native cubes except for a one-level rounding difference on a small share of the channels (0.05-0.4%, below; the chroma stage reads the unrounded palette level and rounds before the curves). Windows' 66x65 ordered dither over 32 levels per channel is reproduced, including mirrored destinations, brush origins, StretchDIBits, axis-aligned PlgBlt and the mixed-axis phase rule; rotated blits follow the session's first-HALFTONE-blit rule. The turned u' is floored at 0, which makes strongly rotated blues (tint beyond about 50) match. The matrix is the one derived from the BT.709 primaries and D65 white (7 decimals), which removed most exact-half ties (0.05-0.4% of channels still differ by one level; round 6 measured the ties of 11 settings natively and applies them as a table, which makes those settings exact, see HALFTONE leftovers), and an illuminant combined with colorfulness/tint now carries the illuminant's unclamped linear output (ILLUMINANT_MATRICES) into the chroma stage. Remaining: a few strongly blue colours under illuminant + chroma (the illuminant's blue corner is not linear), and, before round 6, a few mixed-axis pixels under colour adjustment (emfrec-halftone-ramp-0p5x-2y-ca 0.108%, -2x-0p5y-ca 0.068% by the parity test's metric: both pixel-exact since the chroma ties of round 6). When columns are reduced and rows enlarged under a dithered adjustment, Windows sharpens the last row against a further row that is the last source row replicated and dithered at the next pattern row. Reducing both axes (also StretchDIBits) is now exact: rows rounded to integers first, columns unrounded, sharpen on the unrounded image.
  • Mixed-axis stretching: all 96 native size/pattern combinations are byte-exact (single-row destinations and the exact-tie checker patterns are closed: the reduction uses 13-bit cumulative shares per footprint, and a 2-row source squeezed to 1 row is despeckled and, with at least 2x enlargement, reduced to its last row; the enlargement weights are whole 13-bit shares built by cumulative rounding up, and a mirrored enlarged axis reverses the finished rows). The enlargement kernel of halftoneEnlargeTaps is now a closed form (8 October 2026, round 5, capture halftone-kernel-rows.json.gz, generator scripts/gdi-fixtures/generate-halftone-kernel-rows.ts, test halftone-kernel-rows.fixture.test.ts): x ** (1 / sqrt 2) before half a pixel, x at exactly half a pixel and x ** sqrt 2 from there to one pixel, with x = 1 - u the tap distance from the support's edge. How it was found: a mixed stretch that reduces 4 columns to 2 (so the reduce, sharpen, enlarge engine runs whatever the source) and enlarges the rows with constant-per-row random images gives each destination row as an exact weighted sum of the sharpened source levels, so 1,200 images (3,600 equations per row) and an integer search give the five nearest source shares of every interior row (78 pairs, ratios 1.02x to 16x, 8,159 rows). Every cumulative share is an interval of the unrounded cumulative weight (c - 1 < 8192 X <= c), which is linear in the kernel values given the area-resample plus destination-space FIR structure, so a linear program (scipy HiGHS) over piecewise-linear knots at 1/192 source pixel finds the kernel with the widest margin; its second-difference-minimising member was smooth: a quadratic-looking inner half and a tail that a power law fits to 0.05 levels with exponent 1.4142 (and 0.7058 for the inner half, 1 / sqrt 2 = 0.7071). The structure is therefore exact: the LP over the first 39 pairs and the whole factors (4,035 rows) was feasible but for one row (29 to 46, row 19, whose measured shares are inconsistent with every kernel by 0.4 share), and the closed form, never shown those rows again, reproduced the 4,646 rows of 39 held-out pairs 99.89% (the table: 88.8%). Over all 8,159 rows it reproduces 8,152, and 106 of 110 tie rows; the table reproduced 90% of the first set and 79% of the whole factors. Hypotheses rejected on the way: nearest-source assignment instead of area resampling (LP margin -4.1 million against -8,935), quantising the tap distance to 13 bits (1,367 misses against 19 for the double-precision formula) or 16 bits (181, rounded 103), quantising the pixel edges to 16 bits (583, rounded 231; 35 at 20 bits), float32 at any one of seven arithmetic sites (never fewer than 19 misses, 61 with all of them), and a support beyond one pixel (no better margin at 1.2 or 1.5). What remains (round 6 settled the rest, see HALFTONE leftovers below): six interior rows whose cumulative share lies within 0.002 of a whole share, where a native float rounding of about 5e-4 shares decides the side; the other of the seven (29 to 46, row 19) and the 110 tie rows are not defects, and the centre phase of the factor 15 is the same row.
  • Enlargement branch selection (src/emf-gdi-halftone-branch.ts, probe HalftoneBoundaryProbe.cs, 29,763 labelled sweep sources in halftone-boundary.json.gz, regenerated by scripts/gdi-fixtures/generate-halftone-boundary.ts): found by mutating a captured pair one pixel at a time (a single swap of two pixels flips the 256 x 16 band source 54 from replicated to filtered, so the choice is not a function of the histogram or of coarse structure) and then fitting each flip. Established, each exact on the sweeps: the choice depends on the source rectangle only (a sub-rectangle is judged alone; StretchDIBits counts the rectangle from the bottom row) and not on the destination size (the 2x and 3x controls), the colour adjustment or the API; up to 2,304 pixels it is replicated whatever the content; above 16,384 pixels only every sixth row counts and 20 distinct colours filter (827 sources, every one right, including colours confined to non-sampled rows, grids and random fields); in between, colours are counted in scan order against 145 + floor(o / 16) (o = rows * w - 2304 for the least row count with rows * w > 2304), 20 colours with more than 2,304 pixels in colour-introducing rows also filter (a 10-row grid of two-colour rows filters, 9 rows do not), and the scan gives up once colours plus one row for every duplicate row plus the next row reach n - 2305 + limit (cumulative, not per gap: two repeat stretches of 847 are allowed in a 4,000-pixel column, 848 + 848 is not); colour identity is the exact 24-bit value except that red == blue colours share the top six bits of blue and green (3,000 random pairs, all agree). Rejected: distinct-colour counts of any quantisation, transitions or run counts, row-set or histogram invariants, repeats defined as equal to the pixel above or to its three upper neighbours (a row shifted by one pixel counts as a repeat row: the repeat test is a colour seen in earlier rows), a gap budget, and a fixed prefix window. Closed on 8 October 2026: heights exactly equal to the least row count with more than 2,304 pixels (2,408 older sweep sources) follow the doubled limit 289 + floor(o / 8) and a give-up budget of their own. Structured sweeps (a first row with a fresh colours, d black rows, then one all-fresh row, at widths 200, 220, 250 and 300; 1,858 sources) showed that any duplicate row before the burst ends the scan (d = 0 always filters, d >= 1 never does) even though the colour count is far below the limit, and that at w = 300 a first row holding 300 colours already gives up where 299 do not; that fits colours + duplicateRows * w >= limit - 1 (no extra row, unlike taller images), and the 20-colour rule is subject to the same budget (2 or 5 fresh colours in every row of a 100 x 24 or 60 x 39 image filter at the last row, 20 per row do not). The model has no failure on the 2,408 older sources and none on 4,500 random sources (five distributions of fresh colours per row, duplicate rows, bursts, 31 widths) drawn after it was fixed. Widths over 2,304 pixels, extreme aspect ratios, reducing stretches and non-integer enlargements, which this list first left to held-out natural images, were swept in round 5 and have no known exception (see the engine-selection item below).
  • Filtered enlargement (halftoneFilterEnlarge, capture halftone-filtered.json.gz, generator scripts/gdi-fixtures/generate-halftone-filtered.ts, tests halftone-filtered.fixture.test.ts): the 2x branch (sharpen, then a 3:1 interpolation vertical-first with the intermediate rounded half up; the source extended by one replicated row above and below before sharpening, which fixed the two outer destination rows, 23 native column profiles in halftone-boundary.json.gz; horizontally the edge column is replicated after sharpening, padding it first was tried and differs) is now one of several measured engines. Impulse responses were not needed: a random level per row (or column) of an otherwise constant image makes one axis' response a plain weighted sum of sharpened levels, and a least-squares fit followed by an integer search over 13,104 samples per phase gave the unique integer weights. (1) Both axes enlarged by up to 5x, whole or fractional: three taps over the source before, at and after the destination pixel's source pixel, chosen by the length of the run of destination pixels that source pixel gets (the runs are halftoneNearest's assignment, 1.5x alternates runs of 1 and 2, 2.5x of 3 and 2) and the pixel's place in the run; a lone pixel (5,22,5)/32, 2x (4,12,0)/16, (0,12,4)/16, 3x (6,10,0), (1,14,1), (0,10,6) over 16, 4x (6,10,0), (3,12,1), (1,12,3), (0,10,6) over 16, 5x (13,19,0), (6,25,1), (3,26,3), (1,25,6), (0,19,13) over 32, one rounding half up per pass, vertical first with the replicated-and-sharpened extension rows (all 38 non-dithered captured cases of halftone-filtered are exact, the three values at 1.025x on one axis that the old kernel table missed included: whole factors, mixed whole factors (2x3, 3x2, 2x5, 5x3), fractional, mirrored and one-axis; the 48 filtered 3x selection controls are exact). Read as a destination-space FIR over the replicated source these are [1,2,3,4,3,2,1]/16 at 4x (an exact tent) but [1,5,4,5,1]/16 at 3x and [1,2,3,7,6,7,3,2,1]/32 at 5x, whose centre tap is smaller than its neighbour, which no tent or box-tent kernel gives. (2) Either axis above 5x, also fractional (5.016x is the closest tested): horizontal first, the four-neighbour sharpen clamped at the edges with no extension row, the 13-bit shares of halftoneEnlargeTaps (the kernel formula above; exact for every whole factor from 6x to 16x except the centre phase of 15x, which keeps its measured shares, and for the captured 5.5x, 6.5x and mixed 2.5x by 6.5x; 5.016x is 6 of 193,563 values one level off, 340/64 = 5.31x 84 of 216,240, 449/64 = 7.0x 22 of 378,507), an exact 2x axis keeping the linear weights (the formula is a level off there). (3) One axis enlarged, the other unchanged: only that axis sharpened with the one-dimensional /4 kernel, interpolated with (2)'s weights and one final rounding; exact at 1.025x, 1.5x, 2x, 2.5x, 3x, 5x, 7x and 10x (three values at 1.025x were a level off with the old kernel table). (4) Mirrored blits are the exact mirror image of the unmirrored result on both axes (the probe's mirrored destination starts at the far edge, dw - 1; starting at dw shifts the image by a pixel). (5) Combined colour adjustments: the source and its extension rows are quantised with the ordered dither and mapped first (V1 of six orders tried; dithering the finished output, dithering without mapping, or adjusting before dithering all differ in 28,000 of 30,720 values), the pattern two rows further down than the replicated branch for engine (1) (a 66 x 65 phase sweep over noise sources found it) and two rows less far when mirrored vertically; the source is padded with its first and last rows replicated TWICE on each side and dithered at the pattern rows above and below (-2, -1 and h, h+1); the inner replicas are the extension rows the interpolation reads, the outer ones only feed the extension rows' sharpen (round 6, W7: the earlier "mirrored edge", which sharpened an extension row against the first source row dithered at its own pattern row, left a one-level residual in the outermost destination rows only; recovered by solving the native outer row of the 2x capture for the sharpened extension row, which fixed every one of 8 infeasible values at once when the row above was the edge row dithered at pattern row -2 and the row below at h+1, and no other row). Engine (2) sharpens its last row against one further dithered row. The ten dithered cases are exact (0 values, pinned in halftone-filtered.fixture.test.ts) after the round-6 extension-row fix and the chroma tie table; before the tie table they kept 0.1% to 0.4% of channel values one level off (50 to 573 values of 7,680 to 141,120 per case), and with a native colorfulness cube standing in for the chroma formula every one of them was already exact, so that remainder was the chroma stage's tie-breaking (see the colour-adjustment item above and the chroma-tie item below), not the filter. Hypotheses rejected: the kernel table for 3x to 5x (3x phase 0 weighs the neighbour 0.329, native 0.375), horizontal first at 4x (29,987 of 122,880 values off), vertical first at 6x (72,077 of 276,480 off), the extension row at 6x (1,809 top and 1,849 bottom values off), a cumulative round-up of a tent for 3x, per-axis /4 sharpening for fractional both-axis ratios (at least 44,000 of 48,000 values off at 2.5x), and the table with either pass order for fractional ratios up to 5x. The fractional ratios up to 5x were the last open piece and were closed by changing the question: 1-D fits at 3/2, 4/3, 5/3, 5/4, 7/4, 7/3, 7/2, 9/4, 9/5, 11/3 gave a handful of weight sets (the whole factors' rows, the lone-pixel row (5,22,5)/32 and, apparently, positions quantised to a grid that no fixed offset and step reproduced: 3/2 seemed to need a quarter-pixel grid, 5/2 an eighth-pixel grid shifted by 0.1 pixel); reading which destination pixels used which set showed that the choice is not a position at all but the run structure: with a ratio of 1.3 the destination pixels per source pixel go 1, 2, 1, 1, 2, 1, 1, 1, 2, 1 and a source pixel with two destination pixels uses the 2x pair, one with three the 3x triple, a lone one the smoothing row. The ten captured fractional cases (1.025x to 4.98x, 2x by 1.025x, and 2.5x mirrored on either axis) are exact, as were about thirty further ratios checked in the session (generator figure); the closest approach to the 5x switch is 4.98x (319 x 200 is exact, 5.016x is already the other engine). Closed in round 5: mixed enlarge-and-reduce stretches of filtered sources (see the engine-selection item below) and the table's one-share misses for fractions above 5x (288 of 193,563 values at 5.016x became 6 with the kernel formula). Closed in round 5 as well: a dithered adjustment on a stretch that keeps one axis (see the engine-selection item below). The sample counts, the counts of the rejected hypotheses, the 5.016x figure and the table-miss phase counts above are generator figures from the 8 October 2026 sessions (scratch scripts, not committed); the captured cases and one-axis profiles are pinned by halftone-filtered.fixture.test.ts.
  • Mixed enlarge-and-reduce engine selection and the despeckle size bands (halftoneMixedEngine, capture halftone-mixed-engine.json.gz of 1,101 native stretches, generator scripts/gdi-fixtures/generate-halftone-mixed-engine.ts, test halftone-mixed-engine.fixture.test.ts, 8 October 2026). Found by labelling each native stretch of a source grid (3, 27, 100 and about 400 colours, noise, smooth) with the engine whose prediction it matched, then by boundary sweeps: filtered sources (more than 2,304 pixels; noise, smooth, 400 colours) run the reduce, sharpen, enlarge sequence for every mixed destination (84 of 84 noise stretches of 80 x 80 exact, enlargements 1.25x to 6.5x against reductions 0.9x to 0.25x, where before only the reductions by 2x or more were); every source runs it when the shrinking axis loses 1.5 pixels per pixel (3 * dst + 2 <= 2 * src, the +2 found by 100 to 66 qualifying while 50 to 33 (both 1.515) does not, and 64 to 42 against 64 to 43) or when the destination has fewer pixels than the source (22 stretches at -2, 8 at -1 pixels qualify, 0 and +1 do not); a source of up to 2,304 pixels is despeckled first when only the area rule qualified it (zero residual in the 40 x 40 sweeps, where a 3-colour 50 x 30 stretch of a 40 x 40 source is 1,802 of 4,500 values off without it). Hypotheses rejected: a threshold on the reduction factor alone (the 1.5 cap holds only for enlargements of 1.5x and more, below that the area rule is the boundary: 64 to 51 qualifies with an enlargement of 1.25, 64 to 52 does not), a threshold on destination area, the intermediate image size, and the colour count (the 3 to 100 colour sources change engine at the same destinations). The same session found that the replicated branch's despeckle is absent for sources of 2,305 to 16,384 pixels (checker-dense sources of 47 x 49 = 2,303, 48 x 48 = 2,304, 49 x 48, 55 x 42, 64 x 64, 100 x 100, 127 x 129 = 16,383 and 128 x 128 = 16,384 pixels: only the first two despeckled; 128 x 129 = 16,512, 8 x 2,049, 100 x 164 and 300 x 60 despeckled again), which removed a 0.2% mismatch of every mid-size replicated enlargement of a few-colour source (72 x 72 to 144 x 144, 188 of 62,208 values off before). Results: engine grid 280 of 280, 1.5x boundary 40 of 40, size bands 23 of 23, both-axes reductions 120 of 120 (98 before), area boundary 156 of 160 (28 before the engine selection, 99 with the old kernel table), held-out random stretches 154 of 160 (69 before, 113 with the old kernel table); no capture that was exact became inexact. Reductions of both axes of few-colour sources (a 3-colour 37 x 11 to 36 x 8 was 382 of 864 values and up to 63 levels off) were another consequence of the missing despeckle: a uniform reduction despeckles first when the source takes the replicated branch (up to 2,304 pixels always, by the scan above 16,384, never in between) and neither axis loses 1.5 pixels per pixel (the reduction by 2x of the checker fixtures does not; rule A, the alternative 'not both axes capped' broke 10 of 12 small one-axis-capped cases and a 'despeckle every replicated-band reduction' variant broke the 0.5x checker fixtures and the 27-colour sources above 16,384 pixels, which take the filtered verdict and are not despeckled). The remaining ten stretches differ by one level in 37 channel values: boundaries within a few thousandths of a share, the float-level noise of the kernel item. One-axis reductions, found while testing the selection at reducing scales: a reduction of one axis with the other kept (100 x 100 to 100 x 60, 99% of random values wrong) had no engine at all and fell through to a nearest-pixel path. A first guess fixed it: reduce with the 13-bit shares, unrounded, and sharpen along the reduced axis only with the one-dimensional kernel (variants rejected on the same 4 random-data captures: no sharpen 17,744 of 18,000 values off, the 4-neighbour kernel 16,154, sharpening the kept axis instead 16,582); it was then exact on 900 random stretches (6 kinds, 3 size bands, 4 mirrorings) once the both-axes despeckle rule above was applied to it (without it every checker-dense and few-colour source with an axis losing less than 1.5 pixels per pixel was wrong). Under a dithered colorfulness adjustment: a reduction that dithers the source first misses 2,677 of 3,456 values (best pattern phase of the 66 x 65), one that reduces first and dithers at destination coordinates 10 (at the default phase), and an enlargement the other way round (source dithered at source coordinates, then the filter: 16 of 13,824); the last row of a vertical enlargement needed the further dithered row (231 values off became 63), and a mirrored vertical enlargement counts its source pattern rows from the far end (5,487 became 66). Dither stage of mixed stretches: a native sweep of 64 x 64 and 63 x 45 noise over enlargements 1.25x to 4x against reductions 0.3x to 0.95x (both orientations, 84 and 56 stretches) labelled each by whether the source or the finished output is dithered; the boundary is the equal-area line (dw * dh >= SW * SH dithers the source, equal areas included: 64 x 64 to 128 x 32; 80 x 51 is destination, 80 x 58 source), where the old rule, an even reduced axis and a whole enlargement factor, was wrong for 26 of the 84 64 x 64 stretches (and for every one that dithers the source at 63 x 45). With it 96 captured stretches under colorfulness +40 (48 with gamma 1.5), every mirroring, reductions, enlargements and mixed alike, are 0.25% of values off (a mixed stretch was 32% to 45% off, up to 200 levels). Remaining at the time: the usual 0.15% to 0.3% colour-adjustment residual (one to four levels, the chroma stage rounding), which clustered at the first and last source row (round 6 closed it for the 11 settings measured natively, see the chroma-tie item in HALFTONE leftovers; other settings keep it). Wide sources and extreme aspect ratios: the 1 x 3,000 to 4,000 and 2,400 x 1 sources of the selection groups were 3% to 31% of values off before the one-axis reduction existed (68 of 576 stretches at 0.5x to 0.9x, 1x by 2x and 2x by 1x); with it, all 576 stretches of sources drawn from the twelve selection groups are exact, as are 30 stretches of sources 2,400 to 4,000 pixels wide or high and 2 to 16 pixels the other way, in all three content kinds, and 1,100 stretches at 0.5x to 6.5x of sources more than one pixel on both sides but one (17 of 219,384 values). The selection at reducing, fractional and wide scales has no known exception.
  • Enlargement pre-smoothing (despeckle): measured from native captures and now exact on every black/white 4x4 pattern (also at the image edges), every pattern up to 5x3, and several hundred random black/white, grey, palette and noise images from 2x2 to 40x40 at 2x, 3x and 4x/1x2 ratios (src/halftone-despeckle.fixture.test.ts). Verified on 8 October 2026 (halftone-despeckle-sweep.json.gz, generator scripts/gdi-fixtures/generate-halftone-despeckle-sweep.ts, test src/halftone-despeckle-sweep.fixture.test.ts): 6,400 isolated two-by-two checker blocks (3,371 whose two diagonals are exactly equal under 4R + 8G + B and unequal under any other weighting) show that the brightness weights are 4, 8, 1 (every integer weighting up to 40, 80, 20 other than a multiple of (4, 8, 1) contradicts a capture, so 0.299/0.587/0.114-style luma is ruled out) and that a tie always pulls the top-left/bottom-right pair (all 3,371 ties); 500 checker-dense images from 3x3 to 48 pixels (ties, two colours with flipped cells, three colours, sparse flips, up to hundreds of overlapping checker runs) are reproduced by halftoneDespeckle byte for byte with no change to the algorithm. Nothing in the despeckle remains unverified for the replicated 2x path; only sizes above 48 pixels a side are not swept (the branch selection is a separate item).

HALFTONE leftovers (round 6, W7, 8 October 2026) ​

  • The colour-adjustment residual was the chroma stage's tie-breaking, now measured. Native colorfulness / tint cubes (HalftoneColorProbe.ChromaCubes, mode chroma-cubes, 11 settings of 32^3 colours, 98,304 channel values each, committed as the sparse flips in halftone-chroma-ties.json.gz with the cubes' sha256) differ from the u'v' formula in 16 to 356 channel values each (colorfulness +40: 201, 0.204%; +100: 356; -100: 16; tint 30: 63), all one level. The formula lands on exact halves for the hue-preserving gamut normalisation of a colorfulness-only adjustment (255 (c - lo) / (hi - lo) of the palette colour, a ratio of palette indices: 1,658 exact halves in four cubes, 52% of them rounded up natively) and within 5e-4 of a half for tints; Windows breaks those ties by float noise of its own. Rejected: the sign of the double error (48% agreement, a coin flip), the index ratio in float32 or double in four operation orders (always agree with half-up or at chance), every combination of float32 at the sites of the chroma stage with the 7-decimal and float32 constants (1,320 of 1,331 misses for the best of eight variants against 1,331), hill climbing on the 18 matrix entries and the white point against the rounding intervals (1,331 to 1,212, the violation does not close), and the dependence on the ratio alone (34 of 41 ratios are mixed within the same cube). So the cubes are tables: emf-gdi-chroma-tie-data.ts holds the 1,374 flips of the 11 settings (9.7 KB, the settings the committed captures use, +40 and (40, 20), (50, 20), and eight more) and colorAdjustmentMapper applies them to palette colours without an illuminant; other settings keep the formula. Effect: the ten dithered halftone-filtered cases are exact (50 to 573 values off before, now 0), oneaxis-mode3/4 of halftone-mixed-engine 22 and 23 of 24 exact (2 and 2 before), dithered-mode3/4 48 and 48 of 48 (1 and 4 before; the last three, vertically mirrored enlargements with a reduced width, needed the further dithered row below the source at pattern row H - 1 - SH, the unmirrored case's rule), and emfrec-halftone-ramp-2x-0p5y-ca and -0p5x-2y-ca pixel-exact (0.068% and 0.108% before). What remains is every other colorfulness / tint (one level in about 0.2% of the channel values) and the 3 one-axis stretches of the mixed groups (kernel boundary rows), the data that would decide it being the native arithmetic of the chroma stage (an instrumented run) or a cube per setting.
  • Extension rows of the dithered filtered engines. Solving the native outermost destination rows of the 2x colorfulness capture for the vertical-pass row (a dynamic programme over the horizontal pass, one value per source column) with the native cube as the palette map showed 8 infeasible values with the mirrored edge the engine used and none when the extension row is sharpened against the edge row replicated again and dithered at pattern row -2 (and h + 1 below); see the filtered-enlargement item above.
  • Kernel ties and the seven boundaries. The 110 "tie rows" ((2x + 1) n divisible by N) and the "centre phase of 15x" are not converter defects: a destination row whose centre is exactly on a source pixel's edge has halves of exactly 4096 shares, so the output is (s2 + s3) / 2 + delta with a small tail term, and the floor of the half-integer case depends only on the sign of delta; the integer solver therefore could not pin the tail (the feasible weights lie on a ridge (L, R) = k (m + 1, m) and its pick, e.g. 10, 4086, 4091, 5 for 20 to 81 where the formula has 2, 4094, 4095, 1, is arbitrary within it; the first observation was that the same row solved from two different image sets gave 9 and 10). The converter's rows reproduce every raw native value of the tie rows (halftone-kernel-ties.json.gz, 38 rows of 35 length pairs, 400 images each, edge-on rows at ratios 3.03x to 16.04x, the centre rows of 15x and odd-n centre rows; halftone-kernel-ties.fixture.test.ts), the same rows without their tails fail, and (655, 6881, 656) and (656, 6881, 655) give the same output for every 8-bit input (exhaustive), so FILTER_CENTRE_ROWS is gone. Of the seven interior boundaries, 29 to 46, row 19 is output-equivalent to the formula as well; the other six are real (the converter's row differs from the native output in 300 of 24,000 values with fresh data, the captured row reproduces all). The labelled near-boundary rows (halftone-kernel-sides.json.gz: 4,773 cumulative shares within 0.004 of a whole share in 400 pairs of each of three seeds, halftone-kernel-sides.fixture.test.ts) give the formula's side right in 4,570 (95.75%), with all 195 distinct misses within 0.0035 of the integer and 194 of them in mirror pairs (the native shares are exactly symmetric), i.e. the native cumulative share differs from the double formula by about 5e-4 shares and at most 3e-3 (2^-23 of 8192 is 1e-3). Rejected on that set: the exponents (a change of 4e-4 in either drops it from 4,570 to 2,643 or 2,358), float32 at any one site, any pair of sites, all but one site and all 13 sites (840 sets over two exponent-constant forms, three normalisations and three accumulation orders: best 4,526, all 3,841), float32 truncating toward zero (best 4,524), the boundary form sum_k w_k clamp(a (j + 1) - d_k) in the same sets (4,570), quantising the tap weights, the cover, the kernel or the normaliser to 14 to 32 bits (a spread 4,570 to 4,600 with no peak: the kernel floored to 23 bits is +30, +10/+6/+14 over the three seeds, its neighbours -6 to +12, i.e. noise, not a rule) and a linear-interpolation table of the kernel at 64 to 65,536 nodes in the distance or in the edge distance (4,570). What would decide the six rows and the 195 labels: the native arithmetic of the filter-table builder (an instrumented run or a disassembly), since no site-by-site float variant reproduces it.
  • Alpha under HALFTONE. StretchBlt and StretchDIBits write destination alpha 0 on every branch (replicated, filtered, reduced, same size, with and without a colour adjustment: the destination is pre-filled with alpha 0x55 and ends with 0), and the source alpha never changes the RGB (alpha 255, 0, 128 and random give identical colours in 20 stretches under four plans, 80 runs): alpha is dropped, where COLORONCOLOR copies the nearest source alpha. The converter ignores source alpha and writes opaque pixels, as the opaque reference PNGs of the playback captures show, and its colours equal the native ones for the 16 HALFTONE stretches (noise colours, dithered and plain); halftone-alpha.json.gz and halftone-alpha.fixture.test.ts pin it.
  • 5.5x and 6.5x. Closed by round 5's kernel formula (the table's misses are gone: 5.016x is 6 of 193,563 values, 5.5x, 6.5x and the mixed 2.5x by 6.5x exact in halftone-filtered).

Further parity rounds (3 October 2026) ​

Three additional parallel rounds ship four bounded runtime corrections: the half-open unit-scale Bicubic copy interval, high-quality interpolation when only one axis is scaled, preservation of explicitly supplied font projection/freedom vector words, and premultiplied path-gradient interpolation for uniform surrounds with unequal alpha. No existing per-case bounds were relaxed.

  • Bicubic: 936 independent copy controls improve from 866 to 930 exact; differing pixels fall from 3,340 to 368. All 144 arithmetic controls remain exact; the positive phase endpoint was closed in round 5 (a power-of-two rule).

  • High-quality sampling: 288 controls reduce differing pixels from 37,414 to 35,702 and maximum channel error from 64 to 3. Another 192 independent crop/mirror/alpha controls improve from 29,711 to 27,888 differing pixels, without per-case regressions. Remaining integrated-kernel arithmetic stays open.

  • Font vectors: 448 new native outlines improve from 203 to 267 exact, closing 64 direct-vector controls. Another 2,560 GDI+ images, 384 opcode outlines and 3,072 opcode images pin the broader arithmetic candidates. Combined-rounding exceptions fail independent MDRP controls; the general projection/movement candidate still loses exact real-font or unequal-vector controls and remains excluded.

  • Path-gradient steps: native paints a path gradient as ceil(2 * hypot(w, h)) nested boundary copies. 136 new native captures (72 rows, 64 images) pin it; earlier captures gain 98,306 (opaque), 20,132 (translucent), 35,628 (uniform alpha) and 18,270 (isotropic focus contours) exact pixels; Blend and 50/50 focus playback becomes pixel-exact. Per-vertex surrounds, anisotropic focus, rotation and the copies' rounding were closed afterwards, and so were fractional-bounds tiles and most pixels on a copy's edge; the rest of the edge pixels remained open until round 11, which replaced the fitted copies by the converters read from gdiplus.dll (see EMF+ gradients, Round 11).

  • Path-gradient alpha: 360 new native controls validate the uniform-surround correction. In the 120 independent uniform-alpha subgroup, pixels beyond one channel level fall from 145,136 to 16; controls within one level rise from 22 to 109. Varying surrounds and the prior 57 focus-boundary pixels beyond one level remain open. (8 October: varying surrounds are Gouraud fan triangles and closed, and all 120 of their independent controls have no pixel beyond one level (from 100 of 120 at the first closure); the uniform subgroup is now 110 of 120 within one level with 15 pixels beyond it, by the ceilings in path-gradient-color-bounds.json; the 57 focus-boundary pixels over 40 of the 252 contour controls are pinned in emf-plus-focus-contours.fixture.test.ts and still open.)

  • HALFTONE: discrete nearest-source runs and quantised tent weights reproduce 2,112 response lines. Vertical-first integer intermediate rounding predicts all 432 new central RGB crops, including 48 independent held-out controls, and all 144 prior filtered crops exactly. Content selection is now known (see the HALFTONE section) and the measured filtered engines (whole factors 2 to 5, above 5x, one enlarged axis) replace the nearest-run model for filtered sources; the run model was shipped afterwards for fractional ratios up to 5x on both axes, lone and 5-long runs included (see Filtered enlargement above); alpha is unverified.

  • References: all 101 expanded captures (94 and, from round 6, the seven compat-playback-* sheets) reproduce their original overlap exactly and regenerate byte-for-byte in isolated processes. Eight recordings require explicit recorded-frame/per-record playback. Four mixed-axis checker extents are now covered, leaving nine text comparisons open (below). The report retains 391/611 common-area exact comparisons and improves complete RGB ink coverage to 390/611, with no render failures or missing reference ink (8 October regeneration measures 393/611 and 392/611; after round 6 it measures 637/869 and 634/869, see Current parity priorities).

  • Open extent candidates (playback-extents-open.json, *.wide.png, src/gdi-playback-extents.fixture.test.ts). Native PlayEnhMetaFile into a surface of the converter's own canvas size paints no ink outside our canvas in any of the nine, so no extent is wrong; the references are the clipped side. The report used the Windows fixture fonts (arial, times, cour, segoeui, tahoma, micross TrueType plus the raster .fon faces). The reference surface was the 480-px frame while the text runs on to x = 1,205 (the five Arial recordings: 21,426 native ink pixels beyond the PNG, 21,357 for -ctnatural), x = 959 (textx-fon-fixedsys, 13,652), x = 943 (textx-fon-system, 15,548), x = 675 (textx-segoeui-cell-mono, 2,023), plus one extra column in rotate-text-25deg (140). They are not promoted to .extent.png references because native playback does not reproduce their originals over the overlap, and only a reproduced overlap validates a capture: 503 differing pixels for each of the four non-natural Arial recordings (all in the 8-px first line, whose word gaps differ from the original; the four are natively byte-identical), 39,661 for -ctnatural (the original's natural-width advances are wider over the whole page), 21,624 (fixedsys), 12,850 (fon-system), 989 (segoeui, from y = 281) and 23 (rotate-text-25deg). Text glyph differences change pixels, not extents, so the extent verdict holds despite them. Two other large canvases validated and were added as .extent.png captures (94 in all, 68 exact; round 6 added the seven compat-playback-* sheets that paint at negative device coordinates, 101 in all and 71 exact): emf-insideframe-rect (556x293 from origin -47,-42; its recorded bounds are far looser than the drawing) and emfrec-floodfill (4,480x1,440 from its header bounds, whose width equals 2,560 + 1,920, plausibly the recording machine's virtual desktop but unverified; its playback returns FALSE natively, at the original size too). Recaptured here on 8 October 2026 (src/gdi-text-regeneration.fixture.test.ts, text-recorded-advance.json, environment-text-recorded-advance.json, environment-text-raster-regen.json; the generator gained -OutDir so regeneration goes to a scratch directory first): seven of the nine regenerate their original PNG pixel for pixel, so the font set was not the cause; no reference was replaced. The Arial differences (503 and 39,661 pixels) are the recording, not the converter: the EMF's dx array holds the ANTIALIASED_QUALITY widths (0 of 540 glyphs differ) while a direct drawing uses its own quality's widths (4 of 540 glyphs differ for qualities 0, 1, 2 and 5; 105 for ClearType natural), and drawing directly with the recorded dx equals native playback exactly (0 pixels), so the 8-px word gaps are not ours. Explained, not implemented (see also the rotated text below): the 989 Segoe UI pixels at the 36 and 56 cell lines are the playback's horizontal stretch of eyScale / exScale (1.000558 for these recordings) applied to the text, which Segoe UI's grid-fitting answers at nine of 57 cell heights (TextPlaybackProbe.cs, text-playback-hinting.json, src/gdi-text-playback-hinting.fixture.test.ts; direct drawing under diag(1.000558, 1) at the recorded advances equals playback for all 57 heights and for the committed sheet, 989 to 0). The threshold rule is now known empirically and pinned (text-stretch-hinting.json.gz, src/gdi-text-stretch-hinting.fixture.test.ts; native GetGlyphOutline of 23 glyphs at 18 faces x 65 cell heights x 82 stretches, no rasterisation): a height reacts when M = round(32 E (1 + s)) differs from M0 = round(32 E) and, for Segoe UI, |M / 32 - P| >= 15/16 (all 10,660 outcomes of cell and em heights), for Calibri and its siblings when M is not a multiple of 32 (see parity-notes.md). Rejected: a VDMX group boundary (the thresholds track the 1/32-pixel rounding of the exact em size E: every change point of the first 5e-6 sweep of Segoe UI sits on such a boundary, not on a VDMX ppem or its cell), a float32 ceil flip of the scale (the boundaries are the half-integers of 32 E (1 + s) to the precision of the 1e-5 sweep), and an hdmx bypass (Calibri and Consolas have no hdmx and react at once; Arial has one and Segoe UI has one and the two differ). Windows' playback also reacts through the font's own prep: Segoe UI's disables glyph programs when GETINFO reports a stretched glyph whose x and y ppem agree, which is why reporting the flag to our interpreter reproduces the native outlines at every flagged height (60 of 60 committed outlines). Still open: why the faces split (the reaction is the font program's answer to an environment we can only infer: the stretched flag appears to be set by |M / 32 - P| >= 15/16 for Segoe UI but by any fractional x size for Calibri, and Arial, Tahoma, Times New Roman and Courier New never switch), what the rasteriser hands the interpreter for larger stretches (at a few percent, 5% at 24 px, Segoe UI hints at a different integer x ppem, which is not modelled), and Georgia, Trebuchet MS and Microsoft Sans Serif, which follow neither rule. Not applied to the converter's output (decided in round 6: the stretch is the playing device's own eyScale / exScale, a ratio of the recording and target device sizes that a stateless converter cannot know and that is 1 on a matching device; the committed numbers are 989 pixels direct versus playback and 0 stretched versus playback for textx-segoeui-cell-mono, so applying it would move that sheet from exact against its reference PNG to 989 pixels off, loosening a pinned comparison, and the rule for the faces that split is still incomplete) because the reference PNGs are direct drawings; data that would decide the mechanism: the rasteriser's own scale arithmetic (the stretched flag and the ppem it reports per direction). Explained, nothing to change: the 23 rotated-text pixels are the dx array (a rotated font's recorded advances are the running 1/16-pixel rounded linear advances, not the hinted widths; 98% of 46,620 recorded advances follow the rule and every advance at 5 and 25 degrees does, the rest are half-pixel ties whose direction Windows decides by angle, up at 5 and 25 degrees, down for 35 of 404 ties at 10 and 53 of 403 at 45 degrees; rotated-text-advances.json.gz, src/gdi-text-playback-hinting.fixture.test.ts), and the converter replays dx, so the 31 pixels it differed from the playback were glyph shapes: the rotated glyph matrix, now fitted (one pixel left; parity-notes.md). Open here: the rule that decides the half-pixel ties (a scalar scale on the cumulative position does not fit: ties at 30 and 60 degrees go down only at positions beyond about 170 pixels), how a rotated run drawn without dx is advanced (a direct rotated TextOutW matches neither the hinted nor the linear nor the recorded advances at 25 and 45 degrees), and how a face that keeps its grid-fitting under rotation (Tahoma: 8 of 810 native points of the unhinted model) is hinted along the rotated axes. The remaining 54% of native points of Arial, Times New Roman and Segoe UI that the rounded-rotation model misses are off by one 1/64 pixel (the rounding order inside GDI's fixed-point products is not identified: single or double rounding of the unhinted outline, floor, ceiling and truncation were fitted by coefficient search at 80% at best). Closed as not reproducible by a stateless converter given other fonts, nothing left to do for the raster faces System and Fixedsys: the difference between this machine and the one that made the originals is the installed raster set (evidence: both regenerated captures are reproduced exactly with the matching fonts, 0 of 28,896 and 16,138 pixels differ, and the originals match with the fixture set). At 144 dpi Windows serves System and Fixedsys from 8514sys.fon and 8514fix.fon (20 pixel cells; the stock fonts are those too) as well as the VGA faces the originals used; the converter reproduces each capture exactly when given the matching font set (gdi-text-regeneration, gdi-raster-mapper tests, raster-mapper.json, RasterMapperProbe.cs; textx-fon-fixedsys became exact when the too-big stretch cost of pickRaster went from 350 to 340 per pixel, which also fits one more of this machine's 840 mapper heights, 822 of 840 against 821 before). Not verified: that a 96 dpi session is what withholds the 8514 faces (the stock fonts and the picks are consistent with it; this machine's display cannot be switched and no memory, enhanced-metafile or DPI-unaware device context here reports another resolution, so a capture at 100% display scaling would decide it). The mapper is structurally closer: a face is stretched by up to 8 vertically and at most 5 horizontally (raster-mapper-wide.json.gz, the seven families at lfHeight -130..-61 and 61..130 and weight 700 at -60..60, RasterMapperProbe.cs; every native pick above 5x has the width of a 5x stretch, e.g. System 20 pixel at 7x: 140 high, 45 wide), and costing the factors 6 to 8 at 1,150, 1,280 and 1,840 (from a hill climb that leaves the 822 of 840 inner and 818 of 840 bold heights alone) lifts the lfHeight 61..130 agreement from 631 to 919 of 980; fitted on the 490 negative heights alone the same three costs pick 456 of the 490 positive ones (340 before). Not closed: the remaining 61 of those 980 and the 18 inner heights above (all with equal horizontal and vertical stretch, so independent scales are not the cause). No cost of the form gap-below + gap-above + factor can fit them: a linear program with a free cost per pixel of gap (below and above separately) and per factor leaves 122 of 1,820 requests unsatisfiable, and the picks alternate in ways no monotone cost gives (System, cell height 94, 95, 96, 97: 96 = 16x6, 100 = 20x5, 96, 100). Rejected: absolute and relative gaps, quadratic and square-root gap terms and a width-aspect term (none lowers the 122). A free cost per (face size, factor) does fit the 840 inner heights, but with about a hundred parameters and no formula. Data that would decide it: the same sweep at 100% and 125% display scaling (which sizes each session offers), or the mapper's own penalty arithmetic.

  • codec-jpeg-{12bit,arithmetic,arith-prog-420-dri2,cmyk-photo}-playback (round 6): the EMF header bounds are 0..279 x 0..179 and the frame is 4338 x 2784 hundredths of a millimetre, 280 x 180 pixels on this device, so the converter's 280x180 is the metafile extent. CodecProbe.JpegPlayback played the metafile onto a 300x200 magenta surface, and the 9,600 pixels right and below the metafile were that surface (all magenta, nothing else; no magenta inside the 280x180). Native playback was repeated on this machine (the four files regenerate pixel for pixel on the surface, including the 70, 1,974 and 534 one-level pixels of the three that decode, which are unchanged). The reference .png is now the 280x180 extent (mf.Width x mf.Height), the original 300x200 surface is kept as .surface.png, and src/image-codec-native.test.ts pins both (the surface margin is magenta, its 280x180 equals the reference). The recording .emf files were left as committed (a regeneration writes different bytes, same pixels). Draw stage of the three that decode (round 7): each recording draws the placeholder's own 37 x 19 source rectangle (not the decoded size: a 227 x 149 image is cropped to its top-left 37 x 19) as a DrawImagePoints to 260 x 170 at default (point-sampled bilinear) interpolation, so every residual is sampling. With the decoders exact and the CMYK table exact the residual is 22 pixels (arith-prog-420-dri2), 2 (arithmetic) and 7 (cmyk-photo, 1 level each). Isolated by feeding the native source PNG through a stand-alone bilinear model: of the original 113 pixels 67 interior ones were all ties of the 11-bit fractions that float32 accumulation of the source coordinate per pixel and per scanline (as merged from the sampling workstream) removes (113 to 35 in a scratch run, 9 interior left), and the rest sit in the first column where the right tap leaves the bitmap (partial alpha: the native result is the straight colour times the rounded integer alpha, which this experiment could not reproduce without breaking other fade pixels, so it is left open). Round 8 re-measured it: the 22, 2 and 7 residual pixels are not on the first column but on columns 57, 66, 158, 176, 185 and 194 and on row 147, each a column or row whose 1/2048 fraction of the stepped coordinate lies 0.006 to 0.014 bin below a rounding boundary (the stepped value is at most 14 float32 units low there); with the x accumulator rounded to nearest instead of down the same seven columns (and no other) cross the boundary and the three fixtures fall to 10, 1 and 4 pixels, but the same change moves 2 to 5 pixels in each plain Bilinear fixture (columns 141 and 150 of the 4.5x draw), so the rounding of the accumulator cannot be one rule for both; and a pure shift of the destination origin (-2^-14 in x, -2^-15 in y, the sign flip of the recorded 20 + 2^-15 and 10 + 2^-16) reaches 6, 0 and 7. A sweep of the recorded geometry (ImageCoordinateProbe at 37 x 19 to 260 x 170, origin 20 + 2^-15) matches the model to one draw (2^-10 pixel) on 258 of 260 columns of an interior row, so the stepper is right to well under a bin; what remains is a drift of a few hundredths of a bin that the 1-draw sweep cannot resolve.

  • Every other report line whose rendered and reference dimensions differ (round 6; 166 fixtures that are not expanded captures: one pixel from the inclusive EMF bounds, the plus-effect-* 305x209 against 304x208, the pen, gpx-* and compat-* sheets whose bounds include pen width or control points, the text sheets): generate.ps1 playback-extent-survey (PlaybackExtentProbe.Survey) played each natively into a surface of the converter's own origin and size. 149 playbacks reproduce the original PNG pixel for pixel over its extent. The 17 that do not are: the three emfrec-ca-dither-* sheets (18,461 to 18,521 pixels: the colour-adjustment state of the recording process, closed as not reproducible by a stateless converter), the nine clipped text references of References, gpx-pen-center-miter-aa (7 pixels, at most 15 levels), gpx-pen-lingrad (13, while the converter equals the playback exactly), gpx-text-lingrad (3) and the two textx-rotalign-* sheets (1,454 and 1,354, where the converter is closer to the playback, 258 and 477, than the original is). In none of the 155 non-clipped cases does Windows paint ink beyond the reference PNG, and neither does the converter: the extra rows and columns are blank margins, so the larger converter extent costs no ink and the references are not clipped. The ink bounds of the converter equal the playback's in 162 of 166 cases (the three dithers, whose playback differs from the original, and textx-segoeui-cell-mono, one pixel short at the right and bottom, its known 989-pixel hinting difference). Pinned by src/gdi-playback-extent-survey.fixture.test.ts; the data is playback-extent-survey.json (generator figures). The eight comparisons whose reference is larger than the render (the six textx-plus-* sheets, 202x102 against 360x140, and the two textpb-segoeui-*-q3 sheets) were played into surfaces of the reference size in a scratch run: the native ink bounds (for example 8,8 to 198,99 for textx-plus-antialias, 5,8 to 507,2880 for textpb-segoeui-cell-q3) lie inside the converter extent, so the reference excess is the probe surface padding (white), as for the JPEG sheets above; the originals are reproduced over the overlap (0 pixels, 8 for the two textx-plus-singlebitgridfit/systemdefault sheets). The captures themselves were not committed (8 MB of mostly blank PNGs); only the ink counts, ink bounds and original-overlap mismatches are.

GDI path geometry ​

RoundRect controls now match native GetPath captures without exceptions. The compatible-mode cases also match at 1/16-pixel precision, including mirrored viewports and clockwise paths; path-probe regenerates both captures.

  • Native wide-path-probe now covers 2,136 three-point paths with 2–64 px pens, all cap/join combinations and near reversals. All 128 round-cap/round-join fills match exactly in the regression test. Miter limit tests now follow native whole-pixel rounding of the fixed-point left-side vector (and its negation for the right side); 766 of 768 decisions around 384 measured thresholds match. The two retained decisions share a 7 px perpendicular error. All 228 square/flat-cap miter fills at 2/5 px now match exactly, including near reversals. Selecting cap/join arc vertices from the unrounded pen boundary point also fixes missed/extra endpoints. These changes reduce differing fills from 86 to 68, without changing any formerly exact fill in the capture. The half-pixel rounding of the flattened-pen perpendicular is a closed rule (no per-width table): the point of the pen edge between the support vertex and its interpolation partner, plus a half-unit bias along the segment, plus half a unit lower when the edge's extent in that channel is odd (half a unit higher on the edge that closes the pen), with a rounding boundary rounding up except in y for a segment running upward, and a reversed segment parallel to the closing edge resting on that edge's first vertex; vertical segments follow from the same rule (no horizontal bias). flat-pen-probe captures 1,176 native perpendiculars at fractional and wider-than-100 px widths, and a test checks every one. Two vertices resting on the same pen vertex at a flat-capped round join enclose no other pen vertex. All 2,136 native wide-path fills and all 768 miter-limit decisions now match.

  • wide-outline-probe captures 72 polyline/ellipse outlines across four widths and every cap/join combination. All 36 ellipse outlines match every native vertex, including the duplicated inner triangles; emfrec-path-widen-outline now matches exactly (previously 1.184% mismatches).

  • Native wmf-insideframe-curves now covers 100 ellipse/RoundRect/chord/pie/arc cases at 0.5–10 px. Fractional fitting and widening, plus scaling RoundRect corners onto the inset box, reduce closed-curve mismatches from 1.67–2.79% to 0.11–0.16%; arc retained 0.039% until the arc geometry below. Small boundary differences remain.

  • Arc, Chord and Pie geometry follows native GetPath captures (arc-path-probe: 900 arcs under both arc directions, arc-paths.json and arc-paths-cw.json, and 260 arcs on a 40,000 px circle, arc-precise.json, where one FIX is 3 millionths of the radius). The model, which reproduces 900 of 900 counter-clockwise and 898 of 900 clockwise paths exactly (the other two one FIX off in one point; before round 4: 898 and 898; before that 662 and 234 one FIX off, 4 up to 5 FIX), and 191 of the 260 large-circle arcs exactly (187 before round 5, 182 before round 4), none more than 3 FIX off at a radius of 320,000 FIX:

    • An arc radial's angle is Windows' own approximate arc tangent: in each octant the slope (smaller over larger component) goes through 32 equal slope intervals with linear interpolation of the exact arc tangent at the knots, so the angle sits up to 80 microradians below the true one (a sawtooth every 1/32 of the slope; measured to 2 microradians). The direction is the radial over the box's half axes, measured on the unrounded logical coordinates (not on device-rounded points).
    • Points are those of a regular 128-gon inscribed in the unit circle (polygonTrig), linear in the angle between its vertices, so they sit up to 1 - cos(pi / 128) inside the circle (the old table of 33 fitted node values was this polygon plus the arc-tangent error, mistaken for node errors). Arcs whose two radials are 3 degrees apart or less as angles in [0, 2 pi) (not across the 0 axis, and not the same radial twice) use exact cosines and sines for their points, but not for the control distance.
    • Round 4 (sample 206): the arithmetic is single precision. The 129 cosine and sine nodes of the polygon are float32 values, the angle over the node step (b / (2 pi / 128)) and the slope of the arc tangent are rounded to float32, and a point is the centre plus the float32 product of the radius and the float32 unit coordinate (cx + fround(rx * fround(u)), the sum exact: rounding the sum to float32 as well breaks counter-clockwise paths and was worse on the large circles). It resolves the rounding tie y = 3627.49993 of curve-widen.json sample 206 and the same tie in 108 of its 169 neighbouring chords (168 of 169 now equal native). Found (an analysis of the committed captures, not a test bound) by toggling float32 rounding at sixteen places of the pipeline over the 3,581 captures of arc-paths.json, arc-paths-cw.json, arc-precise.json and chord-closing.json.gz: the product, the node table, the angle over the node step and the slope are the places that helped. Rejected: float32 angles (the arc tangent's result or the final angle; 255 to 435 of the 1,800 paths broken), float32 interpolation between nodes or in the control construction (no gain, a few paths lost), a float32 sum with the centre, and a fixed-point unit coordinate at 2^-14 to 2^-31 (the start points of the neighbourhood fit at 2^-22 and 2^-23, but fewer whole paths). Not exact: two clockwise paths and one neighbouring chord (one FIX off in one point, where the unrounded value is within 0.0001 of a tie), and 69 of the 260 large-circle arcs (control points of pieces under a few degrees, where the model is too coarse for a radius of 320,000 FIX; round 5 explained the axis-aligned ones, see the arc-small capture below). Round 5 captured that data (arc-small-probe, arc-small.json.gz, src/gdi-raster-arc-small.fixture.test.ts: 624 arcs of 0.01 to 3 degrees on radii of 100,000 to 400,000 FIX, Arc, Chord and Pie, both directions). The controls of such an arc are not on the chord (a dozen FIX off it at 0.01 degrees on 100,000 FIX), and an arc that starts on an axis has its first control exactly on the start point and its second a third of the way: single precision, where the cosine of the sweep rounds to 1.0 and the numerator of the tangent-line intersection cancels to zero. The converter now solves the tangent lines of an arc of 3 degrees or less in single precision (51 of the 52 axis-aligned arcs are exact; 162 to 207 of the 624; the large-circle captures 187 to 191 of 260; none of the 900, 898, 600 and 1,500 other captures changes; applied only where the single-precision error is half a FIX or more, 6e-8 / sin(sweep) of the radius, because below that one WMF pie differs at a rounding tie). Still open: 417 of the 624 (none more than 146 FIX off, almost all within 2 FIX from 0.5 degrees up), which no single-precision arrangement tried reproduces: cos(fround(angle)), the end point as the start rotated by the single-precision sweep, polygon trigonometry, sin(sweep) as the determinant, the determinant with double products or fused multiply-adds, the controls from the normalised radial vectors, a line equation instead of Cramer's rule, X = p0 + tan(h) t0; and perturbing the four single-precision inputs by two units of the last place leaves 23 of 96 small single-piece arcs unreproduced, so the missing step is not in the rounding of the inputs. Round 6 captured exactly that, native GetPath of arcs on radii that make one FIX 1e-7 to 1e-9 of the radius (arc-huge-probe, arc-huge.json.gz, src/gdi-raster-arc-huge.fixture.test.ts: 720 arcs of 0.05 to 3 degrees in boxes of 2^20, 2^22 and 2^24 pixels, radials 8 million pixels away, both directions, a fifth starting on the 0 axis). One rule is closed and the rest is a precise negative result:
    • A clockwise arc from the 0 axis is a small arc. Its end radial is at 359.x degrees as an angle in [0, 2 pi) and the converter took the 359 degrees between the two for a large arc (polygon trigonometry, a control point 353,943 FIX off at 2^22 pixels); Windows draws the 0.05 to 3 degrees it is. A clockwise arc is the y mirror image of a counter-clockwise one, so its radials are now compared as mirrored angles, 0 staying 0 (the counter-clockwise arc from 0 to 359 degrees and the arcs whose radials straddle the axis are large, as before: the 900, 900 and 260 arcs of arc-paths.json, arc-paths-cw.json and arc-precise.json unchanged). The arcs of the 2^20 box that match natively go from 22 to 42 of 240.
    • Coordinates are single precision values. Above 2^26 FIX every native point is a multiple of 8 and above 2^27 of 16, the centre plus the float32 product of the radius and the unit coordinate summed in single precision. Below 2^20 FIX the sum is exact: the nearest FIX of the exact sum fits 52 of 52 axis-aligned small arcs (a float32 sum rounded half up 51, half down 48: 399964.515625 goes up and 399915.484375 down). On the huge boxes the float32 sum floored fits 48, 36 and 44 of the 48 axis-aligned end points (2^20, 2^22, 2^24 pixels) and the exact sum rounded to nearest 48, 12 and 0: no single rule covers both ranges, so the model keeps the exact sum and the big boxes stay inexact (42, 0 and 0 of 240).
    • The angle is not the source. The converter's angle model reproduces the native end points to 3e-7 radians (rms 2.6e-7 at 2^22 and 3.8e-7 at 2^24 pixels, the quantisation of the float32 product), so the missing step is not a different arc tangent.
    • The control offset. For 256 off-axis arcs of 0.05 to 1 degrees the two controls are the unit-circle Bezier of the tangent-line intersection X of two single precision unit vectors (kappa (X - P), the native X read back from the controls to 1e-7 or better), and the native X differs from the exact one by a shared offset: along the mid radial it is 0.14 to 0.24 of 6e-8 / sin(sweep) rms, across it 0.66 to 1.05, the signature of two unit vectors whose lengths differ by an ulp (the length of one line's normal moves the intersection by that over the sweep). The nearest-rounded vectors of the converter are no closer to the native X (median distance 0.68 against 0.59 for the exact X, in units of 6e-8 / sin(sweep); the values truncated, rounded away, rotated from the start by a single precision sweep, from single precision angles or from a single precision sweep: 0.63 to 0.79, none below 0.59); perturbing the four components by up to three ulps solves 128 of 156 small-arc cases and perturbing the two single precision angles by up to four ulps 68 of 78, with no pattern in the perturbations. Candidate arithmetic in device space (a Cramer solve of lines at the radius, with the product before or after, double or single precision) reproduces fewer (10 of 39 axis-aligned and 6 of 39 off-axis, against 34 and 5).
    • What would decide it. The vectors one at a time: an arc series sharing one start radial and ending 1 to 64 pixels further along the same far circle (sweeps of 1.3e-7 to 8e-6 radians, where the intersection is ulp / sweep away and every control point is far off the circle): the intersections lie on the line x . q0 = 1, whose fit gives the start vector itself, and the same fit on the end gives q3 for each step.
    • Each piece (the arc cut at the quadrant boundaries) is a cubic with end points P0, P3 (the polygon points) whose controls divide P -> X at kappa = 4/3 c / (1 + c), c being the polygon cosine of half the piece's sweep and X the intersection of the lines x . P0 = 1 and x . P3 = 1 (each a sag outside the true tangent). This single rule replaces the earlier anchored-piece and quadrant-interior models.
    • A whole quadrant between other pieces takes the full ellipse's own Bezier, and so does the first piece of an arc starting on 90 or 180 degrees (270 and 0 mirrored for a clockwise arc, which is the y mirror image) and the last piece of one ending on 270 or 360 (90 and 180 clockwise); a whole-quadrant first or last piece of the other kind, and an arc that is just that one quadrant, is built like any partial piece (as if a zero-length piece came first or last).
    • Arcs are measured as before for the radials, and a RoundRect scales its corner onto the drawn box from the unrounded device size: fractional extents under a cosmetic pen, whole FIX (truncated) under wide and null pens, replacing the earlier even-pixel rule, which matched only the 12 x 9 corner of wmf-shapes (wmf-roundrect-corners: 75 wide-pen and 25 null-pen corners at two scales; mismatches 500 and 813 pixels to 0 and 0). wmf-insideframe-curved-chord/pie/arc and the inside-frame Chord/Pie/Arc pixels are exact, and wmf-shapes-scaled fell from 0.158% to 0.008% (7 pixels).
    • AngleArc takes its angles directly (no radial, no arc tangent): the same polygon trigonometry and piece rule, with exact trigonometry for sweeps of 3 degrees or less, now give 599 of 600 native paths exactly (angle-arc-paths.json, in the arc-path-probe group; before: 71, with 86 having a different number of Beziers). An arc of less than 90 degrees is a single Bezier even across a multiple of 90 degrees (the earlier rule cut it there); from 90 degrees on it is cut at the multiples of 90 and ends with a zero-length piece on a boundary, as before.
    • Not reproduced: four paths with one control or end point one FIX off (arcs close to a full turn or to the 3 degree threshold, where the exact value is within 0.15 FIX of a rounding boundary), arcs of under 1 degree (a native point is up to 2 FIX away at a radius of 320,000 FIX, from fixed-point arithmetic that is not modelled), and the zero-length leading or trailing Bezier Windows emits where an arc starts or ends exactly on a boundary (dropped by the comparison).
  • Flat-capped round joins no longer include a vertex that lies exactly on the second ray, and keep a steep segment's extreme-x vertex on the left side (flat/round 5,999 random paths: 86 differing to 1). A wide pen on a curve is widened with per-segment curve rules: the pen rests on a flattened curve's support vertices and round joins, a joint between two cubics takes the tangent of the cubic with the longer control arm, and a curve end's perpendicular and square-cap extension follow its end tangent. curve-widen-probe captures 320 native WidenPath outlines (80 Beziers, 80 each of arcs, chords and pies; flat, square and round caps; round, bevel and miter joins): the Beziers, all 80 arcs and all 80 pies are exact, and all 80 chords (round 4: the last outline, sample 206, differed in 1 pixel until the arc points became single precision; previously 148 of 240 arc/chord/pie outlines in 1,437). Rules found with arc-cap-sweep-probe (arc-cap-sweep.json.gz: 1,436 square-capped arcs over the end angle, all exact) and the curve captures: (1) at one logical unit per device pixel (wholePixelDashVectors; the 0.75 scale of wide-pen-axis-probe stays exact without it) a segment's square-cap extension is half the width times its vector over the length of that vector cut down to whole pixels (floor(component / 16) per component, the same measure dashes use), rounding ties away from zero; it shortens the extension by up to a fifth on tiny arcs, applies to a curve end's tangent, to a curve cut to a single flattened segment (its chord) and to every straight segment, and is zero for a vector under a pixel in both components (emfrec-anglearc and emfrec-path-flatten become exact); (2) the cap extension and the perpendicular come from the same tangent, and the join of a line with a curve end takes the curve's tangent perpendicular instead of a pen support vertex (chords and pies: 683 and 280 differing pixels to 327 and 0); (3) the cubic-boundary rule (both sides share the longer tangent's perpendicular) applies only where the earlier segment holds a cubic's end tangent and the later one the next cubic's start tangent, not between the first and last flattened pieces of one cubic. Rejected: the cap follows the chord of the last flattened segment (it follows the tangent for long arms and the chord only for a cubic cut to one segment); a fixed fraction of the half width (the shortening varies with the tangent in a sawtooth with a three-degree period that is exactly the whole-pixel norm); hidden extra precision in the arc (the 1,436 sweeps are reproduced from the rounded GetPath points alone). Other scales: scaled-line-caps-probe, scaled-cap-sweep-probe and scaled-pen-widths-probe show the cut is in whole logical units, rounded to the nearest unit (floor of the logical vector plus half a unit) as soon as the device vector is converted back, with the numerator the rounded device vector and half the unrounded pen width; a segment under a 0.7 scale extends 94 FIX where its exact vector gives 96, which the device-pixel cut cannot produce (device units 16, 8 and 4 were tried at scales 0.5, 0.75, 1.5: worse than no cut) and floor with no half unit fits 13 to 74 of 358 arcs (the exact vector 2 to 170) against 315 to 344 with it. Round 3 closed the first and last of those with no logical coordinates carried: the arc cut rounds each component to the nearest whole logical unit with ties away from zero (a logical component of -3.5 normalises by 4; the earlier half-unit-then-floor tied toward +infinity, which is the whole 4% of arcs: 358 of 358 under scales 2, 0.5, 0.75 and 1.5, 356 and 358 under the anisotropic maps), and the pen nib is the device width in FIX rather than a width rounded to whole pixels (the whole-pixel extent on an axis-aligned line is the perpendicular's rounding: 400 of 400 horizontal and vertical pens, 323 of 323 vectors at 0.7, 1.3, 2.5 and 10:7). Open there after round 3: dashed square caps (closed in round 4: a dashed pen under a world scale or anisotropic map lays its pattern out in logical units and measures every segment by its logical vector rounded to the nearest whole unit, the cut and the dash-end extensions then follow from x0 + d * t / len and the scaled extension; scaled-dash-cap-probe captures 1,416 dashed arcs under scales 2, 0.5, 0.75, 1.5 and the 1/16 and 2 by 1 maps: 95 fill-identical before, 1,416 after; the device vector's exact length, its floor to whole device pixels and its nearest device pixel all drift along the arc by hundreds of pixels), rotated arcs (first cap midpoint 92 of 358 and no exact outline: the rotated pen nib; closed in round 6, see "Round 6: the rotated GDI pen"), the two 1:2 arcs ending in a one-FIX segment (closed in round 4: the Bezier runs past its end point and returns, so the end tangent opposes the last flattened segment; native turns the last join along the tangent, a round wedge on the leading side, and so does the converter now: curve-end-reversal.json.gz, 1,440 outlines of 240 curves under three caps and two maps, 304 differing before, 0 after; a threshold under which native drops a short final segment does not exist: collinear final segments of 1 to 24 FIX after a long one, tiny-final-segment-lines.json.gz, 588 outlines along the thin axis of a 3 by 48 pixel nib, are fill-identical except 24 flat-capped reversals that differ by one pixel), and GM_COMPATIBLE direct drawing (device points on whole pixels, c3:4 of scaled-line-caps.json.gz, 117 of 323 vertices exact; an EMF never meets this because its playback keeps fractional points, so it is a WMF matter). Carrying the exact logical vector for the cut was tried on those captures and rejected: the cut from the logical vector with the extension numerator from the device vector fits 209 of 323 at 4/3 but breaks the compatible 4:3 and 10:7 maps that the device-derived cut fits exactly (323 to 271 each), and using the logical vector for the numerator as well is worse everywhere (14 of 323 at 4/3). emfrec-path-widen (16 pixels) was not the widener: 200 native WidenPath outlines of RoundRects under a round pen are exact from their own GetPath points. The corners came from the RoundRect geometry of that playback: in GM_COMPATIBLE the EMF record holds the call's right and bottom edge less one pixel and GDI scales the corner ellipse from the call's box onto the drawn one (floor to whole FIX under a wide pen; emf-roundrect-wide-probe captures 1,800 native RoundRects, 450 per pen kind, and the wide plain and wide geometric pens are all exact; emfrec-path-widen is now exact). Superseded by the graphics-mode probe (emf-roundrect-mode-probe, round 3): the scaling above is what a GM_COMPATIBLE application sees drawing the call straight onto a device, not what PlayEnhMetaFile draws from the record it leaves. An EMF has no graphics-mode record (SetGraphicsMode is not recorded; the compatible and advanced recordings of the same calls differ only in the EMR_ROUNDRECT right and bottom, one pixel less in compatible mode), and native playback (GetPath read when the recorded EndPath has played, 800 shapes in emf-roundrect-mode-paths.json.gz) is the same function of the record's box in both: the corner ellipse stays unscaled under cosmetic, wide and geometric pens, and a null pen's quarter-pixel grown box takes the corner scaled onto it (floor to whole FIX). All 800 playback paths are matched and the six playback sheets are pixel-exact; the compatible-draw scaling was removed from the replay (the 450 direct-draw GetPath shapes of emf-roundrect-wide-paths.json.gz now pin how far playback is from it: 0 to 19 of 450 equal), and emfrec-path-widen was re-referenced to its native playback (the old direct-draw PNG is emfrec-path-widen.direct.png; 16 pixels at the corners). Round 5 re-measured the other compat-only rules against playback of a recording (compat-playback-probe, src/emf-compat-playback.fixture.test.ts: 42 sheets of 36 mixed shapes under six map modes and seven pens, plus 60 sweep sheets of 315 Rectangles and 315 null-pen Ellipses each at every fractional phase of ten maps and world scales; the direct-drawing PNGs are kept as .direct.png; on the six sheets measured the converter differs from the direct drawing by 49 to 251 pixels per shape kind). Two rules were wrong for playback and are fixed: (1) a Rectangle drawn with a cosmetic or dotted pen takes all four edges to ceil(device coordinate) (outline and fill; 5,040 rectangles, edges differ by one pixel at every fractional position; a null pen already matched, the integral maps were never affected), 133,868 differing pixels over the 102 sheets before, 259 after; (2) the null pen's quarter-pixel growth (Ellipse, RoundRect, Chord, Pie) happens whenever the four device edges are whole pixels, not only at the identity scale. Hypotheses rejected: growth per axis (when only that axis is integral: 342 against 192 pixels on the 2:3 by 1:1 sheet), growth whenever the scale is integral or the reciprocal of one (misses the integral boxes of fractional maps), growth under every axis-aligned map (451 against 192), and measuring the arc radials on the unrounded device points (4 to 44 pixels per sheet better on some, worse on others). Closed in round 6: the Arc, Chord and Pie radials under non-unit maps (1 to 4 pixels per arc; 259 pixels over the 42 sheets, 37 of them one dotted Chord at 0.7). The data that decided it is GetPath of the played-back arcs, which PlayEnhMetaFile cannot give (a path bracket around it stays empty, and the path is lost when the playback restores the DC) but a per-record playback can: CompatPlaybackProbe.PathPlayback (compat-playback-paths-probe) runs EnumEnhMetaFile over a one-shape recording, plays every record with PlayEnhMetaFileRecord (the recorded SetWindowExtEx/SetViewportExtEx records do apply) and wraps only the Arc, Chord or Pie record in SaveDC, BeginPath, the record, EndPath, a path read under an identity world transform at 16 units per pixel, RestoreDC; compat-playback-paths.json.gz holds 3,600 shapes (600 under each of the six maps, Arc, Chord and Pie, a quarter clockwise), each with the call, the record Windows wrote (its right and bottom edge are the call's less one device pixel in logical units: one under the 1:1 and 4:3 maps, two under 2:1, one or two under 3:2 by 1:1) and the native FIX path. The rule, found by scoring four candidates over all 3,600 paths: Windows measures a radial's angle in logical space, as the fraction of the record's box the radial sits at ((x - l) / (r - l)), and carries that fraction onto the device box it draws; the converter rounded each radial to FIX first, which moves it by up to half a FIX against the box. Exact paths per map before and after (10:7, 3:4 and 3:2 by 1:1 are the maps whose ratio is not a multiple of 1/16): 1:1, 4:3 and 2:1 600 and 600; 10:7 175 to 600; 3:4 213 to 600; 3:2 by 1:1 353 to 600 (2,541 to 3,600 of 3,600; src/emf-compat-playback-paths.fixture.test.ts). Rejected, with the same scoring: the unrounded device radial (258, 264 and 434 of 600 on the three maps: better than FIX but not the rule), the radial rounded to a whole device pixel by round, floor, ceil or truncation (2,734 to 4,551 differing pixels over the 42 sheets against 259: the box is not on whole pixels; measured on the sheets, before the path capture), the unrounded radial truncated, floored or ceiled to FIX (81 to 295 of 600 on the three maps), the logical fraction taken against the call's box instead of the record's (r + 1: 0 to 4 of 600). The sheets' arcs are pixel-exact now (259 differing pixels over the 42 sheets, 24 after, every one in a RoundRect cell: compat-playback-r34-geosq9 14, r107-wide7 3, r107-cosmetic 2, r34-null 2, and one each in r32x11-cosmetic, r34-dash, r34-geo5). The same fraction replaces the unrounded-device-point rule of the inside-frame arcs (emf-scaled-paths, 2,400 shapes, still exact). A chord whose arc flattens to one segment is a closed two-vertex polygon (joins, no caps; chord-sweep-probe: 1,044 native chords on 1 to 15 degree arcs fill identically, 248 of them (three flattened vertices or more) vertex for vertex, the two-vertex ones differ only in figure order, start and a repeated vertex, which does not change the fill). Round 3 (chord-closing-probe, dash-neighbourhood-probe): sample 128 is closed (flat caps: a curve's inner join takes the wedge between its two sides when it holds two or more pen vertices and the join is not between two cubics; 147 width-5 arcs of the neighbourhood and the sample are exact, a one-vertex wedge breaks a width-8 arc and the cubic boundary breaks curve-widen sample 193, so those two conditions are the measured ones), sample 206 (closed in round 4) was not the widener (native GetPath of the chord widens exactly from its own points in 5,820 of 5,841 captures; our arc starts a FIX off at a rounding tie, y = 3627.49993; 108 of 169 neighbouring arcs share it; float32 evaluation of the whole pipeline fixes them and costs two of 900 arcs and 5 to 13 large-circle points; round 4 found the float32 places that fix them without those costs, and 168 of the 169 neighbouring chords are now equal: see the arc geometry bullet above), and sample 117 belongs to a family (24 of 1,300 neighbouring square-capped Beziers, 1 to 3 pixels): the end corners of a dash that GDI scales by real over whole-pixel length, where the extension is an exact half (110.5 native 110, 3.5 native 4, 57.5 native 58, -62.5 native -63): four tie directions and nineteen double and float32 evaluation orders each broke some of the 18 samples with exact ties (closed in round 4: native computes the dash cut points and the extension in single precision, see below; curve-dash is now 300 of 300 and the neighbourhood 2,483 of 2,484). Round 4 captured 2,027 flat-capped dashed Beziers whose cut points sit within 6e-4 FIX of a rounding tie (dash-cut-ties.json.gz, picked by find-dash-cut-ties.ts; 349 rounding decisions are forced by the outlines). Rules: (1) a square cap at a scaled dash end extends by the vector component times a float32 ratio (half the width over the whole-pixel length), the product a float32, rounded half away from zero (the 110.5 gives 110 because the float32 ratio 104/176 is a little under, the 3.5 and 57.5 are exact and round away); every one of the 42 forced extension ties in curve-dash.json and the neighbourhood fits; (2) a cut coordinate is the float32 sum x0 + d * (t / len) (d the segment vector component, t the distance walked, len the whole-pixel length), and a sum that lands on x.5 rounds up when the component is positive and down when it is negative (exact ties: 132 of 133 forced decisions follow the sign of d alone; whether the cut ends or starts a dash and the axis are irrelevant). Fit: 321 of the 349 forced decisions (an analysis of the committed capture, not a test bound: each decision is the rounding of one cut that makes that outline fill-identical); 108 of the 2,027 captures differed with double-precision cuts, 36 now (largest 6 pixels; pinned in gdi-raster-dash-cut-ties.fixture.test.ts). Not explained: the 28 forced decisions that follow the exact double value instead of the float32 tie (the cut lies 9e-6 to 1.2e-4 from the tie and native saw it on the exact side; d positive and below the tie, or negative and above it; no function of the cut coordinate magnitude, the dash end/start, the axis or the real/whole-pixel ratio separates them from the 321, and seven formula orders with float32 at every subset of their operations do not either). Round 5 captured that data (dash-lengthened-probe, dash-lengthened.json.gz, src/gdi-raster-dash-lengthened.fixture.test.ts): 76 of the curves (the 36 that differ and every 50th) behind a straight run of 1, 64 and 512 whole periods of the dash pattern, ending at the curve's start so every cut falls on the same fractions. Native cuts the curve at the same points at every distance: the dash polygons of the curve are identical at 1, 64 and 512 periods for all 76 (an accumulated single-precision walk distance would move a cut by up to 0.016 FIX at 512 periods, against tie gaps under 6e-4), and the converter's per-segment walk differs in 36, 34 and 32 of them (the cases that stop differing do so while the native polygons of the curve are unchanged, so the difference there is in the run or its join, not at a cut). Accumulated distance is therefore rejected, as is a float32 walk position in the converter (variant with t and the remaining dash in single precision: 41 of 2,027 differ, from 36; a cumulative single-precision boundary position against the segment start: 74). The 36 stay with the rounding of the sum itself, where the 28 forced decisions that follow the exact double and the seven formula orders above are the open part; what would decide it is the native value of a cut itself, which no outline exposes: the item stays open at the 321 of 349 forced decisions, and since no outline exposes the native value of a cut it is not reproducible from outside. 21 of 5,841 near-complete chords (closing line under 8 FIX) keep one-FIX final segment differences (the two 1:2 anisotropic arcs that did too are closed: see above). A dash that starts or ends on a flattened vertex keeps its zero-length piece along the segment it was cut from (native joins it: flat caps 5 of 100 samples by 24 pixels to 1 by 1); starting a dash with a zero-length piece along the earlier segment when the cut lands on the segment start made two samples worse. Cap lengths use Math.sqrt of the exact sum of squares: Math.hypot rounds differently in V8 and JavaScriptCore and flipped an exact tie (sample 154).

    Round 6 also swept the compat sheets under mirrored maps (compat-playback-mirror-probe: compat-playback-m<x|y|xy>-<map>-<pen>, 60 sheets of the 36 mixed shapes under a negative viewport x extent, y extent or both, maps 1:1, 10:7, 3:4 and 3:2 by 1:1 and five pens, and compat-rects-m* / compat-ellipses-m*, 72 sweep sheets of 315 shapes at every fractional phase; the viewport origin sits at the far edge) and their paths (compat-playback-shapes-probe: 6,912 Arc, Chord, Pie, Ellipse, RoundRect and Rectangle records, 48 of each kind per map, 24 maps, four pens, half of them clockwise, each played alone inside a path bracket). Before, the 60 sheets differed in 399,930 pixels and the 72 sweeps in 150,507; now 410 and 0 (src/emf-compat-playback-mirrored.fixture.test.ts, src/emf-compat-playback-shapes.fixture.test.ts). The rules, each found by scoring the alternatives over the whole capture:

    • The record. GDI writes the box in device order (l > r under a mirrored x, t > b under a mirrored y), and the recorder inverts the arc direction once when the map's determinant is negative: a call under the default AD_COUNTERCLOCKWISE stores SetArcDirection(AD_CLOCKWISE) (the first record of a y-mirrored sheet). The converter read the box's own signs, so a reversed box undid the mirroring and a mirrored map drew the long way round the ellipse (3,200 to 3,500 differing pixels per Chord or Pie kind on one sheet); the map decides.
    • Arc, Chord, Pie, Ellipse. The shape is the logical one mapped point by point, with the roundings of the mirrored axes flipped. A mirrored y runs it the other way on screen and its vertical roundings follow the opposite of the recorded direction. A mirrored x takes the whole quadrants from the ellipse of the mirrored box (the horizontal controls round down instead of up) and draws the circle on the same centre with the horizontal radius floor(w / 2) instead of ceil(w / 2): scored over 144 arcs under a mirrored x, the eight choices of centre (l or r plus or minus ceil or floor of half the width) and radius give 144 exact for l + ceil(w / 2) with floor(w / 2) (the same circle as r - floor(w / 2)) and 109 to 111 for the other six, the pointwise mirror of the unmirrored arc among them. With these, 864 of 864 shapes of each kind are exact in every mirroring and map under the cosmetic, plain and inside-frame pens.
    • Rectangle. The path is the logical one mapped (864 of 864 exact, start vertex and direction included), and a drawn Rectangle with a cosmetic or dotted pen takes every edge to ceil(device coordinate) in any orientation (the converter skipped a box with a negative extent: 150,507 differing pixels over the sweeps). The dot pattern of a drawn outline starts in device space at the right-top corner heading left, or at the right-bottom corner heading left under the recorded AD_CLOCKWISE, for every mirroring (the eight start-and-direction choices scored over the 12 dotted sweeps: only this one is exact for all four mirrorings).
    • RoundRect. The horizontal controls round down under a mirrored x (143 of 143 corners under x and 140 of 140 under x-and-y, against up in 142 of 142 unmirrored and 139 of 139 under y), the vertical ones follow the recorded direction XOR the y mirroring (552 of 553 left-edge measurements over the four mirroring), and the path is the unmirrored construct mirrored in x afterwards. The dotted RoundRects of the playback sheets (four maps) differed in 1,011, 786 and 980 pixels under x, y and x-and-y and now in 7, 0 and 6. The corner half extent is round(hb * c / w) (round 7, G3, see the geosq9 entry below): the mirrored RoundRects of the cosmetic and plain pens are exact under every map (144 of 216 under x and x-and-y, the other 72 being the inside-frame pen that was not mirrored until round 8; 216 of 216 unmirrored and under y), against 109 and 103 of 216 under x and x-and-y and 196 and 187 unmirrored and under y before.
    • Wide pen under a mirrored x (round 7, 410 to 55 pixels). The wide plain pen (3 units) under the anisotropic 3:2 by 1:1 map that mirrors x put a diagonal edge pixel of polygons, lines, ellipses and arcs on the other side (169 and 166 pixels on the x and x-and-y sheets; the unmirrored sheet is exact), and the geometric round pen 12 more on each. compat-widemirror-probe (CompatPlaybackProbe.WideMirror: 300 random lines, horizontal and vertical lines, triangles, quadrilaterals, ellipses and zero-length lines per sheet, plain pens of 3 and 4 units, the map and its x mirror, 28 sheets) isolated it. An unequal-scale pen is an elliptical nib (2 x 3 pixels for 3 units); a horizontal line shows the nib's ends: with the map unmirrored they are square, mirrored the end pixels are pointed on exactly the ends whose fractional device x puts the nib's corner outside the diamond (0.67 at the device-left end and 0.33 at the right end, 3 units; independent of the line's direction, 118 square, 52 + 32 + 23 pointed of 225 lines). That is the polygon penPolygonMatrix builds for a matrix that flips x (the diamond (+-16, 0), (0, +-24) FIX where the unmirrored map gives the flattened ellipse with (+-11, +-17)): the mirrored sheets (3 units) fall from 455 (lines), 536 (ellipses) and 637 (triangles) differing pixels to 3, 0 and 2, and compat-playback-mx-r32x11-wide3 and -mxy-r32x11-wide3 from 169 and 166 to 2, -geo5 from 12 to 0 (src/emf-compat-widemirror.fixture.test.ts; unmirrored and y-mirrored maps keep the ellipse). The dots (zero-length lines; 98 pixels on each 3-unit dot sheet, mirrored and not, 196 for 4 units mirrored) and the 3 to 14 line-end pixels of the line sheets were one rule, found with compat-dot-grid-probe (CompatPlaybackProbe.DotGrid, compat-dot-grid.json.gz): native WidenPath of a MoveTo/LineTo to the same point at every sub-pixel position (half-FIX steps in x, 0.75 and 1 FIX in y) under the 2 by 3 and 2.67 by 4 pixel nibs, both signs of the x extent, plus one whole-pixel dot under fifteen other pens and maps (5,653 outlines). The nib is whole at every position except a dot whose rounded device position is a whole pixel on both axes (the sheets' lx % 3 = 0 columns at whole rows: a third of the dots), where every nib vertex but the pen's first and its opposite (the top and bottom of an ellipse, or the diamond's) sits one FIX nearer the centre along each axis it is off the centre: (+-16, 0) is (+-15, 0), (+-11, +-17) is (+-10, +-16), the digital pens of 2 to 5 pixels and the flattened circles of 8 and 12 pixels alike (Outliner.dot). A line from a whole pixel keeps its whole nib (the 8 captured lines). Every line, hline, vline and dot sheet is now exact (28 sheets: 25 exact, the three polygon sheets keep 1, 2 and 2 pixels); no other native capture changed. Left over from the mirrored compat-playback sheets (5 pixels after round 7, G3: mx-r34-geo5 and my-r34-geo5; the RoundRect corner under the non-dyadic maps was closed, see geosq9 below; all closed in round 8, see the R8 entry after the G entries). (An inside-frame pen under a mirrored x or x-and-y was not mirrored for a RoundRect, 0 of 72 against 72 unmirrored and under y; closed in round 8.) The null pen's quarter-pixel growth of a whole-pixel box is part of native GetPath in a path bracket as well as of the drawn shape, but the converter applies it to the drawn shape only (pen 0 of the capture is excluded from the path test).

    Rectangular inside-frame native sweeps now cover 0.5–10 px widths and are exact; fractional transformed cases remain open.

  • Round 7, workstream G (non-text vector residuals).

    • SourceCopy gradients (gpx-rec-compositing 475 and gpx-rec-compositing-aa 645 differing pixels, both now 0). The images were one level off only in translucent pixels (the translucent gradient cells; the half-covered edge rows and ellipse edges). Two native rules, each isolated on its own. (1) The straight channel GDI+ stores for a premultiplied ramp pixel p under alpha a is floor(p * floor(255 * 65536 / a) / 65536), not the nearest rounding the sampler used: gradient-unpremultiply-probe (GradientUnpremultiplyProbe.cs, gradient-unpremultiply.json.gz) filled 700 random two-colour ramps (alphas 1 to 254) in SourceCopy onto a transparent 32bpp ARGB bitmap and read them back: the formula reproduces 49,000 of 49,000 pixels (a reciprocal of 15 to 24 bits fits equally; nearest rounding 6,269, the exact floor 46,564, which fails wherever p * 255 / a is a whole number: 27 * 255 / 81 = 85 is stored as 84). The rule applies to SourceCopy only: the same change on the SourceOver gradients broke gpx-lin-alpha (0 to 2,721 pixels), so linearRampSampler takes it as a flag. (2) A partly covered antialiased edge pixel of a SourceCopy fill scales the premultiplied colour, not the straight one: p' = round(p * k / 32), a' = round(a * k / 32), stored unpremultiply(p', a'). 62 of 62 half-covered gradient pixels and 121 of 121 edge pixels of the 128-alpha ellipse are exact (keeping the brush colour matched 10 of the 121); the gradient hands its own premultiplied pixels to sourceCopyPixels, a solid brush premultiplies round(c * a / 255).
    • gpx-lin-sigma (2 pixels; closed in round 11, R11-F). Both pixels have a ramp coordinate one 16.16 unit below a table-fraction boundary (u / 256 = 17126.996 and 19432.996); a global +1 on u00 (round of -103837.78 taken as -103837) removes them without disturbing the other 15,998, but changing how u00 rounds (truncating v + 0.5, ceil, for u00 alone or all three coefficients) loses 6 to 17 of the 663 exact comparisons (gpx-lin-gamma, gpx-lin-preset5-large, gpx-pen-lingrad, grad-linear-a30-*, grad-linear-skew-blend-*: the u00 of those are -88833.37, -425159.85, -241833.80, -775652.79 and -825268.13, all needing the nearest rounding), and evaluating the inverse brush matrix in float32 (three operation orders) moves u00 by 0.07 to 0.16 the wrong way where +0.28 is needed. It is a sub-unit offset of the ramp origin that this rule set does not produce; left as it is.
    • Per-vertex path gradients (grad-path-triangle-*, open; a candidate left out). The 54 pixels of each tiled fixture and 13 of the clamped one are one level, on exact half-level ties (57.5 theoretical, 57.49998 computed). Scoring edge arithmetic against the 320 independent captures (path-gradient-vertices.json.gz, 175,640 painted pixels, 98.33% exact) found that forming the edge colour as ca (1 - t) + cb t in float32 rounded toward minus infinity (down32, as for the copies of a uniform surround) lifts every group (rgb, shape, quad, pentagon, rand, randa, randf, rotated and scaled sets) to 99.23% (2,905 to 1,345 wrong pixels; about 60 other arrangements of float32 operations, double and fixed-point forms peak at 99.25%, a fully float32 accumulating span). But it trades against the named fixtures: grad-path-triangle-clamp 13 to 17 and the four tiled ones 54 to 70, 74 or 70, because every remaining tie of grad-path-triangle is a tie that native rounds UP (cL = 105, cR = 115, 12 pixels, i = 3 and 9: 107.5 and 112.5, native 108 and 113, which no floored 16.16 step or float32 span produces) while the dataset's remaining ties go both ways (589 up, 514 down of the 1,618 wrong channels). The 5,383 exact-rational ties of the 320 captures round up 2,190 times and down 3,193, with no feature (edge denominators, parity, span length) separating them. The change is therefore not shipped; the rule that decides the up ties is the open piece. grad-path-focus-ellipse-* and -triangle-* (2 to 35 pixels, one level, symmetric pixel pairs on a copy's edge) are the documented slanted-edge ties and were not touched.
    • Round 8, workstream R5 (EMF+ gradients; nothing shipped, three isolating experiments).
      • Per-vertex path gradients: the span stage isolated (PathGradientSpanProbe.cs, path-gradient-span.json.gz, src/emf-plus-path-gradient-span.fixture.test.ts). 108 fan triangles whose two end colours of every scanline are exact in any arithmetic (colours in multiples of 64, edges 256 and 512 rows tall, so t = k / steps is a binary fraction and no model of the edges is in the way): 60 random colour triples and start fractions and 48 "flat" fans (centre 64, p0 192, p1 128) whose end colours are equal on every row. 2,974,721 pixels of 55,188 spans, none unpainted. (1) Not a stepped delta. Every one of the 2,631,233 pixels that is not an exact half-level tie of cL + (cR - cL) j / n has the nearest level of it (0 differ); the 16.16 span of the converter differs on 33 of them. (2) Ties are a function of the span length. A flat span (one colour, no delta) at exactly x.5 is entirely x + 1 when its length is a power of two (208 of 208), x + 1 at the first pixel and x at every other one when it is odd (1,516 of 1,516) and either of the two when it is even (71 and 1,181; no other pattern in 2,976 spans). Nothing that starts at the left colour and adds, or scales the difference, can do that. (3) Candidate. Weighting the two ends separately in single precision with every operation rounded toward minus infinity reproduces it: l * down((n - j) / n) + r * down(j / n) (the weights sum to less than one unless n is a power of two), with the edges as a * w0 + b * w1, w1 = down(k / steps), w0 = down(1 - w1). Flat spans: 70,612 of 1,444,812 pixels wrong against 241,536 for the converter's 16.16 step; other spans 10,511 of 1,529,909 against 4,105 (the ties of an exact step that native rounds up are a loss for it). On the 320 per-vertex captures it lifts 171,194 to 172,759 of 174,084 pixels exact (98.34% to 99.24%; every group improves, rgb to 99.8%, shape 94.2% to 98.4% and the random polygons 98.8% to 99.3%) and the five grad-path-triangle-* fixtures from 13, 54, 54, 54, 54 to 12, 50, 50, 52, 52 differing pixels (report.ts with the candidate in place of the module). It is not shipped: of the 120 per-vertex alpha controls (path-gradient-color-bounds.json) 14 exceed their ceilings (7 controls, #69, 71, 135, 136, 137, 141 and 143, that were exact are left with 2 or 3 differing pixels; the other 7 exceed theirs by one to four pixels), while 44 others tighten and the 240-control sum falls from 784 to 721 differing pixels. The candidate is kept test-only (src/__fixtures__/path-gradient-vertices-candidate.ts, pinned in the span test). Other arrangements measured the same way (captures exact / fixtures / alpha-control ceilings exceeded): a single precision step added pixel by pixel from the left colour, 99.33% / 17, 70, 70, 74, 74 / 13; the same with the weights themselves accumulated (w1 += down(1/n), w0 -= down(1/n)), 99.37% / 16, 66, 66, 68, 68 / 17; the per-pixel l + (r - l) t, 99.08% / 11, 46, 46, 48, 48 / 14; the converter's 16.16 edges with the weighted span, 98.83% / 12, 52, 57, 50, 54 / 5; the 16.16 edges and span with the single precision step, 98.50% / 13, 54, 54, 54, 54 / 4. None keeps every control, and the fixtures and the independent captures disagree between them (the fixtures are 66 near-tie pixels, the captures 5,261), so there is a missing piece. What it is not: the destination format (the captures regenerated on a straight-alpha Format32bppArgb surface with SourceOver, generate-path-gradient-span.ps1 -Argb, are byte for byte the committed ones in all 273 opaque captures; only the 60 translucent ones differ, as stored), the premultiplication of translucent colours (nine single precision and double forms: 13 to 23 alpha ceilings exceeded for each; three integer-rounded forms: 120), the edges walked from the top or bottom vertex instead of in the order of the fan (734 to 1,897 against 562 wrong near-tie pixels), c / 255 normalised colours (every normalised form scores below the levels). What would decide it: the interior ties of the spans that are not flat (14,326 in the synthetic set). Those whose 16.16 step is exact (n divides the delta in 1/65536 units) native rounds up 8,181 times against 524 (94%), which the weighted form, whose weights fall short, rounds down; those of an inexact step go both ways (rising: 1,264 down, 1,119 up; falling: 2,429 up, 809 down), which a floored step rounds down. A single formula for the flat spans (equal ends weighted separately) and for these (the delta added, exact when the step is) is the missing piece; it is not one of the forms above.
      • Linear gradient origin (LinearRampOriginProbe.cs, linear-ramp-origin.json.gz, src/emf-plus-linear-ramp-origin.fixture.test.ts). The experiment prescribed for gpx-lin-sigma (a blend table question) turned out to be an origin question, and the table is not in it: the brush rectangle moved in 2^-16 pixel steps (2,049 steps, three scanlines, four brushes) reads the ramp origin u00 to one 16.16 unit at every step, because a pixel flips colour where its coordinate crosses a multiple of 256. The converter's rounded origin is native's at 97% of the steps of the 60 degree sigma brush (66 of 2,049 need one more unit, 109 pixels of 983,520 differ), 99% of the plain 60 degree one (26 steps, 59 pixels), 99% of a 30 degree one (19, 21) and all 2,049 of the sigma shape at 0 degrees. The correction is always +1, du and dv are right (a unit on u00 repairs every pixel of the step), the fractional part of the unrounded u00 is anywhere in 0.05 to 0.95 where it is needed (the 66 sigma steps need an offset of at least 0.83 of a unit and the ones that need none allow less than 0.0005, so no constant), the share of steps that need it follows N / w * 65536 (3.2%, 1.3%, 0.9%), and the 0 degree brush, whose matrix has no translation to round, never needs it. Evaluating the inverse matrix in single precision (three orders) or the closed form from the angle matches fewer steps (1,838 of 2,049 for the best single precision form against 1,983 in double). So the table is exact and the open item is a sub-unit offset of the rotated brush's translation; gpx-lin-sigma (2 pixels) and gpx-pen-lingrad (13) stay, as they were, and the converter keeps the nearest rounding.
      • Focus ramp on slanted edges: not run. The copy edges of an isotropic focus keep the round 6 and 7 rules; the per-pixel weighted result above says nothing about them (the chain there is a ray and a quotient, already float32 rounded down), and the data that would decide the DDA question for them is the integer-vertex sweep named at the end of item (a) of the path-gradient section above, not captured this round.
    • Round 9, workstream W5 (EMF+ gradients; the span and the edges of a per-vertex fan isolated, shipped, with one accepted trade: alpha control #137 is 1 pixel off).
      • Sources first. Microsoft documents the brush's meaning only (blend positions: 0 is the boundary, 1 the centre, PathGradientBrush::SetInterpolationColors, https://learn.microsoft.com/en-us/windows/win32/api/gdipluspath/nf-gdipluspath-pathgradientbrush-setinterpolationcolors); no Microsoft page found by search describes the rasteriser, its precision or its rounding, and a search for Microsoft patents on it found none. Re-implementations read as behavioural reference only: Wine's dlls/gdiplus/brush.c (https://raw.githubusercontent.com/wine-mirror/wine/master/dlls/gdiplus/brush.c) only stores a path gradient (colours as 32-bit ARGB, blend positions and factors as single precision REAL; the filling is in a file that was not read), and a gowemf pull request (https://github.com/mgilbir/gowemf/pull/35) notes that the boundary-to-centre parameter is affine inside each fan triangle. Neither says fixed or floating point; everything below is measured here, none of it is quoted from a source.
      • The span (PathGradientSpanProbe.cs RunGrid / RunGridColors, path-gradient-flat-grid.json.gz and -neg, src/emf-plus-path-gradient-centre.fixture.test.ts). The round 8 "flat" fans tied the span length n to the colour of the row (one n per row), so the interior ties could not be told apart. Here the right vertex is swept over whole and half pixels so that n and the exact half-level colour v (centre 64 or 192, rows 52 + 4 k, v = 64.5 + k or 191.5 - k) are independent: 600 fans per sign, 477 of them used (sweeps wider than 250 columns have x-major edges), 667,306 pixels each. A rising flat span (v > 64) rounds up at j >= 1 exactly when the odd part m of n divides 2 (v - 64) (659,630 of 659,630 pixels; the first pixel is always up), which is the condition that (v - 64) / n is a binary fraction, and the single precision form C + qa (n - j) + qb j with qa = qb = (v - 64) / n rounded toward zero, each product and the sum rounded toward zero and C + g rounded down, reproduces every one of them (the weighted ends of round 8 cannot, in any of the rounding arrangements tried: the rows of an even n that are entirely up leave 270 of the 6,228 distinct (v, n, j) cases of the old "const" fans wrong). So a span is measured from the fan's centre colour, not from its left end. Falling flat spans (centre 192) are up in 630,406 of 659,630 pixels and down in 29,224; the toward-zero form is up in all of them, so those 29,224 (4.4%) are not explained (they sit at small j for large offsets and at most j for small n, and no combination of the weight forms, rounding modes and orders tried reproduces them).
      • The edges (RunEdges, RunEdgesX, RunEdgesMid; path-gradient-edge-stage.json.gz, -x, -mid). A vertical or x-major left edge of S = 2 |b - a| steps makes every odd row a half-level tie, and the first pixel of a span is that edge's colour. All three kinds are again measured from the centre colour C, in single precision with every product and sum rounded down: an edge from the centre C + (P - C) down(k / S) (rising edges round down, falling ones up), an edge that ends at the centre C + (P - C) down(1 - down(k / S)), an edge between two vertices (C + (a - C) down(1 - t)) + (b - C) t. 49,464 rows (vertical), 7,336 (x-major) and 12,584 (between vertices, vertical and x-major) are reproduced with no row wrong; the k / S that is rounded down at 24 bits is the only reading found (a 16.16 integer form is wrong on 3,500 / 392 / 2,049 rows, a nearest fraction on 9,476 / 1,212 / 2,215). A probe of this kind cannot see a one-ulp deficit on an edge colour whose exact value is a whole level (it rounds to the same level), which is why the right edges below are fitted.
      • What the model gives (vertexGradientColorAt in src/emf-plus-path-gradient-vertices.ts). Measured stages as above, plus three settings fitted to the controls and captures rather than isolated: the premultiplied vertex colours floored to 1/65536, the right edge's sum rounded to nearest with a toward-zero product for an edge that starts at the centre and the weight down((S - k) / S) for one that ends there, and both edge colours floored to 1/65536 before the span. The 320 per-vertex captures rise from 171,194 to 172,969 of 174,084 pixels exact (98.34% to 99.36%; every group of the fixture test improves, rand 98.8% to 99.4%, randr 96.6% to 97.7%, shape 94.2% to 98.4%), report.ts takes grad-path-triangle-clamp / -tile / -flipx / -flipy / -flipxy from 13 / 54 / 54 / 54 / 54 to 4 / 16 / 16 / 18 / 18 differing pixels (max 1 level) and gpx-text-pathgrad from 67 to 30 (the other 904 comparisons are unchanged, 803 of 910 exact before and after), and the 240 alpha controls fall from 784 to 613 differing pixels in total, 55 ceilings tightening. Shipped on the owner's decision (16 October 2026), accepting that control #137 (one of the 80 with a focus of (0.75, 0.25), which native ignores) goes from exact to one differing pixel (its ceiling in path-gradient-color-bounds.json is raised from 0 to 1, every other improved ceiling is tightened, gpx-text-pathgrad text bounds 6.28% to 6.02% and 0.70% to 0.10%), (38, 45), channel red: an exact evaluation puts the pixel 3.1e-5 above the half level and the model 7.6e-6 above it, native rounds it down. Keeping the quantisation stages that fix controls #3 and #27 and trying the others (premultiplied colour floor 14 to 20 bits, edge floor 15 to 18, step floor, result floor, span order and the right-edge variants: several thousand settings) never reached zero controls over their ceilings; the nearest, one control over by one pixel, is the model above. A 16.16 integer reading of the whole pipeline (edges as integers, floored shifts, span by integer division) is exact on fewer captures (98.80%) and was dropped.
      • Linear gradient origin (gpx-lin-sigma, gpx-pen-lingrad; same 8,196 steps of linear-ramp-origin.json.gz). The origin u00 the converter rounds from a double precision inverse is one unit short on 111 of the 8,196 steps. Building the inverse of the composite Scale(w / N, 1) Translate(rect.x, 0) Transform in single precision (products and sums rounded down, division nearest) and taking the translation of the inverse as the origin is wrong on 27 of them (23 for the best per-stage choice: 9, 6, 2 and 6 for the sigma, plain 60 degree, 0 degree and 30 degree brushes), and puts two steps of the 0 degree brush, which the converter already has exact, one unit off, so the converter keeps the nearest rounding. The residue is therefore a rounding of the translation that depends on the order of the matrix products, not a constant offset.
      • Left open, in order of size. (1) Falling spans and the mixed-sign ones of the fan (the 29,224 pixels above; 1,802 tie pixels of the synthetic spans with a negative offset). (2) Control #137 and the right edges' fitted settings: an isolating probe would need a right edge whose exact value is a whole level and whose result reaches a tie in the span (spans of two to four pixels), read at more than one level of premultiplied alpha. Round 10 took the tile fixtures apart: grad-path-triangle-clamp's 4 pixels (and the same 4 repeated in the tiles, 16 to 18 in all) are all half-level ties of one channel, in fan 2 or fan 0: (35, 21) blue, span 8, centre 200, edge colours 75 and 81 (exact rationals; ours 74.99998 after the 1/65536 floor), exact value 76.5, ours 76.49999, native 77; (28, 30) blue, span 16, edge colours 120 and 132, exact 121.5, ours 121.5, native 121 (down); (37, 35) blue, span 20, ours 156.49998, native 157; (60, 46) green, span 20, ours 194.49998, native 195. So three of the four are native above our value by under 2e-5 and one is native below an exact tie, the same up/down split as the 5,383 ties of the 320 captures. The vertex-to-vertex left edge is not the cause: RunEdgesMidCentre (path-gradient-edge-stage-mid-centre.json.gz, 29,248 vertical-edge rows of which 14,704 are half-level ties, centre colour 0, 64, 200 and 255, covered by emf-plus-path-gradient-centre.fixture.test.ts) is reproduced by edgeValue for every row, so its centre-relative form holds away from the centre colour 128 of the round 9 probe. What is not isolated is a RIGHT edge with an inexact parameter (the right edge was only fitted: three of the four ties above have an inexact right edge or an inexact edge feeding a power-of-two span). A first probe of it (a fan whose left edge has one constant colour, read through two pixel spans) was dropped because the neighbouring fans of a thin fan overpaint the pixel read; it needs a fan whose centre lies inside a wide polygon (the geometry of Fan in PathGradientSpanProbe.cs with a right edge of a non-power-of-two height) and tie-rich colours, then a search over the right-edge forms on that data before the dataset. Nothing shipped. (3) The focus ellipse / triangle residuals (grad-path-focus-ellipse-* 8 to 35, grad-path-focus-triangle-* 2 to 15) and gpx-pen-lingrad (13) were not touched: they are the copy-edge DDA of an isotropic focus on slanted edges and the origin above.
    • compat-playback-r34-geosq9 (14 pixels, closed in round 7, G3). Native WidenPath of the sheet's RoundRect against the converter's outline showed the widener exact (feeding native's own unwidened GetPath of the four wide RoundRects, compat-playback-r34-geosq9-roundrects.json.gz, to widenPath gives all four outlines vertex for vertex) and the converter's path one FIX off at a corner end point (hy 85 native, 86 ours). The corner rule (compat-roundrect-sweep-probe, CompatPlaybackProbe.RoundRectSweep, compat-roundrect-sweep.json.gz, 107,520 native paths over seven maps that scale x, y or both, and compat-roundrect-modes-probe, CompatPlaybackProbe.RoundRectModes, compat-roundrect-modes.json.gz, 67,200 more over three graphics modes): GDI does not halve the corner's device extent. The half extent of a corner is round(hb * c / w): the half of the rounded device box extent H (ceil(H / 2) horizontally and for a clockwise shape vertically; floor(H / 2) for the vertical extent of a counter-clockwise shape and the horizontal extent under a mirrored x) times the call's corner extent c over its box extent w as a single precision ratio, rounded half up, the corner clamped to the box. It is exact for all 71,680 one-axis records (every one of the four corners) and all 67,200 mode records, including 32 exact-tie records of the dyadic 21/16 map that only the float32 ratio breaks the right way (31.5 falls to 31). That is why more than a hundred closed forms of the corner extent E topped out at 93%. The isolating experiments: the half extent does not depend on the box's position (sweeping the left edge by single logical units gives the same half extent for equal H; H takes two values per extent depending on the sub-pixel phase and the half extent follows H, not the phase); it is the same function in GM_COMPATIBLE playback under a map, in GM_ADVANCED under the same map and in GM_ADVANCED under a float world scale on an identity map (identical paths for 768 of 768 shapes in the first probe and for 5,600 of 5,600 at each of four scales in the committed one), so it is neither a compat-only effect, nor a 28.4 conversion at the map stage, nor a separate record-to-reference-device rounding (the playback frame ratio is 1 in the sheets); and the other axis' scale never matters. The converter takes it in roundRectCorners (a ratio), set by the RoundRect handler on the drawn box for an axis-aligned, non-inside-frame, non-grown shape. Result: compat-playback-r34-geosq9 14 to 0 and every unmirrored compat-playback sheet pixel-exact (24 to 0 pixels), the mirrored sheets 55 to 5, the shapes test 216 of 216 RoundRects exact with no mirror and under y and 144 of 216 under x and x-and-y (the rest inside-frame), 675 to 699 of 898 exact RGB comparisons in report.ts with no capture made worse. The earlier candidate that passed the exact device corner (round(E / 2)) had traded r107-geo5, r34-cosmetic and r34-dash for the fixed sheets; this rule loses none.
  • Round 8, workstream R8 (GDI geometry leftovers; 777 to 783 of 898 exact RGB comparisons in report.ts, nothing made worse).

    • Segments parallel to a nib edge under a mirrored x (compat-widemirror-poly3-p3-m 2, -poly3-p4-m 1, -poly4-p4-m 2 pixels, now 0). sheet-paths.ps1 -Lines now also captures Polygon and Polyline records. 17 of the 300 polygons of poly3-p3-m (and 188 of 4,000 random ones) differ from native WidenPath in their vertex sets, mostly in fill-neutral loops; every one that differs in fill contains a segment whose device vector is exactly parallel to an edge of the nib (all 34 fill-differing 3 unit triangles of 4,000; none without one), so compat-poly-widen-probe (CompatPlaybackProbe.PolyWiden, compat-poly-widen.json.gz: 400 random and edge-parallel triangles, quadrilaterals, three-point polylines and plain two-point lines for each of 6 kinds and the 3 and 4 unit pens under the 3:2 by 1:1 map mirrored in x, 4,800 native GetPath/WidenPath pairs) isolated the tie. A segment parallel to an edge touches two pen vertices and drawVertices picks the one further along the segment's direction normalised to point rightwards (downwards when steeper). Under a map that flips orientation the other end is native's choice, for steep and shallow segments alike: with that flip, all 4,800 outlines fill the pixels native's does (1,770 differed without it; the 4 unit pen's edge-parallel lines 400 of 400, the 3 unit pen's 143 of 400, the random polygons 1 or 2 of 400). The widemirror sheets are 28 of 28 pixel-exact (drawVertices, orientation-flipping matrix).
    • Rectangle stroked by a wide pen under a mirrored map (compat-playback-mx-r34-geo5 2 and -my-r34-geo5 3 pixels, now 0). The 5 pixels are the missing round-join corner pixels of Rectangle records (SheetPaths of the sheets' 44 records, widened outline against the converter's, one pixel set per record: only the Rectangle records differ, by exactly the sheet's pixels). The widener is exact on the path native reports (GetPath of a Rectangle under a mirrored x runs left to right from the bottom edge: the logical Rectangle mapped point by point), and its outline depends on the path's orientation at a round join (the four rotations of the forward path give native's outline, the reversed path leaves two vertices extra), but the converter handed a wide pen the device-positive box, the orientation of a cosmetic outline (the dotted start-and-direction rule). A non-cosmetic pen now strokes the mapped box (handleRectangle).
    • Inside-frame RoundRect under a mirrored x (emf-compat-playback-shapes, 72 of 216 under x and 72 under x-and-y, now 216 of 216 in every mirroring). Native GetPath (compat-playback-shapes.json.gz, 144 inside-frame RoundRects under the two maps) against the converter, vertex by vertex: the control points were one FIX off in all 144 (the horizontal controls round down under a mirrored x for every pen, but the inside-frame branch took ceil(KAPPA * hx)), and the 24 odd-width boxes (12 of 72 for each) still differed in the corner extent: the width made even upwards, w + w % 2, is made even downwards, w - w % 2, when x is mirrored (hx = round(c * (w - w % 2) / w / 2) against w + w % 2).
    • wmf-embedded-emf (16 pixels, not a hatch edge, now 0). The 16 pixels are the four corner pixel pairs of the RoundRect(60, 40, 180, 110, 20, 20) outline, not the hatch fill (the hatch pixels all agree). The reference PNG is the EMF's calls drawn straight onto a bitmap, but the WMF carries the recorded EMF and Windows plays that: native PlayEnhMetaFile of the recovered EMF (wmf-embedded-emf.recovered.emf, byte for byte the embedded one) differs from the direct drawing in exactly those 16 pixels (the recorded RoundRect corner of a playback is not the direct one, as for the compat-playback sheets) and the converter matches the playback in all 27,960 compared pixels. wmf-embedded-emf.playback.png is committed with a playback-references.json entry (emf: the staged recording, new in generate.ps1 playback-references); gdi-parity.fixture.test.ts drops the 0.0006 bound for exact, gdi-rotated-placement.fixture.test.ts pins the 16-pixel direct-versus-playback gap.
  • PS_INSIDEFRAME geometry follows GetPath captures (GM_ADVANCED for EMF, GM_COMPATIBLE for WMF, five and six scales, 1,200 boxes per shape):

    • The pen width along each axis, wx and wy, is its logical width times that axis' scale in whole FIX of a device pixel (not the isotropic width: 1,200 of 1,200 boxes against 664 of 1,200). A pen under 1.5 pixels along both axes (24 FIX) is cosmetic and leaves the box alone; a box narrower than the pen along either axis is drawn unchanged (EMF).
    • EMF Rectangle: the left edge moves in by ceil(wx / 2), the right by floor(wx / 2), the top and bottom by ceil(wy / 2) each. Every other box shape: floor on the left and ceil on the right (an odd width puts these edges on half a FIX; the Ellipse path is then the box [left, right] with its first half (points 0 to 5 and 12) one FIX to the right, exact for 127 of 127 captured odd-width Ellipses; the RoundRect's first corners follow the same shift except for the rounding of its four side points, correct in about two cases of three) and ceil(wy / 2) on the top and bottom. WMF (compatible mode, whole-pixel boxes): Rectangle left ceil(wx / 2) and right floor(wx / 2) of the pixel box, other shapes floor both sides, top and bottom ceil (WMF 1,200 of 1,200 boxes).
    • An EMF Arc, Chord or Pie measures its radials' angles on the box as given and carries them onto the framed box about its centre (the same rule as WMF; measuring them on the framed box leaves 0.7% to 1.2% of the pixels off). A RoundRect corner is scaled onto the framed box as floor(min(corner, box) * framed / box) from the unrounded corner and box extents (about 95% of the corner extents on GM_ADVANCED captures, 308 of 600 whole paths on the WMF scaled captures against 43 with the earlier pen-width model; the rest are a FIX off).
    • New capture group emf-insideframe (emf-insideframe-{rect,ellipse,roundrect,arc,chord,pie,polygon}: pens of 1 to 16 px, GM_ADVANCED, the Polygon as control; emf-insideframe-scaled: the shapes under a 1.37 world scale). The unscaled sheets are pixel-exact; the scaled one keeps 80 of 170,962 pixels (0.096% with the box rule alone).

Round 6: the rotated GDI pen ​

Captures (RotatedPenVectorProbe.cs, mode rotated-pen-vector-probe): rotated-pen-sweep.json.gz (a 100-unit segment at every whole logical degree under the identity, the 30 and 45 degree rotations and three mirrors, widths 8 and 16, flat, round and square caps: 12,960 outlines), rotated-pen-nibs.json.gz (round-capped, round-joined 40-unit segments in four directions, widths 5 to 40, under 14 rotations and scales and 10 general matrices: 864 nibs), tests src/gdi-rotated-pen-nibs.fixture.test.ts. The round caps of a long segment show the pen's polygon vertex by vertex, which the zero-length path of round 5's nib-angle-sweep.json.gz does not (that outline is a dot: it differs from the long segment's polygon, e.g. side vertices (0, -96) and (0, 96) where the polygon has (2, -96) and (-2, 96) at 1 degree and width 12).

  • The nib is an Ellipse box. The pen is the path of an Ellipse under the same matrix (ellipseBeziersBox, the rotated and skewed boxes of the compat Ellipse work) whose box is centred on the pen position and whose half edges are the images of the logical half width along the two logical axes, (m0, m1) * w / 2 and (m2, m3) * w / 2 in FIX; the first half of the path is flattened and the second half is its negation. Each component of a half edge is rounded to nearest with the tie moved down to a quarter: sign(v) * floor(|v| + 0.75). Evidence: 864 of 864 captured nibs exact, under rotations of 10 to 300 degrees at 0.75x, 1x, 1.5x and 2x, shears, unequal scales, a rotation with unequal scales and three mirrors (the three mirrors flip the second half edge: 108 mirrored nibs, 6,480 mirrored sweep outlines and 1,440 mirrored miter corners are exact); the bias is sharp (0.20 reproduces 433 and 0.30 reproduces 448 of 476 nibs of widths 7 to 40, 0.25 all of them; components at fractions 0.2499 and 0.2509 fall either side). Before: 30 of 476 (mapping the logical circle's Bezier points to FIX and rounding them, which also left every other construction tried at 44 to 56 percent of the vertices: mapped identity polygon, exact Bezier midpoints, floor/ceil/trunc of either, a matrix quantised to 6 to 20 bits).
  • The perpendicular keeps the identity pen's interpolation, with two changes under a matrix. (1) The half-unit bias follows the sign of the interpolated coordinate itself, opposite in x and y (it was the direction's sign; a nib can lie on the other side of the direction's normal under a shear or an unequal scale). (2) The further half unit of an odd pen edge is added for a support vertex in the first, explicitly flattened half of the nib and subtracted in the second (an identity pen has only vertex 0 in its first half there, which is what the old "first edge" test was). Evidence: 6,432 of 6,432 flat-cap corners of rotated-pen-vectors.json.gz exact (5,310 before; 5,608 with the nib alone), grouping all 12,864 coordinates by (axis, coordinate sign, odd edge, half of the nib, direction reversed) leaves a single bias that fits 12,862 of them (two coordinates of one group fit none), which is how the two rules were found.
  • Square caps extend by the device vector over the logical vector cut to whole units times half the width (the rule under a scale, cutToLogicalUnits, which playback already sets for undashed matrix pens): 1,440 of 1,440 square-capped rotated sweep outlines exact (1,407 with the extension computed from the real, uncut vector, whose errors sit at the rounding ties, about 0.03 of a FIX; no additive bias fits).
  • Results: the sweeps are 12,960 of 12,960 exact (flat, round and square caps, six matrices; before, the two rotations were 1,086, 0 and 1,062 of 1,440 for flat, round and square); general-matrix-pen.json.gz 504 of 504 outlines pixel-identical for the seven non-trivial matrices (matrices 0, 1, 5 and 7 had 620, 292, 554 and 416 differing pixels); bevel and miter joins under matrices 288 of 288 outlines (270 with 324 differing pixels with the nib alone; 221 and 2,055 before round 6).
  • Rotated arcs and the extension's ties. scaled-cap-sweep.json.gz and scaled-line-caps.json.gz under the 30 degree rotation: 358 of 358 swept arcs and 323 of 323 segments vertex for vertex (356 arcs before the tie rule; 94 with the exact vector). The two arcs left had a start tangent whose square-cap extension was a tie (-81.5 and -82.5 FIX); native rounds a tie away from zero once the device vector is cut to whole logical units, as it does for the non-matrix extension (squareExtension).
  • The miter limit under a matrix is tested in logical units. The tip's offset from the vertex is converted back to logical units, each component rounded to the nearest whole unit (both sides alike; the identity pen's test rounds device pixels, up on the left and down on the right), and the corner is bevelled when its hypot exceeds limit * w / 2 of the logical width. rotated-pen-miters.json.gz (RunMiters: 3,360 open corners of 20 to 175 degrees in steps of 5, limits 1.2 to 5, widths 6, 10 and 16, three rotations, a rotation with unequal scales and three mirrors): 0 corners wrong (137 corners and 7,112 pixels of the first 1,920, the non-mirrored ones, with the device-pixel test; exact, round, ceil, floor and trunc of the device offset, and the logical offset exact, ceil, floor, trunc and away, were all worse: 25, 44, 62, 83 wrong for the logical ones). 140 of the 3,360 outlines (corners of 160 to 175 degrees) differ from native by one repeated inner vertex, a zero-area spike. The 288-outline join sheet is exact for all eight matrices (the 18 outlines left at limit 1.5 were this test).
  • Open: nothing in the long-segment pen or its joins; the zero-length dot of a pen under a matrix (round 5's nib-angle-sweep.json.gz: 15, 22 and 13 of 360 angles exact at widths 12, 24 and 40) is a different outline from the polygon and is not modelled, and the 55 repeated inner vertices above.

Text ​

12 October 2026 follow-up: supplied-font EMF+ DrawString now decodes Unicode code points instead of treating each UTF-16 surrogate as a glyph. A generated CC0 font maps BMP and supplementary aliases to the same shapes; all 75 native Windows controls (five hints, three sizes) are RGBA-exact, up from 30. SVG preserves the supplementary character and one position per glyph. These controls isolate decoding and spacing, not shaping, fallback or color emoji. Current follow-up measurements are collected in Native parity review.

  • ClearType x hinting, size-specific SHPIX, and y DELTAP after IUP (round 5): the 3,720 captures of text-cleartype-sizes (generator TextClearTypeSizeProbe.cs, manifest environment-text-cleartype-sizes.json) show that native ClearType applies the x shifts that the Monotype-hinted faces (Arial, Times New Roman, Tahoma) issue with SHPIX, which the backward-compatible rule skipped, and ignores y DELTAPs once IUP[y] has run. Two rules shipped in src/ttf-hinting.ts. (1) Along x, SHPIX is applied for GDI+ ClearType (not for the GDI+ grayscale interpreter, whose 2,400 closed controls pin the skip) except inside the two generic per-size helper functions, recognised by their exact bodies (MPPEM >= lo and MPPEM <= hi: SHPIX and MPPEM == ppem: SHPIX; Arial fn52/fn53, Tahoma fn55, Times New Roman fn52); the mode-selected variants (the same body behind RS 2 / EQ, Arial fn85, Tahoma fn59), glyph-inline shifts and Times New Roman Bold's stem-compensation function fn32 are applied. (2) A DELTAP in y is ignored once IUP[y] has run, in ClearType and in grayscale; IUP[x] alone does not stop it, and SHPIX and MSIRP after the IUPs still move points. Exact captures per face of the 372 each, before the rules to after both: Arial 164 to 239, Arial bold 287 to 328, Arial italic 206 to 211, Times New Roman 116 to 147, bold 140 to 146, italic 104 to 112, Tahoma 190 to 251, Tahoma bold 272 to 274, Segoe UI 252 to 254, bold 284 to 285: 2,015 to 2,247 of 3,720 (2,193 after the SHPIX rule alone), with one capture lost to the second rule (Times New Roman Bold 17 px 2, below). The 832 contrast-0 captures of text-cleartype-coverage go from 288 to 352 (SHPIX) to 368 exact (Arial 16 I, g, 1, 4, 8 join v, 0, 2); the 3,328 grayscale text-coverage captures have 2,464 exact (2,400 before: Arial 16 S and 1 under AntiAlias, 32 each). The six ClearType and three grayscale fixtures improve (textx-arial-cleartype 5.163% to 4.693%, textx-plus-cleartype 10.216% to 9.694%, textx-segoeui-cleartype 4.041% to 3.694%, gpx-text-texture-cleartype 3.093% to 2.802%, gpx-rec-textcontrast-cleartype 4.008% to 3.331%, textx-plus-antialias 3.210% to 3.157%, textx-plus-antialiasgridfit 2.547% to 2.527%, textx-color-cleartype unchanged at 1.868%; bounds tightened). Both rules are proven on private fonts, not only fitted. build-shpix-fonts.py writes four fonts (shpix-a..shpix-d, CC0) whose glyphs are one stem shifted by half a pixel with SHPIX issued from 19 kinds of code, with the function numbers permuted between the fonts (text-shpix.json.gz, manifest environment-text-shpix.json, src/ttf-shpix.fixture.test.ts). All 228 ClearType captures (4 fonts x 3 sizes x 19 kinds) are pixel-exact, and the outcome follows the bytes, not the number: the range helper and the exact-ppem helper are ignored, called directly or from a wrapper function; the mode-selected helper (with the matching mode applied, with a mismatched mode not), a helper with only the mode test, with no test, with an unrelated storage read, inline range test and inline shift are applied; so is the range helper with two harmless instructions before or after it, with strict comparisons, without its ELSE branch, and the exact-ppem helper with a trailing instruction. Native therefore ignores exactly two function bodies, as it bypasses the TypeMan Talk functions by signature; why is not known. build-iup-fonts.py writes iup-a.ttf: a tall stem whose program touches the top point in y, runs IUP[x] and/or IUP[y] or neither, and moves the point up a pixel with DELTAP, SHPIX or MSIRP (text-iup.json.gz, environment-text-iup.json, src/ttf-iup.fixture.test.ts); all 30 captures (15 programs x ClearType and AntiAliasGridFit at 16 px) are exact. The top row moves for a DELTAP before the IUPs on a touched point, after IUP[x] only, and for SHPIX and MSIRP before or after both IUPs; it does not for a DELTAP on an untouched point, after IUP[y] (alone or with IUP[x]), after both IUPs on a point already moved by SHPIX, interpolation or rounding. FreeType's backward-compatible rule stops DELTAP only after both IUPs; native stops it after IUP[y]. Evidence from real fonts (scratch analysis, generator figures, not committed): a per-glyph subset search over the SHPIX-x calls of 11 face styles at 8 to 30 px (94 ASCII glyphs each) finds, for every glyph where some subset reproduces the native capture exactly, which calls must be applied: Arial fn85 179 must, 0 not; Times New Roman fn85 90 and 0; Tahoma fn59 154 and 0; glyph-inline calls of Arial Bold 68 and 1; Times New Roman Bold fn32 60 and 0; against the helper functions Arial fn52 1 and 100 (the one is a mask artefact), Arial italic fn52 0 and 161, Arial Bold fn52 0 and 26, Tahoma fn55 0 and 83, Times New Roman Bold fn52 0 and 17; the same search over the y DELTAPs that run after IUP[y] finds 2 must-apply and about 320 must-block. Over all 24,614 ClearType captures of that survey (11 face styles at 8 to 30 px plus the 832 committed ones) 11,956 are exact before, 12,385 after the SHPIX rule and 12,616 after both (232 more, 1 lost); over 21,620 AntiAliasGridFit captures of the same faces the y DELTAP rule gains 168 and loses none. The loss, Times New Roman Bold 17 px 2, is not the DELTAP: bisecting a private copy of timesbd.ttf through 87 truncations of the program shows the native image does not change at the final DELTAP (so native ignores it too), while the bottom serif's left tip sits one sample further left than ours (native y of point 2 is 14 to 20, ours 11 from the IP between points 1 and 23, unhinted 12), and the DELTAP our interpreter used to apply (+8, to 19) landed in that range by coincidence; the cause is in the interpolation chain, not found.
  • Grayscale lead from the SHPIX fonts (round 5): the same private-font captures through AntiAliasGridFit (hint 3, text-shpix.json.gz) show native applying the x shifts there too, with the same two helper bodies ignored (the 19 kinds at 12, 16 and 24 px all follow the rule; the engine skips every x SHPIX in GDI+ grayscale, HintedSize with grayscale), but real Arial Regular does not follow it at 18 ppem and up: applying the rule to the 21,620 grayscale captures of Arial, Times New Roman, Tahoma and Segoe UI (regular, bold, italic, 8 to 30 px, AntiAliasGridFit; generator figures, not committed) gains 94 captures (Arial Bold 50, Times New Roman 24, bold 12, italic 8) and loses 95 (Arial Regular 18 to 30 px: 0, 3, 5, 6, 8, 9, c, M, Y, y, w), so it is not shipped. Forcing storage 2 to 0, 1, 3 or 5 leaves the same 95 losses, and reporting GETINFO bit 17 (subpixel positioned) in grayscale loses 2,443 captures. What would decide it: how native grayscale evaluates Arial's fn133 and its mode table at 18 ppem and up.
  • ClearType dropout control (round 6, W1): the ClearType scan converter applies the font's own dropout control (SCANCTRL/SCANTYPE) to its 6 x 1 samples per pixel, as the monochrome and grayscale ones do. Before, ClearType ran with none; now rasterizeClearType passes dropoutMode(scanControl, scanType) of the grid-fitted glyph (simple, smart, and the stub-excluding types 1 and 5 that Arial, Times New Roman, Segoe UI, Courier New (1) and Tahoma (5) select) to the sweep, and a font that never runs SCANCTRL keeps none (the private diagonal, opcode and vector fonts pin that). Exact captures of the 3,720 in text-cleartype-sizes, per face before to after: Arial 239 to 288, Arial bold 328 to 328, Arial italic 211 to 264, Times New Roman 147 to 254, bold 146 to 208, italic 112 to 250, Tahoma 251 to 317, Tahoma bold 274 to 330, Segoe UI 254 to 325, bold 285 to 326: 2,247 to 2,890, with 645 gained and two lost (Arial 11px g, Tahoma bold 18px y: a thin tail end of our geometry that native's lacks, so the old rendering matched without the sample the dropout rule adds; the test records them as known losses). Courier New 886 to 1,043 of 1,976. With the storage 8 rule that followed, the pinned totals are 3,059 of 3,720 (2,369 before the dropout control: 692 gained and the two losses) and 1,114 of 1,976 Courier New captures (951 before); the project owner accepted the two lost captures for the gains, and they are pinned as known losses in src/gdiplus-cleartype-sizes.fixture.test.ts. The sheets move down a little (the parity test's own metric, bounds tightened): textx-arial-cleartype 4.693% to 4.648%, textx-plus-cleartype 9.694% to 9.581%, textx-segoeui-cleartype 3.694% to 3.670%, textx-color-cleartype 1.868% to 1.863%; the grayscale sheets and gpx-rec-textcontrast-cleartype are unchanged. All of the gain comes from the sweep along the sample columns (a thin span between two sample rows at a curve end or a tilted bar end): switching that sweep off returns exactly 2,247; the row sweep and the one-sample span tweak change nothing. The stub rule is FreeType's (a dropout at the tip of a contour is dropped) with one change, found by enumerating the dropout decisions of every capture (the decisions of each capture are flipped over all 2^K combinations, K up to 12, and the combinations that reproduce the native image are kept; 3,072 decisions are determined this way, generator figures): the exemption that keeps a stub when its profile is a tall overshoot (OVERSHOOT_TOP/BOTTOM with a gap of half a sample or more) is wrong, native excludes those 13 of 13 times, which takes the FreeType rule from 22 wrong decisions (99.3%) to 9 (99.7%). The exemption is dropped for ClearType only: removing it from the monochrome and grayscale sweeps moves the private polygon bitmaps of text-raster-mono (SCANTYPE 1 and 5, all sizes) by 524 gained and 400 lost exact bitmaps and Georgia's AntiAliasGridFit images by 6 gained and 2 lost, so those keep FreeType's rule. Of the 9 left, 5 are stubs native drops that no profile feature predicts (the 11 and 12 px g tail of Arial, two Times New Roman Italic B, the Tahoma bold y tail) and 4 are tips native keeps (Arial Italic 9 px n, y, 12 px 4, Times New Roman Italic 14 px f). Rules tried and rejected on the same decisions (mismatches among the 3,072 against 9): the contour-extent rule of the monochrome analysis with the extent in samples or pixels (36 to 499), both profiles starting at the scanline (19), either profile starting or ending (85 to 119), an exemption for gaps of half a sample (62); on the captures: the dropout mode of the font replaced by simple or smart for all faces (mode 0 loses 688 pinned captures, mode 4 loses 688, mode 1 loses 62, mode 5 loses 62), a dropout whose other candidate pixel lies outside the glyph box dropped (loses 248 of the gains), and no substitution of an out-of-box candidate (loses 137 of the gains). A fresh capture of text-cleartype-sizes in a new process differs from the committed one in 371 of 3,720 captures (Arial italic 128, Times New Roman italic 129, Tahoma 57, Times New Roman 38, Arial 19, none for Segoe UI: the diagonal-edge native-state difference again), neither of the two lost captures among them; the committed capture stays the reference. Fonts without SCANCTRL: native applies simple dropout control to them under ClearType up to 32 ppem and none above, as it does to monochrome bitmaps. Evidence (the private diagonal, opcode, vector-stage, alignrp-* and msirp-a captures; enumerating the dropout decisions of 148 captures at 16 to 32 ppem, best-effort over 2^K combinations where an exact match does not exist): every decision at 16, 23 and 32 ppem is a keep (442 of 450 keep) and every one of the 290 determined at 41 ppem is a drop; the alignrp-* captures (a sub-sample triangle apex and a zero-width line) are 60 of 60 exact with mode 0 or 4 against 4 without; over the 432 ClearType diagonal captures mode 0 at up to 32 ppem takes the exact ones from 91 to 217 and the differing channels from 30,686 to 23,177. It is not applied because 12 captures of the committed ceiling tests (movement:16:5:1, projection:23:5:1, vectors:23:5:1, three at 16 ppem of the first sets and six of the vector-stage sets) then exceed their ceilings by 1 to 255 channels, and a ceiling is never loosened. The cause is a corner decision: 7 of the 8 determined drops are dropouts in the column sweep at the bottom row where both profiles start at the column (an acute corner of a parallelogram stroke), which native drops in 7 of 18 cases (the drops have gaps of 0.16 to 0.36 of a row between the two crossings, the keeps up to 0.14 but for one at 0.33), and no profile feature tried separates them (profile heights, direction flags, gap, adjacency). Applying the default to the row sweep alone (smart mode) passes all 18 private ceiling tests and makes 56 of the 60 alignrp captures exact, but changes nothing in the diagonal totals (30,686 to 30,614 channels), so it is not worth shipping alone. What would decide it: ClearType captures of private glyphs shaped like one tilted bar end (a parallelogram) over a sweep of slopes and sizes of 12 to 32 ppem, to read the corner decision directly.
  • ALIGNRP around the IUPs (round 6, W1): build-alignrp-fonts.py writes four CC0 fonts (table layouts: prep and gasp, gasp only, prep only, neither) of one stem whose program touches points or not, runs IUP[x], IUP[y], both or neither, and aligns the top left point to a reference with ALIGNRP in y or in x, against touched and untouched references and points (15 kinds, text-alignrp.json.gz, src/ttf-alignrp.fixture.test.ts; 120 captures through ClearType and AntiAliasGridFit). Native honours ALIGNRP in all of them: the 13 single-axis kinds draw one identical triangle, before or after either IUP, so the round-5 lead (a y ALIGNRP after IUP[y] leaves the point where it was) is not a rule of the interpreter. Skipping those moves in our engine gains six Arial captures and loses none, but the private captures contradict it as a rule of the instruction, and the Times New Roman Regular bowl glyphs (B, D, O, P, R, 0, 8, 9, g at 9 to 15 px, 28 to 103 differing channels where Arial is within a few) have another cause, found in round 6 by tracing their calls: the corner points are put on a reference by ALIGNRP inside a helper called after the IUPs, and that block runs because the prep stored MPPEM <= limit in storage 8 (next bullet). A second finding: GDI+ AntiAliasGridFit does not run the glyph programs of a font without a gasp table (layouts c and d draw the plain stem for every kind), while ClearType runs them whatever tables the font has.
  • Storage 8 under backward-compatible ClearType (round 6, W1): backward-compatible ClearType (and the GDI+ grayscale text that runs the same interpreter) reads storage 8 as 0 wherever it is read. Before, it did so only inside two function bodies (ctBypassStorage); now every RS 8 returns 0 (src/ttf-hinting.ts). The Monotype fonts (Arial, Times New Roman, Courier New) end their prep with MPPEM GTEQ WS into storage 8, a flag that the size is small (Arial: up to 17 ppem), and their glyph programs read it after the IUPs (RS 8; JROF): at small sizes they run a block of calls that squares off the corners of bowls (SVTCA[x] SRP0 DUP ALIGNRP SVTCA[y] ALIGNRP collapses a curve point onto a reference in both axes; functions 6, 37 and 38, identical in all three fonts) and shifts points with SHPIX, then end with the IUPs again; larger sizes skip it. Native draws the sizes where the flag is set as if it were clear: Arial D at 14 px has its arc points 4 to 8, 10 to 13, 19 to 22 and 24 to 26 put on single corners by our interpreter (a square-cornered bowl) where native's bowl is round. Exact captures of the 3,720 in text-cleartype-sizes: Arial 288 to 314, Times New Roman 254 to 308, Times New Roman bold 208 to 297 (the others unchanged), 2,890 to 3,059, with none lost; summed over all captures the differing channels fall from 10,250 to 3,974 and the absolute error from 663,667 to 214,279. Courier New 1,043 to 1,114 of 1,976 (bold 320 to 364, regular 215 to 242). The grayscale text-real-glyphs captures (AntiAlias and AntiAliasGridFit, 14 face styles, 31,584) go from 14,607 to 15,050 exact (Arial AntiAlias 757 to 813, Times New Roman AntiAlias 651 to 847, Times New Roman bold AntiAliasGridFit 920 to 967 and AntiAlias 743 to 887, no face loses), textx-plus-antialias from 3.157% to 2.734%, textx-plus-cleartype from 9.581% to 9.236%, textx-arial-cleartype from 4.648% to 4.491% (bounds tightened); gdi-native-state.fixture.test.ts pins the per-product and combined counts of the differing captures at 1,541 and 775 (1,519 and 766 before the storage 8 and grayscale stub rules; 1,530 and 773 with the storage 8 rule alone). Storage 22 and 24 read as 0 everywhere changes nothing (they stay limited to their documented function signatures). Hypotheses rejected: skipping only the three corner-collapse helper bodies (6 more captures, 22% less error, and 24 Courier New Bold and Bold Italic captures lost), the GETINFO selectors 256 to 4096 reported as set for ClearType (bits 15 to 19: 2,173 to 2,508 captures exact), and the direction of ties in the 1/16-pixel x rounding (loses 1,628 to 1,637). What remains open: why native treats the flag as clear (the MS rasterizer probably never sets it for compatible ClearType); a private font that stores MPPEM <= limit in storage 8 and branches on it would confirm that the read, not the prep, is bypassed.
  • Grayscale stub rule (round 6, W1): the grayscale rasterizer (GDI GGO_GRAY4_BITMAP bitmaps and GDI+ AntiAlias and AntiAliasGridFit text) now applies the stub-excluding dropout types 1 and 5, which Arial, Times New Roman, Segoe UI, Courier New, Tahoma and most stock fonts select, as it already applied 0 and 4 (dropoutMode instead of grayDropoutMode, which is removed). The stub rule is FreeType's without its overshoot exemption, the one found for ClearType (the ClearType dropout control bullet above). Private polygon fonts: SCANTYPE 1 and 5 bitmaps at 8 to 32 ppem go from 2,344 to 3,106 and 3,147 of 4,096 (GDI grayscale and GDI+ AntiAlias alike; 579 to 778 and 782 of 1,024 above 32 ppem), 3,934 more exact bitmaps and images over the four stub sets and none lost; text-real-glyphs (31,584 grayscale captures) goes from 15,050 to 15,094 exact (Times New Roman only: AntiAlias 847 to 855, bold AntiAlias 887 to 893, italic AntiAlias 660 to 683, AntiAliasGridFit 960 to 963 and 967 to 971) with none lost. The round-5 figure that enabling FreeType's rule in grayscale loses exact real-font captures (including 64 committed Segoe UI Bold 12 px 2 controls) no longer holds, because the exemption was the cause. The monochrome rasterizer keeps the exemption (removing it moves 524 private-font bitmaps to exact and 400 away).
  • MSIRP distances under ClearType (round 6, W1): build-msirp-fonts.py writes a CC0 font of one stem whose program moves its top left point in y, or its top right point in x, with MSIRP to the outline distance plus a literal amount (-2 to +8 px along y, 0.25 to 4 px along x), at the default CVT cut-in (17/16 px) and at cut-ins the program sets (0, 8 px along y; 0.5 px and 1 px along x) (35 kinds, text-msirp.json.gz, src/ttf-msirp.fixture.test.ts). Native ClearType moves the point by the literal distance along y whatever the cut-in (up by 0.25 to 8 px and down by 2 px, with the default cut-in, with 0 and with 8 px), and along x only when the amount is within 1/16 of the cut-in (exactly at the boundary included: 0.5 px under a 0.5 px cut-in is honoured, 1 px is not; 1 px under a 1 px cut-in is honoured, 2 px is not). Before, the cut-in rule (the outline distance replaces a literal that differs by more than the cut-in) applied along both axes; now it applies along x only. Real fonts: 15 determined decisions (enumerating the refuse/honour decisions of the 49 captures that reach the rule over 2^K combinations; Arial k 9 to 13 px and Times New Roman Bold B, P) are all refusals along x, none along y, and the size sheet is unchanged (3,059 exact), so the earlier rule was right where real fonts reach it and wrong along y, which only the private font reaches. Removing the rule altogether loses 15 captures (3,059 to 3,044) and raises the absolute error by 55%. Open: native also draws the thin wedge of the slanted top edge (narrower than a sample) in the y kinds, which this converter does not for a font that never runs SCANCTRL (see the dropout bullet), so the y captures differ from ours in one row at the wedge although the point lands where native puts it; and x+16 cutin512 (a 1.25 px stem) is 129 levels of ink lighter than native's.
  • Courier New under GDI+ ClearType (round 6, W1): the system Courier New is drawn wider than its outline by GDI+ ClearType (TextClearTypeCourierProbe.cs, mode text-cleartype-courier, text-cleartype-courier.json.gz, manifest environment-text-cleartype-courier.json: four styles, 14 sizes of 9 to 30 px, 31 characters, plus six sixth-pixel origin phases of H E I T O n at 16 and 24 px; 1,976 captures, none exact before; 886 with the two rules below, 1,043 with the ClearType dropout control and 1,114 with the storage 8 rule of the previous bullets). Two rules, both in rasterizeClearType (src/gdi-font-engine.ts, clearTypeSpread). (1) Before the 3-tap filter every 1/6-pixel sample row is widened: a sample is on when any sample from two before it to one after it is on (regular and italic), from one before to one after (bold and bold italic); a 0.67 px H stem at 16 px becomes seven samples (1.17 px). Deconvolving the native values into subpixel counts shows binary samples with exactly this shape on stems, serifs and the diagonals of V at 48 px (left edge one sample left, right edge two or one right, whatever the slope), at every origin phase (the widening is on the placed lattice, not on the glyph), and a continuous model fitted to 300 stem edges of H I L gives the same pair (left 1/6 to 3/16 px, right 1/3 to 0.354 px, i.e. whole samples with a closed tie). (2) A filter output of one sixth (42) whose only source is a single sample in the neighbouring pixel is dropped (acc 1 across a pixel boundary), which is why a stem at a pixel edge lacks its faint tail; applied to Arial, Times New Roman, Tahoma and Segoe UI the same rule breaks pinned captures of gdiplus-cleartype-sizes.fixture.test.ts, so it belongs to this face. Exact captures: regular 242, bold 364, italic 242, bold italic 266 of 494 each (185, 313, 135 and 253 with the widening alone); the straight-edged glyphs E H I L T 7 of the regular and bold faces are exact in 237 of 248 captures at every size and phase (src/gdiplus-cleartype-courier.fixture.test.ts pins every exact capture). The behaviour keys on the family name, not the file (scratch captures, generator figures): a private copy of cour.ttf renamed to anything else renders unwidened, equal to our unwidened model, while the same file registered as Courier New returns the installed font (a glyph moved in the private copy does not move), and every variant of the renamed copy (no hinting program, no gasp, no embedded bitmaps, no hdmx/VDMX, no layout tables) is unwidened too, so the cause is not a font table. Hypotheses rejected: hinting x with the v35 interpreter or unhinted x (0 to 19 of the 434 base regular captures exact against 140 for the shipped model), a symmetric outline embolden of a quarter pixel (11 exact against 23 for the sample OR), a vertical shift of the sampling line (every shift of 1/16 px or more loses at least 80 of the 140), the bitmap strikes (bold has none), the post-IUP calls (D moves no point after its IUPs, and skipping a y ALIGNRP after IUP[y] leaves the regular-face exact count at 140). What remains is the curved edges: the inner contour of D, P, R, B, 0, 8, 9 is 0.1 to 0.4 px off native at the shallow arcs (for D at 20 px native's inner edge is 11/64 to 27/64 px further right at the upper and lower arcs), which is the interpolation class of the other faces, and the serif tips of italic rows. GDI's own ClearType of Courier New is not measured (TextRenderer ink in a scratch capture is wider than Arial's but the gamma differs); the rules are applied to GDI+ only.
  • Raster (.fon) faces (round 7, workstream E): the report rows textx-fon-system.regen (13,261) and textx-fon-fixedsys.regen (23,322) were a report artefact: report.ts rendered the regenerated references without the 8514 System and Fixedsys faces their session used; with 8514sys.fon and 8514fix.fon both are exact (0 of 300,480), as the regeneration test already asserted, and the originals stay exact with the fixture font set. The remaining residuals were not the integer-stretch limits the earlier notes assumed; they were three rules, each measured on native GDI (RasterStyleProbe.cs text-raster-styles: seven faces x seven heights drawn as "Hgy. a", " ", "H", "y" and "g" under every bold/italic/underline/strike-out combination, 3,920 captures; RasterMapperProbe.cs rows). (1) Face choice: GDI never stretches a face of at most 6 pixels (Terminal 4x6, Small Fonts 3x5 and 3x6) as readily as the cost model assumed: Terminal -30 and 30 draw the 8x12 face doubled (24 pixel cell, 16 wide), not the 4x6 face five times, and Small Fonts -15 and cell 15 draw the 4x8 face doubled and the 6x13 face unstretched, not the 3x6 or 3x5 face tripled, while Small Fonts cell 18 does triple the 3x6 face. An extra cost of 50 per squared extra factor on such faces fixes the 12 rows (6 heights at two weights) without moving any of the other 2,888 of 2,900 mapper rows (2,794 to 2,806 exact cell height and weight-400 width; Terminal is now 120 of 120 heights, Small Fonts 119 of 120, weight-700 heights 824 of 840 from 818). textx-fon-terminal 5,128, textx-fon-smallfonts 1,101 and textx-fon-smallfonts-cell 989 differing pixels become 0. The horizontal stretch (eyScale/exScale) was not involved. The mapper's choice is identical at 96 and 144 dpi (all 1,200 rows of raster-mapper.json recaptured at 96 dpi: 0 differ). (2) Bold italic: GDI slants the bitmaps and then emboldens them; on a stretched face (scale 2 or more) the bold slanted glyph sits one pixel further right, and the smear into the column after the glyph's last one is dropped where that column is a multiple of 8 (the packed row's byte boundary), so a narrow glyph's last stem stays one pixel wide on those rows. All 196 bold italic captures are exact with both rules (18 of the 49 "Hgy. a" captures were inexact before, 1,911 differing pixels in all). (3) Decorations: bars are laid out on the unstretched face and then stretched: floor(cell / 12) source rows thick (at least 1; MS Sans Serif cells of 25 and more are 2 to 3 rows), the underline starts one source row below the baseline (two when thicker than one row) and is pulled up into the cell when it would leave it (Terminal's 8 pixel cell), the strike-out top is ceil((ascent - internal leading) / 3) source rows above the baseline, and an italic strike-out bar is shifted right by the glyph lean at the middle of its top source row, floor(((2d - 1) * lean + span) / (2 * span)) for d source rows above the baseline (an underline is never shifted). All 3,920 style captures (every text, style and size) are exact; textx-fon-mssansserif-styles becomes 0 (from 43). src/gdi-raster-styles.fixture.test.ts pins them. lfWidth (round 8, workstream R6) is closed. The earlier cost tables failed because the mapper is not one search over faces and factors; it fixes each face's two factors first and compares one candidate per face. This was found by replacing the installed faces with private synthetic bitmap families (RasterSyntheticMapperProbe.cs, mode text-raster-synthetic, raster-mapper-synthetic.json.gz; bare .fnt files with blank glyphs registered FR_PRIVATE, read back with GetTextMetrics). The six installed families rebuilt from nothing but each face's cell height, internal leading, average and maximum width, weight and resolution answer exactly like the installed fonts (840 of 840 lfHeight x lfWidth rows per family, and all 140 wide heights per family), so nothing else about a face matters. Rules measured one variable at a time (src/raster-mapper.ts, header): (1) the horizontal factor is lfWidth / avgWidth rounded half up, 1 to 5, whatever else is installed (the old code rounded half down); with no lfWidth it is the vertical factor, at most 5; (2) the vertical factor is floor(request / unit) and one more when the face overshoots the request by at most floor(unit / 4) pixels (floor((unit - 1) / 4) for the step from 1 to 2); unit is the character height for a negative lfHeight and the cell height for a positive one; this reproduces the thresholds of 105 faces of 5 to 40 pixels exactly, and a face is never stretched beyond unit - 3 (faces of 4 pixels or less not at all); (3) the face with the lowest sum wins, in units of one pixel of lfWidth error: too small 3 per pixel, too big 12 plus 3 per pixel, a vertical factor n above 1 costs about n (2.1, 3.0, 4.1, 5.1 for 2 to 5; each inside a one-unit interval measured by exact pair comparisons), the horizontal error costs 1 per pixel, a horizontal factor that differs from the vertical one costs an aspect penalty affine in their ratio (about 8.7 times kx/ky when wider, 7.4 times ky/kx plus 0.3 when narrower; all 45 measured intervals of P(kx, ky) for kx 1 to 5 and ky 1 to 8 contain it), vertical factors 6 to 8 without an lfWidth cost 25, 35 and 41 (the horizontal factor stops at 5), a weight mismatch about a quarter of a pixel per 100 units plus half a pixel across the bold boundary, faces drawn for another resolution lose ties by 0.05; ties go to the earlier face. Results: Courier at lfHeight -6 to -12 takes the 9x16 face at lfWidth 12, 13, 20, 28, 29, 36 and 37 (the 8x13 face at the others) because the 9x16 face's factor is one below the 8x13 face's there and its error is at most 4; textx-fon-courier-styles 839 to 0 differing pixels (every other textx-fon-* row unchanged); of the 5,880 raster-mapper-widths.json.gz rows 5,477 are exact (3,818 before; 5,028 of the 5,040 non-Terminal rows), of 784 lfWidth style captures 746 (567 before, none lost), all 980 lfHeight 61 to 130 rows in height and width and all 840 bold heights (919 and 824 before), and every one of the 1,200 height rows of the 144 dpi capture (118 to 119 of 120 per family before). Against the synthetic captures: 99.3 to 99.8% of the six replica families, 3,195 of 3,200 equal-height pairs and 7,467 of 7,500 random four-face rows. Open: the remaining 0.2 to 0.7% are near-ties between faces at high vertical factors that the measured intervals cannot separate; the 391 Terminal rows and 38 Terminal style captures differ because native Windows maps Terminal over more OEM .fon sizes than the fixture font set supplies (an 8 x 8 face, for one), which is a font-set limit and not the rule; when a request is too large for the faces of a private family GDI falls back to another installed family (a 5-pixel face asked for 8 pixels returns Small Fonts metrics), which the converter does not model because it only ever sees one family. textx-fon-msshelldlg (84), -cell (34) and text-msshelldlg-hm13 (8) are not raster faces: Windows draws MS Shell Dlg with the Microsoft Sans Serif outlines, and the differing pixels are single rows of the diagonal glyphs (A V W X & %) at 20 pixels and above and one row of the g and y bowls at 13 pixels: TrueType hinting of Microsoft Sans Serif, which belongs with the TrueType hinting items above, not raster-face behaviour.
  • Open for ClearType glyphs (round 5): diagonal and curved edges still differ by one to a few samples (Arial 16 $, %, &, @, D, G, S, X; Times New Roman Italic 22 g, a, k, v, y, 2; Arial Bold 40 W, y: for Arial 16 X the native diagonal is steeper than ours, the top of the stroke about a sixth of a pixel to the left), which is interpolation (IP/IUP[x] and MDRP on diagonals) rather than stems. Courier New is closed for straight edges in round 6 (previous bullet). MSIRP: resolved in round 6 (the MSIRP bullet above). Post-IUP move kinds probed in a scratch private font at 16 ppem (y: SCFS, MIRP, MIAP, MDAP, ALIGNRP; x: SHPIX, SCFS, MIRP, MSIRP; each before, between and after the IUPs) matched native for all but ALIGNRP in y; the committed alignrp-* captures of round 6 (the ALIGNRP bullet above) show native honours ALIGNRP in every position, so the Times New Roman Regular bowl glyphs (B, D, P, R) have another cause: the storage 8 flag (the Storage 8 bullet above), which closed part of them (Times New Roman 254 to 308 of its 372 size-sheet captures) and leaves the rest with the diagonal and curved edges. DrawString layout is a separate error that dominated textx-plus-cleartype in round 5 (10.2% before that round, 9.7% after; 9.2% after round 6 by the parity test's metric). Round 6 (W2) re-measured the single-string placement family (src/gdiplus-drawstring-placement.fixture.test.ts): 96 of the 144 independent controls are exact and the other 48 are only the W and g glyph shapes, which differ by the same pixel count at both quarter-pixel phases and are not lowered by any whole-pixel shift of our output, so those controls have no placement defect. What follows is the round-5 measurement of the long ClearType string, which stays open: the glyphs of "GDI+ DrawString Ag 0123" sit one to four pixels left of native after "GDI+" (best whole-pixel shift of each word: 0, -2 and -4 px). Native ClearTypeGridFit glyph advances are whole pixels (Arial 16: A 11, H 12, I 4, Y 11, v 8, x, y, z 8, digits 9, i.e. the rounded linear advance, where this converter's hdmx advances give 9, 3, 7 for Y, I, x), and a string's integer advances are corrected so that the total follows the float layout (GenericTypographic: the rounded sum of the linear advances, as MeasureString reports; default format: 1.03 times that plus a third of the em), but the correction is not spread evenly: for a run of 40 n the typographic gaps are thirty-six of 9 px then four of 8, the default gaps ten of 10 px then twenty-nine of 9, a run of 40 H has twenty-two of 12 px then seventeen of 11, while a run of 40 I stays at 4 px with two or seven 5 px gaps at the end, far short of the 178 px that MeasureString reports (measured with GdipDrawString and GdipMeasureString on 1 to 60 repeats; scratch, generator figures). A rule that reproduces those distributions is the data the layout needs.
  • GDI ClearType ExtTextOut (round 7, workstream D): textx-arial-cleartype and its q0/q1/q2 variants are GDI ExtTextOut (not GDI+), with recorded integer dx, so placement is given and the error was raster. Four native stages were measured (probes GdiClearTypeBlendProbe.cs, GdiClearTypeRasterProbe.cs, GdiClearTypeCompatProbe.cs, GdiGetInfoProbe.cs; modes text-gdi-cleartype-blend, -raster, -compat, text-gdi-getinfo). (1) Blend: 6,873,600 native channel values (128 text/background pairs, three qualities) are reproduced exactly by gamma 1.2 (the system contrast 1200) tables rounded to 8 bits, a mix (dec[s] * k + dec[d] * (6 - k)) / 6 rounded half up over seven coverage levels, pixel-level rules (no coverage untouched, full coverage the text colour, a partly covered pixel round-trips its uncovered channels); the old float fit was one level off at two of the seven levels, 20,000 pixels of the Arial sheet. (2) Scan conversion (gdi-cleartype-raster.json.gz, private program-free fonts at 32 ppem): all 1,070 bars, slanted edges and doubly fractional bars are exact once rows are sampled five per pixel, weighted 1 2 3 2 1, wherever gasp has GASP_SYMMETRIC_SMOOTHING (Arial 1 to 8 and 18 up, Segoe UI 1 to 8 and 20 up; none in between, which is where the row character of the sheets changes). 256 random polygons differ by 397 isolated pixels of 43,544. (3) Sizes whose gasp range lacks GASP_GRIDFIT (Arial 8 and below) are drawn unhinted and unscaled (the 8 px line: 573 to 45 differing pixels). (4) CLEARTYPE_NATURAL_QUALITY runs without GETINFO's compatible-widths bit and matches native at 9 to 17 px (ctnatural lines 1 to 8: 2,100 to 270 pixels). Against native playback (*.playback.png, merged from the rotated-text workstream; the direct-drawing PNGs differ from playback by 503 and 39,661 pixels, see above): textx-arial-cleartype/q0/q1/q2 22,224 to 11,370 of 727,818, textx-arial-ctnatural 46,228 (against the direct drawing, which cannot be matched from the recording) to 4,428, textx-segoeui-cleartype 26,464 to 10,988, textx-color-cleartype 1,761 to 871. Still open: default-quality (backward-compatible) hinting differs from natural by whole 1/6-pixel stem shifts and 1 to 2 sample stem widths (Arial l at 20 px: native 9 samples, ours 8; n at 15 px both stems one sample left), unchanged by interpreter version 35 to 40, by the compat flag, by scaling the natural outline to the black-and-white advance (fits: best uniform scale reproduces few glyphs exactly) or by forcing the phantom advance; GdiGetInfoProbe.cs and build-getinfo-font.py are committed to read the native GETINFO answers directly and were captured (gdi-getinfo.json.gz, src/gdi-getinfo.fixture.test.ts): native GDI ClearType reports compatible widths at qualities 0 and 5 only and symmetric smoothing (bit 18, which the converter does not report: setting it worsened Arial 11,327 to 14,955 pixels); version 40 vs 41+ and bits 10 and 11 change nothing. Diagonals (Arial v, x, y, A, V, W, X) remain the round-5 interpolation residual. Not touched: GDI+ ClearType (textx-plus-cleartype, gpx-rec-textcontrast*, gpx-text-texture-cleartype, textpb-segoeui-cell-q3) keep their numbers; long DrawString spacing remains open.
  • GDI+ text (round 9, W2): sources used, separated as the brief asks. Documented by Microsoft: the ClearType white paper ("Backwards compatibility of TrueType instructions with Microsoft ClearType", https://learn.microsoft.com/en-us/typography/cleartype/truetypecleartype) specifies the compatibility rules already in the interpreter (SHPIX and DELTAP skipping, unrounded MIRP and MSIRP honouring the cut-in, RDTG after SPVTL on the physical grid, 1/16 virtual grid rounding, SCVTCI / 16 and SMD / 2 in the ClearType direction, GETINFO bits 13 to 16): every one is implemented, and none distinguishes the diagonal cases (ctDirection variants below). Not found: any Microsoft statement of how GDI+ lays out, rounds or blends text. Only search-result summaries of the TextRenderingHint page (https://learn.microsoft.com/en-us/windows/win32/api/gdiplusenums/ne-gdiplusenums-textrenderinghint), the antialiasing-with-text page (https://learn.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-antialiasing-with-text-use) and KB 307208 (mirror: https://ftp.zx.net.nz/pub/Patches/ftp.microsoft.com/MISC/KB/en-us/307/208.HTM) were seen, which describe the hints and the default format's extra 1/6 em at each end, not any arithmetic; none was read in full. Not used: Wine, ReactOS, libgdiplus and FreeType sources were not read; nothing was ported. Measured here: everything below, with committed probes. (1) Advances, not hinting. A probe of repeated glyphs drawn at sixteenth-pixel origins (SingleBitAdvanceProbe.cs) shows that unhinted DrawString advances a glyph by round(hmtx x 1.03) font units (Arial l at 16 px: 469 units = 3.6641 px, where the 26.6 linear advance times 1.03 is 3.6613 and accumulated 0.003 px per glyph): the round 8 "mispositioned clusters plus dropout singles" of textx-plus-singlebit were this. Only at an identity world transform (the scaled-alignment controls regress otherwise): textx-plus-singlebit 125 to 30, textx-plus-antialias 556 to 42 with the bars. (2) Underlines. UnderlineProbe.cs (8,000 captures: five faces, underline / bold / italic / strike-out / both, 20 sizes, 16 origin phases) fits the vertical rule to every capture (see Text) and shows the coverage is four sub-scanlines by eight horizontal samples (32 levels), not contrast-adjusted, drawn as a second pass over the glyphs (1 - (1 - g)(1 - b)); a one-row bar's ends depend on the sub-scanline (profiles such as 5, 7, 6, 4 eighths for the four sub-scanlines of a pixel, shifting by 2 for the next size) and no threshold model reproduces them (50% of 68 profiles at best), so they use fitted offsets; the grid-fit hints draw the same extent rounded to whole pixels (one pixel each in four fixtures). (3) ClearType blend. ClearTypeBlendPlusProbe.cs (80 draws of the same strings over flat backgrounds; black on white at contrast 0 yields each channel's coverage) shows the blend is 8-bit table arithmetic with exact sixths of coverage, not the float mix (72.8% of partially covered samples before, 99.6% after; the first-order bias of the float mix was 127/255 against one half). gpx-text-texture-cleartype is now exact. (4) Playback stretch. scripts/gdi-fixtures/patch-text-scales.ts: with every eyScale of textpb-segoeui-cell-q3.emf set to its exScale, native PlayEnhMetaFile draws exactly the direct drawing (0 of 2,102,400 pixels differ, 4,050 unpatched), so the stretch is read from the record and round 6's "the playing device's own scales" was wrong; the converter applies it for Segoe UI (the "window" rule of round 8, all 10,660 native outcomes agree): textpb-segoeui-cell-q3 4,095 to 93. textx-segoeui-cell-mono is compared with its native playback reference (48 pixels; 989 from the old direct-drawing PNG, as the playback itself is). Calibri-like faces follow the "integer" rule and Arial, Tahoma and the other stock faces change by the x scale alone: not modelled, none occur in the fixtures. Side finding: native PlayEnhMetaFile of an EMF+-only recording onto a bitmap DC draws nothing on this machine (build 26300), so the gpx-* and textx-plus-* references are direct drawings. Diagonal stems (still open, negative results). The ClearType-direction test (|pvx| > |pvy|) was replaced by the freedom-vector direction, by an exactly-x projection vector, by their conjunction and disjunction, and by never / always, separately for rounding, the cut-in and the minimum distance: the production rule is the best of every variant on the 3,384 Arial AntiAlias real-glyph captures (2,996 exact; the nearest alternative, the freedom vector for rounding, 2,972, and gains no capture). Truncating division on x moves along oblique projection vectors ends 134 to 184 captures of the same set lower even when restricted to oblique vectors or to MIRP (the W call site fits it; I, H, n do not), and moving by the truncated, floored or ceiled difference between the target and the unrounded current projection in MIRP and MDRP (the reading of the round 8 observation that native behaves as if the current distance were 70 below the original and 71 above) ends 169 to 182 lower, with only the rounded delta equal to production. The native outputs of the captures are not a pure function of the font, size and hint (round 5 and 8: two states, 2,492 of 31,584 captures differ between runs of one machine), which a stateless converter cannot reproduce; this is the open part of W, k, y, v.
  • GDI+ text (round 10, R10-B): SHPIX along x. Bucketing first. The 302 pixels of gpx-rec-textcontrast were 61 per string in one glyph, the Arial Bold 40 y (both arm tops a quarter pixel from native: left arm 0.25 px left, right arm 0.25 px right), plus 14 single pixels per string (W 5, k 5, y 2, and the 2 of the last string 7). Native redraws of the case (AntiAliasGridFit and ClearTypeGridFit, same code as GdiFixtures.cs) were byte-identical to the committed PNGs on this machine today, and a fresh text-coverage capture differs from the committed one in 64 of 3,328 (606 on 8 October), so the residual is not native state. Mechanism. Prefix copies of the glyph (build-hint-prefix-font.py, one variant per instruction boundary, drawn natively by a scratch copy of TextShpixOrderProbe.cs and compared with the converter variant by variant): y agreed for the first 97 variants and diverged at the four inline SHPIX[x] of its glyph program (+16, -16, -16, +16 on points 3, 1, 0, 4, all touched in both directions, after both IUPs); fitting those four x positions on the fixture alone gave exactly -16, -16, +16, +17 (302 to 62). The converter skipped every x SHPIX of grayscale text (!this.env.grayscale in the SHPIX keep rule), which was calibrated before GDI+ grayscale was known to run the ClearType interpreter (round 8). Rule shipped (HintedSize.plusShpixX, HintEnvironment.shpixX, LogFontSpec.unscaledText, set by the EMF+ text handler at an identity world scale only): a shift made by a function call applies (the generic per-size helpers stay excluded); an inline shift applies to a point touched in exactly one direction, or in both once both IUPs have run, or in neither after both IUPs when it moves at least 32/64 px (Arial Bold 2, 40 ppem: 328 differing pixels to exact over 32 captures per hint, prefix copies exact from that instruction). Results (src/gdiplus-shpix-x.fixture.test.ts): text-real-glyphs 17,014 to 17,409 exact of the 31,584 captures (with this machine's fonts), none lost; text-coverage Arial Bold 40 y 2,056 to 60 differing pixels per hint (the 2 captures 328 to 0), no glyph worse; fixtures gpx-rec-textcontrast 302 to 48, gpx-text-lingrad 79 to 3 (no pixel more than one level off), gpx-text-texture 76 to exact, gpx-text-pathgrad 30 to 15 (one level); 910 report lines compared with a baseline from the same head with the rule switched off, none worse; gpx-rec-textcontrast-cleartype (76), textx-plus-* unchanged. Held out, with the evidence. Not applying the rule at a non-identity world scale: with it the seven uniformly scaled alignment controls W (Arial 16 at scale 0.75: 73 against a ceiling of 69, 74 against 71, 73 against 70) and Courier New Italic 24 at scale 0.6 (W 57 against 56, AV 175 against 174 and 176 against 175) exceed their ceilings, although the same W at 12 px unscaled improves from 25 to 6 differing pixels in a prefix copy; the native scaled W is not the unscaled 12 ppem shape (that control is about 70 pixels from native with or without the rule). Inline shifts of untouched points under half a pixel (Courier New R 22: -8/64; three phases 16 to 17 differing pixels) and of points touched in both before the IUPs (Times New Roman Italic T 22: +6/64; textx-plus-antialias 42 to 48 and textx-plus-antialiasgridfit 13 to 17) also improve their single-glyph prefix copies (20 to 15 for T, 16 to 15 for R) but cost pixels in situ, so they stay out; applying every x SHPIX is the branch r10-gdiplus-text-candidate (17,466 real glyphs exact, gpx-rec-textcontrast 48, the two textx-plus ceilings of gdi-parity fail). Other rules measured and rejected on the same sets (exact real glyphs, 17,014 base, 17,409 shipped): applying only to points touched in y 17,089; to points touched in either direction 17,359; quantising the shift to 1/16 px (round, ceiling, truncate, floor) 17,261 to 17,279, to 1/8 px 17,171 and to 1/32 px 17,448, against 17,466 unquantised (applying every shift); ignoring inline shifts of at most 8 or 15/64 px 17,426 or 17,414 but a Courier New italic a 30 and an italic AV 13 control exceed their ceilings (and z 16 at 8); per-product projection rounding for the whole grayscale interpreter (the experiment of rounds 8 and 9, now with this branch's fixtures): gpx-rec-textcontrast 302 to 262, textx-plus-antialias 42 to 29 and -antialiasgridfit 13 to 5, but 29 tests of 13 files fail (private-font controls pin combined rounding), consistent with the closed "native state" finding; ROUND/NROUND on the physical grid instead of the 1/16 grid in x: gpx-rec-textcontrast 830, textx-plus-antialias 84, -antialiasgridfit 53. What remains of gpx-rec-textcontrast (48): W 5, k 5 and y 2 single pixels per string (12 per string over four strings), each exactly one coverage level (one of 16 samples). For the W at all 16 quarter-pixel phases (4 or 5 differing pixels each) the sample is 0.14 to 0.44/64 px inside an edge of our hinted outline and native leaves it out, i.e. a hinted point about 1/64 px off, the round 8 observation about function 20 MIRP (70 against 71) rather than a scan-conversion rule: a coarser crossing grid in the sweep (2^-12, 2^-10, 2^-8 and 2^-6 of a sample: 5, 6, 6 to 7 and 13 to 14 differing pixels against 5) does not fix it. Not examined: the one-row underline bar's ends, the Times New Roman monochrome serifs of textx-plus-singlebit (30, all isolated single pixels in the bucket) and the g shape of the 48 placement controls. A ClearType-direction note: gpx-rec-textcontrast-cleartype (76) and textx-plus-cleartype (26) go through the non-grayscale branch, which already honoured inline x SHPIX; their buckets are isolated one- and two-pixel components (44 and 11 components).
  • GDI+ text (round 11, R11-C): DirectWrite's ClearType arithmetic for installed fonts (default for installed fonts: GdiFontCollection option installedFonts, HintEnvironment.dwriteArithmetic). Native functions read (DWrite.dll, public PDB names): itrp_Project / itrp_OldProject (each 26.6 x 2.14 product rounded alone, (p >> 13, +1, >> 1), then summed), ComputeAndCheck_PF_Proj (the freedom/projection dot product the same way, |dot| < 0x400 replaced by +-0x4000), itrp_SPVTL / itrp_SDPVTL / itrp_SVTCA_* / itrp_WPV (the ClearType-direction flag +0xcc is set when the vector is set: in backward-compatible ClearType every vector except exactly y, a diagonal one included, where the converter used |pvx| > |pvy|), itrp_MIRP, itrp_MDRP, itrp_IP, itrp_IUP, itrp_MovePoint (all agree with the converter's existing steps), itrp_Normalize / DWRITE_FracSqrt (no effect found). Probes (this machine, build 26300): PrefixGrayProbe.cs (GDI+ draws of instruction-prefix fonts, private collection or per-user install) and OutlineProbe.cs (GetGlyphOutline(GGO_NATIVE), which turned out to follow the grayscale GDI interpreter whatever lfQuality, so it is no oracle for ClearType hinting). Result: with both rules, committed text-real-glyphs 17,409 to 19,494 exact of 31,584 (2,091 gained, 6 lost: Times New Roman Italic 11 V, Times New Roman Bold 24 y x2, Tahoma 18 K x2, Arial 10 w), text-coverage 2,592 to 2,914 (352 gained, 30 lost: Arial 16 y, one pixel), text-origin-phases and -vertical-phases 1,408 to 1,536 each (every grayscale capture; 0 differing pixels), text-cleartype-sizes 3,079 to 3,324 (247 gained, 2 lost: Arial Bold 14 R, Arial Italic 14 n). Fixtures (full report against ee0eb73, none worse): gpx-rec-textcontrast 48 to 0, gpx-rec-textcontrast-cleartype 76 to 44, textx-plus-antialias 42 to 12, -antialiasgridfit 13 to 5, -cleartype 26 to 11, textx-arial-* (GDI ClearType, cc rule) 3,886 to 3,576 and textx-arial-ctnatural 663 to 297; exact fixtures 831 to 832. Private fonts: private-collection and per-user-installed copies of the same Arial bytes render differently at 16 px (y, v, W, k; deterministic within a process), and the private-font diagnostic fixtures (diagonal, opcode, signed, vector-stage, renamed Courier) pin that other arithmetic; the converter cannot tell the two from the buffers, so installedFonts defaults to true (a collection of system fonts) and those fixtures pass { installedFonts: false }. Made the default (owner-accepted trade) on the combined tree (R11-A and R11-B merged), measured on r11-text-trades: exact captures text-real-glyphs 17,411 to 19,496 of 31,584 (2,091 gained, 6 lost: Arial 10 w AntiAlias, Times New Roman Italic 11 V AntiAlias, Times New Roman Bold 24 y both hints, Tahoma 18 K both hints), text-coverage 2,592 to 2,914 (352 gained, 30 lost: Arial 16 y AntiAlias), text-origin-phases and -vertical-phases 1,408 to 1,536 each, text-cleartype-sizes 3,079 to 3,324 (247 gained, 2 lost: Arial Bold 14 R, Arial Italic 14 n; Tahoma Bold 18 y, the old dropout-rule loss, is exact), text-cleartype-courier 1,119 to 1,341 (223 gained, 1 lost: Courier New Italic 12 f phase 0), Courier New grayscale 4,861 to 5,328 of 6,400 (regular text-real-glyphs set 1,779 to 1,885 of 2,256; two ceilings raised by one pixel: Courier New 15 k AntiAlias 6 to 7, 16 w AntiAlias 21 to 22), Georgia 1,060 to 1,118 grid-fitted and 784 to 901 unfitted of 1,128, gdiplus-drawstring-placement 96 to 140 of 144 exact (only Arial 40 g x4 left), DrawString mixed strings 25 to 33 of 150 exact (34 ceilings lowered, 2 raised: Courier New 12 H I n x 0 default 175 to 176 and IIIHHHnnnxxx000 609 to 615), DrawString cell baseline 841 to 885 of 2,320 exact (47 gained; 3 lost, 0 to 2 pixels each: Tahoma 19 Ag default and typographic, Courier New 25 Italic Bold H typographic; 387 ceilings lowered, 184 raised of which 92 now exceed the pre-feature baseline, so those before values were raised with them), alignment controls (emf-plus-text-alignment, -scale) 198 ceilings raised (Arial 36, Arial Italic 73, Courier New Italic 12, Times New Roman Italic 59; scaled Arial 6, heldout Arial 12; no capture that was exact lost; every raised ceiling is listed by git diff of text-alignment-bounds.json, text-alignment-scale-bounds.json, text-drawstring-baseline-bounds.json). Fixtures (full report against the merged round-11 baseline, none worse, exact 884 to 885): gpx-rec-textcontrast 48 to 0, gpx-rec-textcontrast-cleartype 76 to 44, textx-plus-antialias 42 to 12, -antialiasgridfit 13 to 5, -cleartype 26 to 11. The studies that patch the legacy interpreter from outside (ttf-diagonal-projection, gdi-native-state) now run it with installedFonts: false. Caution found on the way: the first capture after an idle period is a different native state (a fresh text-real-glyphs capture right after idling preferred truncating x movements, 18,785 exact; two later captures are byte-identical to each other and agree with the committed set); recapture twice and use the second. Open: the x-move rounding is round-half-away in every stable-state event checked (events solved glyph by glyph for Arial 16: all), although itrp_MovePoint reads as a truncating division; residual glyphs under the model: Arial Bold 40 W (about 14 px per capture), 4 (7), k (3), Arial 16 y (1) and w.
  • GDI+ text (round 8, R2): the stages were separated with native probes of GDI+ itself (TextAdvanceProbe.cs text-advances, GdiGetInfoProbe.cs text-gdi-getinfo, TextShpixOrderProbe.cs text-shpix-order, plus scratch private copies of Arial whose glyph programs were truncated or instrumented). (0) Stability: three fresh-process playbacks of gpx-rec-textcontrast.emf are identical to each other and to the committed reference from the second process on; the first process after an idle period differed in 78 of 68,400 pixels (up to 68 levels), so the committed references are the stable state and the residuals below are not run-to-run noise. The TextContrast mapping is exact: every pixel the fixture still differs in (302, all in the W, k and y glyphs) is a diagonal-stem shape, the other glyphs match at all four contrasts. (1) Placement: AntiAliasGridFit advances a glyph by the width GDI's own interpreter reports, not the ClearType interpreter's phantom point that the glyph shapes come from (Arial Bold 40 px: W 39, I 10, v 21, w 31, where the ClearType phantom points round to 38, 11, 22, 32; GetCharWidth32 and the native runs agree, 1,085 of 1,093 whole-number glyphs of text-advances.json.gz). That was the whole of textx-plus-antialiasgridfit (513 to 14 differing pixels) and most of gpx-rec-textcontrast (1,994 to 854) and the brushed gray text fixtures. ClearTypeGridFit's default format advances a glyph by the ClearType interpreter's phantom-point advance rounded to a pixel (1,230 of 1,230 whole-number glyphs; the GDI widths used before match 1,058): textx-plus-cleartype 2,013 to 361, gpx-text-texture-cleartype 531 to 161, gpx-rec-textcontrast-cleartype 3,407 to 1,898, and the 2,320 ClearType baseline strings 792,198 to 633,491 differing pixels (173 better, none worse). GenericTypographic keeps the GDI widths: the same advances cut its 75 mixed strings from 39,867 to 22,277 pixels but worsen six, whose end-of-run compensation is not modelled (native run gaps for repeated glyphs change by one pixel over the last floor(grid width - ideal width) glyphs; a model with that contraction, and an expansion past one em, worsened twelve other captures). Synthetic italic faces keep the GDI widths. (2) Raster: GDI+ grayscale text (AntiAlias, and AntiAliasGridFit where gasp smooths) runs the ClearType interpreter and answers GETINFO as gray ClearType: ClearType (selector 64) and 4096 set, grayscale (32) not, at every size (gdi-getinfo.json.gz now holds the SingleBit, SingleBit gridfit and AntiAlias hints). The converter reported grayscale, so prep programs picked another branch: 15,747 to 17,113 of the 31,584 text-real-glyphs captures exact with none lost (Segoe UI 1,099 of 1,128 under both hints), Georgia 1,042/736 to 1,053/782. The generic per-size SHPIX helper functions (MPPEM >= lo and MPPEM <= hi: SHPIX) shift a point only when it is touched in y and stop once IUP[y] has run (private fonts shpix-order-a.ttf: 32 of 44 captures exact, src/ttf-shpix-order.fixture.test.ts); Arial Bold's W calls them after both IUPs to lower its inner apexes two pixels at 26 to 58 ppem, which native does not do: 64 more exact text-coverage captures (2,464 to 2,528), 17 more ClearType size captures (3,059 to 3,076), five more Courier New ClearType ones (1,114 to 1,119). (3) Brushed text: the lingrad, texture and pathgrad fixtures differ from native only where the glyph coverage differs (339/337/161 to 79/76/67 pixels after the above); no combine rounding was found to be off. (4) Single bit: textx-plus-singlebit (125) is unchanged: three mispositioned clusters plus dropout singles; the 1/128 advance quantisation stays rejected. Also: a near-aligned italic face with a vertical alignment is laid out like the upright faces (144 of the 1,296 italic alignment controls improve, none worsens). Candidates measured and not shipped: (a) SHPIX along y without the touched-in-y requirement for ordinary (non-helper) functions: native does it in all six private kinds that differ (untouched points, before or after the IUPs), and it adds 182 exact real-font captures (Courier New, Times New Roman, hint 4) and 117 Courier New ClearType ones, but it improves 61 of the 2,320 ClearType baseline strings (298 pixels) and worsens 45 (101 pixels), and worsens five more gray alignment controls by a pixel (Courier New and Times New Roman Italic AV), so it stays out of production (the converter keeps the rule and the test pins the six kinds). (b) Per-product projection rounding now wins on the committed text-coverage captures too (192 against 94 matching the committed images of the 606 that differ, 1,691 against 851 of the real-glyph ones) and closes Arial Bold 40 W and k, but still loses the 30 Arial 16 y captures and eight real-glyph ones, so it remains excluded. (c) The remaining diagonal-glyph residual (Arial 12 W 26 pixels, 11 to 13 ppem half the Arial and Tahoma glyphs under AntiAlias) starts at one instruction: truncating Arial's W program after each instruction and reading the native result, the first divergence is function 20's MIRP[00100] after SDPVTL[1] (the diagonal stem width cvt 23 and its inputs match native exactly); native moves the point as if the projected current distance were 70 for a target below the original distance and 71 above it, where ours is 71 (exact 70.64); measuring it from the dual projection or from the original-vector projection fixes this instruction and loses 1,028 and 2,798 real-glyph captures elsewhere. The instruction itself is pinned by a native digital readout (a glyph copy whose program ends with IF Q == k and an SCFS jump, one variant per k, reads any stack value or point coordinate exactly): cvt 23, the current distance (-71) and the cvt reads agree with ours, and the move of the point is mulDivGdi(distance - curDist) (GDI's truncating division on the x move along an oblique projection vector) for each of 61 swept targets at W's call site and 29 at three of w's four call sites at 12 px (the fourth call site's prefix already differs), and for every one of the 449 truncated programs of Arial's w at 20 px when MDRP distances along a diagonal are also left unrounded; the same two rules lose 1,072 real-glyph captures and gain 67, because the MDRP rounding along a diagonal differs by glyph (Arial v at 20 px matches all 179 truncated programs with the rounded distance and the GDI division, and breaks at the 127th with the unrounded one), so the converter keeps its arithmetic. (d) AntiAlias underlines are fractional in native (thickness in quarter pixels: 0.75, 1, 1.5 or 2 px, positions between the integer rows), where the converter draws an integer bar: about 170 of the 556 differing pixels of textx-plus-antialias; not modelled.
  • GDI ClearType compatible widths (round 8, R1): the default-quality stem shifts of round 7 are an interpreter rule, found with private fonts (build-cleartype-width-fonts.py, build-cleartype-phantom-font.py; probe GdiClearTypeWidthProbe.cs, mode text-gdi-cleartype-width, gdi-cleartype-width.json.gz, manifest environment-text-gdi-cleartype-width.json, src/gdi-cleartype-width.fixture.test.ts): eleven sets of one-instruction glyphs (a bar or stem whose edges one known instruction places) drawn at default and at natural quality, 4,209 glyphs each at 16 ppem, so the only difference between the two drawings is the width mode. (1) A program-free bar, and a bar placed by MDAP, MIAP, MDRP (rounded or not) or a MIRP from the origin phantom point, is identical at both qualities; the advance phantom point itself sits at the black-and-white advance (ALIGNRP, MDRP, MSIRP and MIRP from it land at BW - the outline distance, 544 of 544 pp2 glyphs exact; the old converter instead scaled the whole natural outline by BW / natural advance, which is wrong for a program-free bar). (2) A MIRP or MSIRP between two glyph points shifts both points, and every point already or later aligned to them by ALIGNRP, MDRP, IP or SHP, by (centre of the pair) * (BW / natural advance - 1) with the centre from the original outline; the sweep over 17 advances and 96 left edges in 1/128 px steps (1,632 glyphs) is reproduced exactly, the shift of a stem with the position (196 of 196) and the carried offset of a stem anchored to the advance point (a single-contour H chained from pp1: 23 of 27 exact; on Arial H the native shift equals the pair formula, not the anchoring) too. Points placed relative to the advance phantom point carry its offset, which the pair's shift replaces; pairs are the two sides of a stem (the segment between them runs through ink, at least a quarter pixel apart: a counter between two stems, and a hook tip next to its stem, do not shift). (3) Fonts report GETINFO bit 18 (symmetric smoothing, selector 2048) from the size's gasp range, not at every size: with it Arial's natural quality is exact for 349 of 420 captures (320) and the diagonals that were the round-5 interpolation residual (v, x, y, A, V, W, X) match natively (textx-arial-ctnatural 4,034 to 687 differing pixels); round 7 had tried the bit at every size and found it worse. Results: textx-arial-cleartype/q0/q1/q2 11,272 to 7,146 of 727,818, textx-segoeui-cleartype 10,981 to 4,372 of 719,390, textx-color-cleartype 867 to 595; exact default-quality captures of the 420 per face: Arial 81 to 146, Segoe UI 71 to 135, Tahoma 56 to 126; differing pixels over the 420: Arial 6,296 to 3,324, Segoe UI 4,686 to 2,622, Tahoma 5,112 to 4,103. The trade: of the 1,260 default-quality captures of gdi-cleartype-compat.json.gz 259 become exact and 60 stop being exact (Arial 81 gained and 16 lost, Segoe UI 86 and 22, Tahoma 92 and 22; none was pinned by a test; natural quality gains 72 and loses none); every textx ClearType fixture improves. Tried and rejected: setting storage 2 to 2 or GETINFO bit 13 clear in the prep (default quality worse everywhere), shifting by half the advance difference (right only for a stem near the advance's centre), scaling each scanline run (9,141 against 6,296 differing pixels), using the natural hinted advance for the ratio, and rounding shifted points to the 1/16 grid. Open: the MIRP-to-stem classification and the followers of a stem for diagonal glyphs ('V', 'W', 'X', 'x', 'A': the apex or crossing point moves by about a tenth of its arms, ours by the arms' amount) and for 't' and 'g' at 24 px, Arial 11 to 16 px, where the compatible-mode SHPIX tables apply; private fonts: native clips a bar moved past four pixels at 24 samples (phantom, flags and follow sets) and draws a faint extra top sample row for 72 types glyphs (MIRP from pp1 then a rounded MDRP) at both qualities.
  • GDI ClearType past the stem (round 9, W1): research first, then private fonts. Documented by Microsoft ("Backwards compatible ClearType", https://learn.microsoft.com/en-us/typography/cleartype/truetypecleartype): the TrueType interpreter runs a backward-compatibility mode for fonts that have not set INSTCTRL selector 3: DELTAP and SHPIX are skipped except on points already touched in the non-ClearType direction (and in composite glyphs), "a post-IUP delta occurs after the IUP instruction", RDTG after SPVTL rounds on the physical grid, unrounded MIRP and MSIRP honour the CVT cut-in, rounding in the CVT program uses the physical grid, and legacy TypeMan Talk helpers are bypassed through storage 8, 22 and 24; GETINFO reports ClearType (bit 13), compatible widths (14), symmetric smoothing (15) and BGR (16). The paper calls compatible widths "a technique which is not related to the issues being discussed" and says nothing about what that mode does to a glyph program. FreeType's v40 interpreter documentation (https://freetype.org/freetype2/docs/hinting/subpixel-hinting.html) says it "ignores all horizontal hinting instructions", leaves advance widths alone and drops the "dirtiest hacks", so it models none of this; no FreeType, Wine or ReactOS source was read or used. Every documented rule that matters for the three Windows fonts was already in src/ttf-hinting.ts (rounds 5 to 8); the stem shifts of the width mode are not documented anywhere that was found, so the rest is measured here, with four private-font sets (build-cleartype-arm-fonts.py, mode text-gdi-cleartype-arm, gdi-cleartype-arm.json.gz, src/gdi-cleartype-arm.fixture.test.ts, 765 glyphs at 16 ppem in both qualities) and with copies of the Windows fonts whose glyph programs were truncated after every instruction and captured one by one (Arial 'V' and 'W', Tahoma 'V' and 'y', Segoe UI 'H'; not committed, they are derivatives of the system fonts). (1) A stem the program sets after IUP[x] is never shifted: 108 of 108 private bars whose MIRP pair follows IUP[x] (alone, or with IUP[y] before or after) are identical at default and natural quality, the 81 whose pair comes first or follows only IUP[y] are not; in the truncation series of Tahoma 'V' (whose diagonal caps are set after both IUPs) the captures from the second post-IUP MIRP on match native only without the shift (0 against 38 differing pixels). (2) The shift acts on the outline while the program runs: a point that MDRP places from a shifted stem point under a projection vector set perpendicular to the arm (SPVTL[1] or SDPVTL[1] on the arm's edge) follows by the share of the shift that its height along the arm gives (0 at the foot, the whole shift at the stem; the height set), under an axis projection vector it follows by the whole shift, and the dual vector of SPVTL comes from the original points like SDPVTL's (the arm set). (3) With the shifts in the outline, the absolute measures a program takes (MDAP and MIAP rounding, GC, MD, the ratio IP interpolates) must see the outline without them: MDAP rounding, MD / GC and the IP ratio each gain on the 3 x 420 Windows-font captures (MIAP is made consistent and changes nothing), none isolated by a private font yet. Two commits implement them, (1) alone and (2) and (3) on top of it, on the branches w1-candidate-postiup and w1-candidate-immediate-shift; production keeps the round 8 rule because both trade a few exact captures: (1) alone makes Tahoma 'W', 'y', 'A', 'V', 'X' and 'v' exact more often (126 to 132 of 420 default-quality captures, 4,103 to 3,041 differing pixels; Arial and Segoe UI unchanged, no report fixture changes) and costs one capture (Tahoma 'y' at 20 px, 3 pixels; keeping post-IUP shifts of at most 2/64 px would keep it, at 130 instead of 132 exact, but native cannot tell: the private bars show no shift below 1/16 px, postsmall); (1) to (3) take the 1,260 default-quality captures from 410 to 457 exact (Arial 149 to 179, Segoe UI 135 to 138, Tahoma 126 to 140) and from 10,029 to 8,209 differing pixels, 54 gained, 7 lost (Arial '$' and '%' at 12 px, Segoe UI '@' at 10 and 'r' at 16 and 18, Tahoma '3' at 9 and 'y' at 20: 1 to 4 pixels each), natural quality unchanged, textx-arial-cleartype/q0/q1/q2 7,127 to 6,036 differing pixels, textx-color-cleartype 595 to 498, textx-segoeui-cleartype 4,372 to 4,264, the other 904 fixtures unchanged (803 exact before and after), the private rects set 31 to 33 of 36 and the arm and height sets 126 to 189 of 224 and 171 to 268 of 288 default-quality glyphs. Tried and rejected, with the experiment that rejected them: a width limit or a slope limit on what a stem is (the chain pairs of 'V', 'W', 'X' and 'x' between a valley and an arm top, 4 to 7 pixels wide and steep, are not shifted by native, but no limit on width, slope, em fraction, CVT use, MIRP flags or pv separates them from the real stems without losing more elsewhere: labelling each pair of Arial on or off by the native capture takes the glyphs that have pairs from 2,507 to 1,553 differing pixels, so the classification is worth about a third of what is left); making a point that already has a shift of its own keep it (Arial 2,699 to 2,959 differing pixels); one-sided IP shifts (a point between a shifted and an unshifted reference takes the shifted one's whole shift: right for Segoe UI 'r', wrong for Arial 'W' at 18 px); intersecting ISECT lines on the unshifted outline (Arial 'X' and 'x' 178 and 166 to 319 and 227 pixels); quantising shifts to 1/16 pixel (Arial 3,304 to 4,420). Open: which MIRPs native counts as a stem (above), 't' (two flat caps native does not shift), Arial 11 to 16 px SHPIX tables, Segoe UI 'm', and the remaining 'V' (357 differing pixels over the 14 sizes).
  • GDI ClearType stem pairs (round 10, R10-A): the round 9 stem shifts applied to every MIRP pair; the pairing is now measured. Method: private zigzag ribbons (V and W at 32 ppem, build-cleartype-chain-fonts.py, mode text-gdi-cleartype-chain, ctc-chain.json.gz, src/gdi-cleartype-chain.fixture.test.ts, 576 glyphs; natural quality 540 of 576 exact) and, uncommitted because they are derived from Microsoft fonts, Arial glyph-program prefix fonts captured after every instruction (build-hint-prefix-font.py through GdiClearTypeWidthProbe.cs, 9 glyphs at 28 and 36 px), whose first divergence names the instruction. Findings: (1) a MIRP is a stem only when its distance type is black (flag bits 0 and 1 = 01); across the 16 flag values 0xF0 to 0xFF, 0xF1, 0xF5, 0xF9 and 0xFD shift and the other twelve do not, whatever the min-distance, rounding and set-rp0 bits (Arial's rotated-vector MIRPs, op 0xE4, are not stems; its chain MIRPs, 0xFD, are); (2) a point that already belongs to a stem pair is not the first edge of another: along a chain the pairs 1, 3, 5 shift rigidly by centre x (BW / natural - 1) and pairs 2, 4 do not, and the point of a later MIRP from a paired reference scales with its own x (Arial W 4 arms, X's four arms from the central crotch; the synthetic W and V with a 3 px bearing fit native exactly to the 1/64 px for 0xFD, 16 to 18 of 24 for W). Shifts under 4/64 px keep the old behaviour (that keeps every previously exact capture exact). Result: textx-arial-cleartype, -q0-default, -q1-draft, -q2-proof 6,034 to 3,886 differing pixels each (W 1,800 to 774, V 493 to 134, A 233 to 124, X 560 to 376), textx-color-cleartype 498 to 340, textx-segoeui-cleartype unchanged at 4,264; the other 904 fixtures unchanged (819 of 910 exact before and after); compat captures Arial default quality 183 exact (from 180) and 2,698 to 1,976 differing pixels, Segoe UI and Tahoma unchanged. Ruled out: pair-centre taken from hinted instead of original points (cur centre: Arial fixture 3,955 and 36 more exact captures but 10 exact captures lost; kept out), quantising or thresholding shifts, an unshifted measure in rotated-vector MIRPs (worse everywhere), deferring the shifts to IUP[x] (worse), the natural-run hinted centre. Open: the shift scale is the hinted advance (pp2 after the program), not the whole-pixel BW, when a MIRP to the advance phantom point leaves it fractional (synthetic 0xF1 with pp2: 73 of 192 exact; the shift scale takes the hinted advance, not the LTSH or head.flags linear advance (the private chain fonts clear head.flags bit 4: native GetCharWidth32 says 36 while the shifts follow the hinted 37)); a first corner exactly on the origin (bearing 0) shifts 4/64 px less than the centre rule; Arial W's remaining 774 px start at MDRP/IP steps after the chain (pt 8, 17, 24 at 72 px follow 21's shift in the converter and not in native: the MDRP and MIRP distances of non-stem points look at unshifted positions in native, which as a blanket rule loses more); Segoe UI's residual (4,264) is the centre formula of 'm' and curved stems (native-minus-model spread of 3 units rms against 1.6 for Arial), not the pairing.
  • GDI ClearType, read from fontdrvhost.exe (round 11, R11-A): native functions read: AddDistance, AddProportion, DoubleCheckLinkColor, IndirectlyDependsOn, PhaseShift, ExecutePhaseControl, itrp_MIRP/MDRP/MSIRP/ALIGNRP/IP/ISECT/SHP_Common/SDPVTL/SPVTL/SPVTCA/WPV/RDTG/IUP/DeltaEngine, ulClearTypeFilter_6x5/6x1 (tables at rva 0xa6720, 0xa6f70, 0xa60c0, 0xb1330..0xb1540). Mechanisms, each confirmed against native captures (private-font sets of rounds 7 to 10 and the Windows-font captures gdi-cleartype-compat.json.gz), not against the disassembly alone: (1) Phase control replaces the stem shifts. While a program runs, MIRP, MSIRP, MDRP, ALIGNRP, IP, SHP and ISECT only record which point each was placed from (twelve bytes per point: two reference points, a stem partner, flags, a cached shift); the program sees the unshifted outline. At the first IUP[x] (or at the end of a program without one) the table is resolved once: a point takes its reference's shift, a point between two references the truncated interpolation by original x, the two sides of a stem (adjacent contour points with ink between them, or a black-typed MIRP/MSIRP) move together by round((x1 + x2) (S - 1) / 2) with S the black-and-white over the natural advance in 16.16, phantom points carry round(2 x (S - 1) / 2), and any dependency cycle switches unlinked points to their own proportional shift. The advance phantom point stays at the natural advance. Nothing is linked after the first IUP[x]. This reproduces rounds 8 to 10 as consequences (post-IUP stems unshifted, black-only MIRP stems, alternating chain pairs) and replaced their model; the old pairShift/carry code is gone. Details found on the way: SPVTL and SDPVTL record their two points for MDRP/ALIGNRP (a point whose font-unit x lies between them is linked as an interpolation), ISECT links to the steeper of its two lines, rounding the shift half way up/down and the interpolation by truncation are required (round or floor: default-quality exact captures fall from 403 to about 320). (2) The ClearType-direction flag is "the projection vector is not exactly the y axis", kept from the last SVTCA/SPVTCA/SPVTL/SDPVTL/SPVFS, not "points mostly along x". It selects the 1/16 rounding bank, the cut-in, the minimum distance and the link recording; Arial compat captures go from 393 to 411 of 420 exact at natural quality (161 to 12 differing pixels) and 382 to 403 at default (172 to 42). Applied to GDI ClearType only (see below). (3) DELTAP in compatible ClearType applies only along the exact y axis (or in composites), on points touched in y, before IUP[y]. (4) Vertical filter. ulClearTypeFilter_6x5 weights the five sample rows 4 9 10 9 4 (not 1 2 3 2 1), rounds the sum over 36 (steps at 18, 54, ... 198) and snaps level triples a single row cannot produce to a reachable one with a 343-entry table (src/gdi-cleartype-levels.ts, 1.2 KB); 256 random polygons 397 to 340 differing pixels. The blend stage (gamma 1.2 tables, seven levels) was already exact. (5) Scan conversion. GDI ClearType rounds the on-curve point implied between two off-curve points on the oversampled grid, uses exact arcs and inks closed horizontal ties (rasterizeSamples(..., roundImpliedPoints) in src/ttf-raster.ts, GDI ClearType only); the three together take Segoe UI natural from 355 to 396 exact. Not a mechanism (tried): native curves are Bresenham-style exact walks in fsc_CalcSpline, so flattening steps do not matter (fine arcs alone 917 to 913 pixels). Results: textx-arial-cleartype and q0/q1/q2 3,886 to 218 differing pixels, textx-arial-ctnatural 663 to 201, textx-segoeui-cleartype 4,264 to 261, textx-color-cleartype 340 to 145; compat captures (420 per face) default/natural exact: Arial 183/349 to 403/411, Segoe UI 138/349 to 400/396, Tahoma 140/368 to 401/406; arm set 190 to 218 of 224, height set 268 to 287 of 288, rects 33 to 36 of 36, h 23 to 27 of 27. Open: Arial 12 and 13 px a, e, s, o at default quality only (first divergence is the first stem MIRP[0d] of the program, a pair across two contours whose shift native does not take; natural quality exact), Segoe UI @, 3, 0, Tahoma $, s, @ and the remaining 10 natural-quality curved glyphs. GDI+ ClearType (accepted trade, re-measured on the combined tree): the new direction flag (ctFlag) for GDI+ was measured against the DirectWrite rule that R11-C gives installed fonts (not exactly y, ctCompat only) and the earlier test (|pvx| > |pvy|) that private fonts keep, in four combinations (neither, installed only, private only, both): the full 910-fixture report is byte-identical in all four (885 exact), and so is every pin that could be compared (private-font diagonal, opcode, signed and vector-stage coverage: 9,664 captures, same differing-pixel count and sum for every capture; Courier New grayscale 6,400 + 2,256 + 1,600; the DrawString cell baseline 2,320 captures: 885 exact and 631,461 differing pixels in both the DirectWrite rule and the flag). The full suite (before the re-pin) fails the same assertions with the same reported values in all four. With R11-C on, the flag rule changes nothing measurable, so the code keeps the DirectWrite rule for installed fonts and the earlier test for private fonts (ctDirection); the two string ceilings the standalone candidate raised (175 to 176, 609 to 615) are raised by R11-C itself and are pinned at those values.
  • GDI ClearType, default quality, Arial 12 and 13 px a, e, o, s (round 12, R12-CT-default). Closed: the residual was not a stem pair. Ruled out first: fontdrvhost.exe itrp_MIRP, DoubleCheckLinkColor (two points on different contours get the instruction's own distance type, so there is no "no pairing across contours" rule), PhaseShift, ExecutePhaseControl and the end-of-program call in Execute match src/ttf-hinting.ts; making linkColor return 0 across contours takes Arial default from 403 to 296 exact of 420 (Segoe UI 400 to 311, Tahoma 401 to 334). Isolating probe: build-cleartype-contour-fonts.py (mode text-gdi-cleartype-contour, ctk-contour.json.gz, src/gdi-cleartype-contour.fixture.test.ts): 1,020 private glyphs at 16 ppem, a ring and an eight-point oval (outer and inner contour, only the four extreme points touched, IUP[x] interpolates the rest) and a one-contour bar, black MIRPs from pp1 and pp2, with and without an x SHPIX on the outer edge first (amounts 0, +14/-16, +22/-16, +8/-8), advances 6 to 7 px in 1/16 steps, three stem widths, two left edges, at default and natural quality. The converter is exact for all 1,020 at both qualities, so neither "inner edge scaled by S" nor "SHPIX before the MIRP changes the shift" is real (the earlier prefix captures were misleading because --replace variants take another glyph slot's hdmx advance; with hdmx, LTSH and VDMX removed and the glyphs appended, Arial o, e, a, s prefix variants at 12 and 13 px are exact up to the end of the x and y hinting). The mechanism: the first variants to differ are the four CALLs at the end of Arial's o (SVTCA[y] then four calls of the mode-selected SHPIX helper after both IUPs; e and a first differ at calls as well). They shift points by 24/64 px along y that carry no touch flag (interpolated by IUP[y]). Native applies them at default quality (compatible widths) and leaves them at natural quality; the converter's rule (SHPIX along y only on points touched in y) was measured at natural quality. The generic per-size helpers (isSizeTweak) stay ignored after IUP[y] in both modes (Arial m, n, 1, v: applying those too takes 403 to 392 exact). The code reads SHP_Common: along y it applies when a state byte is non-zero, or else only to points with the y touch bit, which fits a mode-dependent byte; the byte itself was not traced. Result: in shpix the y rule is touched in y, or (after IUP[y], compatible widths, not a generic helper); Arial compat captures at default quality 403 to 408 exact of 420 (42 to 18 differing pixels), Tahoma 401 to 404 (42 to 33), Segoe UI unchanged at 400, natural quality unchanged; textx-arial-cleartype, q0, q1 and q2 217 to 193 differing pixels, no report comparison worse. Open: Arial u and W at 12 px (2 pixels each), the curved natural-quality glyphs, and which native state selects the untouched-point rule (it is not read, so the gate is the compatible-width mode).
  • GDI ClearType at natural quality (round 12, r12-ct-natural): the remaining curved-glyph differences were the scan converter, not the hinting (private fonts made of our hinted outlines, text-gdi-cleartype-hinted). Native walks each arc on differences rounded to 2^s (s from the arc's size) after cutting it at its extrema, and decides dropouts from the recorded crossing pairs; both reimplemented from fontdrvhost.exe (details in parity-notes, Text). textx-segoeui-cleartype 261 to 32, textx-arial-ctnatural 200 to 73, textx-color-cleartype 145 to 141; exact comparisons unchanged. Left: smart-dropout pixel of some small Tahoma curves, Segoe UI 12 px A, exact ties.
  • Unresolved differences: ClearType, EMF+ antialiased text and TextContrast retain the fixture residuals above. PolyTextOut C1 suppression is fixed; the remaining 12 pixels in its original fixture and three pixels in the Arial C1 controls are glyph-edge differences. Courier C1 controls are exact.
  • Fonts in fixtures: runner fonts can differ from original captures. New captures include font hashes and native library versions. Current native fonts exactly reproduce the three textx-plus antialias/ClearType PNGs; other old captures still lack complete provenance.

12 October follow-up to the historical results below: native family-specific Courier New AntiAlias widening is now implemented for regular/italic, untransformed, nonsynthetic faces. The original regular-face AntiAlias set improves from 0 to 653/1,128 exact; 657 additional fresh controls become exact. Monochrome neighboring-square stub decisions and 26.6 smart midpoint selection improve 4,587 controls for straight, single-contour outlines. Curves/multiple contours retain the prior rules. No previously exact control is lost in the new comparisons; five Courier and twelve independent/held-out monochrome cases have small, individually documented increases. Long ClearType spacing remains open: both advance/compensation candidates were rejected after native mixed-string regressions. See Native parity review for complete counts and scope.

Grayscale hinting and scan conversion (round 5, V1, 8 October 2026) ​

12 October continuation, Courier curve/sample staging: no production candidate passed preservation. On the 6,400 Courier style/size/origin controls, interpolating IUP in scaled coordinates loses 1,224 previously exact controls and a 16.16 interpolation ratio loses 135. Finer/coarser conic subdivision and rounded conic splits also lose exact controls; truncated or unrounded splits change nothing. The existing 653/1,128 regular AntiAlias exact captures and five small historical tradeoffs remain unchanged.

Fresh courier-geometry controls use two CC0 generated fonts with identical program-free quadratic bowls, concave polygons and rectangles, differing only in names (Courier New/Parity Courier). All 3,200 full surfaces are bounded individually in gdiplus-courier-geometry.fixture.test.ts; 1,393 are currently exact. Native widens the named font under both grayscale hints, whereas the installed-font controls do not support applying widening to every grid-fit mask. This additional scope remains open. Simple default dropouts improve the renamed AntiAlias geometry from 464 to 728/800 exact and the named sample-widened geometry from 465 to 689/800. Applied to the earlier program-free polygon AntiAlias corpus, that default improves 1,536 to 4,728/5,120 exact without losing an exact capture, but increases 72 previously inexact per-case residuals, so it stays excluded. generate-courier-geometry.ps1 regenerates both fonts/captures and the environment/hash manifest; no installed font data is bundled. These independent controls isolate raster geometry from the previously observed native hinting-state uncertainty.

Probes and data. RealGlyphCoverageProbe.cs (text-real-glyphs): every printable ASCII glyph of 14 face/style combinations at 9 to 24 ppem, AntiAlias and AntiAliasGridFit, 31,584 captures. build-raster-fonts.py with RasterPolygonProbe.cs and RasterMonoProbe.cs (text-raster-polygons, text-raster-bars, text-raster-mono, text-raster-variants): program-free private fonts of 256 polygons on the 1/64-pixel lattice (plus 272 thin bars, -stN variants running SCANCTRL 0x1ff and SCANTYPE N, and variants adding a stack declaration, a glyph program, a cvt table or an empty prep) captured through GDI+ DrawDriverString, GDI GGO_BITMAP and GGO_GRAY4_BITMAP. They isolate scan conversion because nothing is grid-fitted.

Rules found.

  • Instruction budget (a bug, fixed): the 1,000,000-instruction guard counted over the life of a size, so after about a million instructions every later glyph of that size aborted at its first instruction (src/ttf-hinting-budget.test.ts). The fix moves textx-plus-singlebit from 394 to 392 differing pixels (bound tightened to 1.941%) and textx-couriernew-aa from 186 to 190, the second from a glyph the old accident happened to match.
  • Default dropout control (shipped, monochrome): a font that never runs SCANCTRL is scan-converted with simple dropouts (mode 0) up to 32 ppem and none above. Evidence: GDI monochrome bitmaps of the program-free font, 4,079 of 4,096 at 8 to 32 ppem and 1,024 of 1,024 at 33 to 40; the four hinting-machinery variants give 1,787 of 1,792 and 512 of 512 each (src/ttf-gray-dropout.fixture.test.ts). It tightens 1,321 per-case ceilings of the private-font coverage tests and breaks none (bilevel hint, opcode set: 0 to 190 of 192 exact controls at 16 ppem, 0 to 170 at 23, 24 to 170 at 32; diagonal set: 1 to 104 of 108 at 23 and 32; vector-stage set: 0 to 148 of 160 at 16 and 23, 8 to 142 at 32).
  • Grayscale dropout control (shipped for SCANTYPE 0 and 4): AntiAlias images are GDI's GGO_GRAY4_BITMAP bitmaps with the 17th level mapped to the 16th (4,969 of 5,120 images equal, the other 151 pixels one sample lighter in GDI+), and the bitmaps apply the font's scan control to the oversampled outline. SCANTYPE 0 matches 3,852 of 4,096 GDI gray bitmaps at 8 to 32 ppem, SCANTYPE 4 matches 3,747. Georgia, which selects 4, goes from 942 to 1,042 exact AntiAliasGridFit glyphs of 1,128 (1,041 before the ClearType round-five rules merged in) and from 476 to 736 (733 before) AntiAlias ones; over the whole 31,584-capture sample (latest native state) the change gains 99 and 257 exact glyphs at the two hints and loses none.
  • Default dropout of fonts without SCANCTRL in grayscale, re-measured in round 6: per ppem the exact GDI grayscale bitmaps of the program-free polygon font are 231 to 246 of 256 at 8 to 32 ppem with simple dropouts (22 to 41 without) and identical at 33 to 40 ppem (255 to 256 either way), so the threshold is 32 inclusive, as for monochrome. Applied alone (without the AntiAliasGridFit gasp default (b)) it still exceeds committed ceilings: 14 tests at AntiAliasGridFit 16 ppem (movement:16:3:3 123 against 120 channels up to dual:16:3:2 45 against 36) and one AntiAlias capture (signed-diagonal movement:32:4:22, 21 against 18); smart dropouts (4, 5) or stub types (1) as the default are worse (18 tests), so it stays out.
  • Not shipped, evidence in the committed captures: (a) the same default for grayscale (a font without SCANCTRL gets simple dropouts up to 32 ppem), which would take the AntiAlias polygon images from 517 to 3,709 of 4,096 at 8 to 32 ppem; (b) GDI+ AntiAliasGridFit on a font without a gasp table draws the GDI monochrome bitmap from 9 to 17 ppem (all 2,304 images there equal GDI's bitmaps; none of the 1,024 at 8 and 18 to 20 do), 227 to 3,907 of 4,096 exact when applied with (a). Both lift the private opcode set at hints 3 and 4 (hint 3 at 16 ppem from 0 to 190 of 192 exact controls) but push 43 captures over their committed per-case ceilings (22 of text-diagonal-coverage, 17 of text-opcode-coverage, 4 of text-vector-stage-coverage; 21 of them vectors:16:3:*, from (b), whose residual is the unresolved diagonal hinting), so they stay out.
  • Stub rule, partial (monochrome; grayscale and ClearType closed in round 6): for SCANTYPE 1 and 5 (Arial, Times New Roman, Segoe UI, Courier New and Comic Sans MS select 1; Tahoma, Verdana, Calibri and Consolas 5) the FreeType-derived stub exclusion matches 3,102 and 3,134 of 4,096 GDI monochrome bitmaps. A dropout is a stub when the whole contour's extent beyond the scanline is under one pixel on either side (not the extent of the two crossing edges): in the committed captures FreeType's rule gets 1,102 of 1,290 glyphs with a single dropout sample right and the extent rule raises the whole-bitmap counts to 3,143 and 3,186; in a denser sweep of every ppem from 8 to 48 (generator figures, not committed) it classifies 1,276 of 1,277 isolated dropouts correctly, but glyphs with several dropouts keep some it excludes (94% of events right at two dropouts, 86% at three; 111 of the 116 errors at two are dropouts native kept). Under ClearType the same rule, without its overshoot exemption, is enabled (round 6, "ClearType dropout control"). Enabling the FreeType rule, with its overshoot exemption, in grayscale gains 100 and 297 glyphs of the sample (earlier native state) and loses 35 and 48, including 64 committed Segoe UI bold 12 2 controls, so it was not shipped in round 5; round 6 ships it without the exemption (Text, "Grayscale stub rule").
  • Pick between the two candidate samples: the left or bottom one reproduces 3,852 of 4,096 GDI gray bitmaps (SCANTYPE 0), but a thin bar that touches neither sample centre is always drawn on the right or upper one (210 of 210 GDI+ images, text-raster-bars.json.gz).

Native state. The same probe returned different bytes at different times on one machine, one OS build (10.0.26300.0, UBR 9457) and one gdiplus.dll (SHA-256 in the manifests): 2,492 of 31,584 text-real-glyphs captures differ between 06:21 UTC and the runs from 07:35 UTC (two later runs and a within-process repeat are byte-identical), and a fresh text-coverage capture differs from the committed one (2 October, build 26200) in 606 of 3,328 (text-native-states.json.gz, text-coverage-restate.json.gz, src/gdi-native-state.fixture.test.ts). Changing DPI awareness, thread priority or CPU affinity changes nothing, and the registry font-smoothing values read the same throughout. The differing images move diagonal edges by one sample, and the projection arithmetic tells the states apart: of the 2,128 differing captures of faces available to the tests, per-product rounding reproduces 1,541 of the later images and the combined rounding 775 (1,519 and 766 before the storage 8 and stub rules), while the earlier images match the combined rounding 57 times and per-product never. For the later state hinting-divergence.json.gz lists the 2,149 calls the images determine: 2,125 need per-product rounding and 24 combined (generator figure for the earlier state, not committed: 1,013 and 78 of 1,091). A fresh text-coverage capture is reproduced by per-product rounding in 350 of its 606 differing captures and by the combined rounding in 128; the committed ones by combined in 94 and per-product in 64.

Hypotheses rejected, with evidence (31,584-capture sample, earlier native state; exact counts at AntiAliasGridFit/AntiAlias: combined baseline 13,408/9,866, per-product 13,574/10,422). A condition separating the 78 combined calls among 1,091 determined ones: a depth-3 tree over 40 operand and context features found no split that isolates them (they are spread over every opcode, both hints and every size from 9 to 24 ppem). Truncating, flooring or ceiling the sum or each product, or sign-dependent rounding per term: 203 to 1,539 exact captures fewer than per-product over a grid of seven projection and seven dual-projection variants. Truncating, flooring or ceiling the normalised vectors: 64 to 87 fewer. The fDotP definitions (rounded, per-product, truncated, ceiling) and unit movement for equal vectors change nothing; truncated, floored, ceiling and /16384 movement are 907 to 2,110 fewer. Rounding the original distance after scaling, in float, or per product in unit space: 82 to 222 fewer (the production units-space rounding is the best variant). Unrounded x coordinates throughout, the x-precision lead in its crudest form: 2,819 and 4,349 captures lost. Hinting environments for Courier New AntiAlias (compatible widths, v35, v40 without ClearType, unhinted): none exceeds 5 of 1,128 exact, so Courier New remains at 0.

Closed as not reproducible. The per-product projection candidate and the "combined versus per-product" call-level question: the native arithmetic of the references differs between captures taken on the same machine, so no condition on the operands exists to find. The candidate makes 30 committed Arial 16 y captures inexact (ttf-diagonal-projection.fixture.test.ts); round 11 (R11-C) nevertheless ships its arithmetic for installed fonts, with that and the other losses listed above; in the latest native state it would raise exact glyphs of the 15,792 per hint from 13,884 to 14,422 (AntiAliasGridFit) and from 10,554 to 11,621 (AntiAlias) and lose 4 and 6 (generator figures). Adopting it needs the references regenerated in one state.

Open, and what would decide it. (1) What changes the native state: record the system parameters (SPI font-smoothing values, FeatureManagement overrides, Windows flighting) and rerun the real-glyph probe at intervals with other text probes stopped; if a setting flips, the converter can target it. (2) The monochrome stub rule for SCANTYPE 1 and 5 (grayscale and ClearType are closed in round 6) and the pick between the two candidate samples: text-raster-mono.json.gz (st1, st5) holds the sample-exact truth for 4,096 bitmaps each at 8 to 32 ppem; the missing step is a model of glyphs with several dropouts near one tip. (3) Courier New AntiAlias, where every capture is wider than ours (native hinting moves the right stem about a quarter pixel further): captures of a private font reproducing Courier's fpgm/prep with one instruction removed at a time. (4) The 151 pixels one sample lighter between GDI gray bitmaps and GDI+ images.

Round 7 (workstream F): rotated GDI text and the grayscale family ​

  • The references were the wrong side. A metafile records rounded Dx advances (and the compatible-mode exScale/eyScale), so native playback of textx-escapement-*, textx-world-*, textx-rotalign-*, textx-eto-* and rotate-text-25deg differs from the directly drawn PNG by 359, 285 to 362, 1,454 / 581 / 1,354, 377 and 23 pixels; the converter, which replays the recorded Dx, was already closer to the playback. playback-references.json / <name>.playback.png (generator mode playback-references; two fresh-process playbacks identical) are now the references. Report residuals against them: escapement 14 (was 371), world-mono 17 (262), world-aa 23 (344), rotalign-esc 34 (1,595 against the direct drawing; 312 against playback before the layout fix), rotalign-world 34 (1,476), rotalign-esc-small 207 (817), eto-mono 11 (386), eto-aa 452 (827), rotate-text-25deg 1 (24). Rotated text is natively non-antialiased: -aa and -mono escapement PNGs are byte-identical.
  • Layout of a diagonal baseline (text-rotated-placement, 310 configurations, 4,340 glyphs, per-glyph shape matching): a directly drawn run advances by the unrounded linear advance (advance * ppem / upem, not the hinted or rounded width) projected in 28.4 fixed point; glyphs mis-placed by a pixel fall from 1,113 to 50 of 4,340 (WMF playback, which carries no Dx, textx-wmf-escapement-mono 435 to 17 pixels). Alignment: TA_RIGHT offsets by the total advance vector rounded to 1/16, TA_CENTER by that vector halved with truncation toward zero (-trunc(round(16 u T) / 2) / 16), the glyph's accumulated advance and the ascent/descent offset are projected separately and added (with Dx: 0 of 4,200 glyphs mis-placed in every TA_* combination, 64/64 first-glyph origins for centre). Axis angles (90/180/270) keep the integer widths.
  • Rotated glyph pixels (open in round 7, closed for most in round 8). 20% of rotated glyphs (880 of 4,340) differed from the native bitmap by one to three pixels, and our hinted-then-rotated points equalled the native GGO_NATIVE points in 53%. The cause is how GDI scales a rotated glyph, not the interpreter arithmetic: see "Round 8 (workstream R3)" below.
  • Grayscale (AA) family, reproducible. Fresh playbacks of all nine AA sheets equal the committed captures pixel for pixel in two separate processes, so textx-arial-aa 714, -timesnewroman-aa/-tahoma-aa 441, -couriernew-aa 186, -segoeui-aa 148, -arial-styles-aa 178, -wmf-arial-aa 423, -opaque-aa 264, -color-aa 966 are real converter differences in this environment, not capture noise. textx-color-aa differs by at most 35 levels, faintly over the whole of coloured text on the striped background: the gamma blend of non-black text colours, not glyph shapes; -eto-aa 452 against 11 for the identical mono sheet is a grayscale coverage question. Neither was resolved.
  • Grayscale (AA) blend, closed (round 7, F2). GrayBlendProbe.cs (generate-gray-blend.ps1, gray-blend.json.gz, manifest environment-gray-blend.json, src/gdi-gray-blend.ts, src/gdi-gray-blend.fixture.test.ts) draws one 40 px Arial glyph sheet with TextOut / ExtTextOut (ANTIALIASED_QUALITY, 32-bit DIB) over grey and random text and background colours. A pixel's coverage level k (0 to 16) is its grey in the black-on-white sheet; with it the output is an exact function of (k, text, backdrop) per channel: 0 mismatches over all 14 x 65,280 grey pairs per direction (full 256 x 256 sweep, GRAY_GRID=full) and 20 million random channel samples. Transparent text is d + floor((s - d) * a) where a depends on k and on which of text and backdrop is lighter in that channel (two 14-entry tables, close to (k / 16) ** 0.4292 for the lighter colour's share but not a power law: the p fitted per level varies from 0.4290 to 0.4294, so they are measured midpoints of the interval each is pinned to). The old 0.43 gamma blend was exact only for black on white. Text drawn with its background fill (OPAQUE mode, or ETO_OPAQUE) goes through an 8-bit linear domain instead: ENC[floor((k * DEC[s] + (16 - k) * DEC[d]) / 16)] with DEC[c] = round(255 * (c / 255) ** 2.3535) (it collapses the darkest 18 levels, so even text of the background colour changes the pixel) and a measured 256-entry ENC; 0 mismatches over 14 x 65,536 grey pairs and all 93,600 random channel samples in each of the OPAQUE and ETO_OPAQUE modes. ETO_OPAQUE takes the opaque blend only when its rectangle contains the text cell and every glyph bitmap, measured by sweeping each rectangle edge across the cell (left <= the leftmost glyph bitmap, e.g. one pixel left of the origin for A; right >= the rightmost, including italic overhang; top and bottom the cell): a smaller rectangle is filled and the text blended transparent over it and over the surface beyond it. ETO_CLIPPED alone is transparent; OPAQUE mode clipped to a rectangle is opaque inside and leaves the pixels outside. Report (against the native playback references): textx-color-aa 966 to 28, -eto-aa 452 to 78, -opaque-aa 264 to 1; the rest of the AA family is glyph coverage and unchanged.
  • Grayscale glyph coverage, localised to hinting (round 7, F2). GrayGlyphProbe.cs (generate-gray-glyphs.ps1, gdi-gray-glyphs.json.gz, src/gdi-gray-glyphs.fixture.test.ts) captures GetGlyphOutline GGO_GRAY4_BITMAP and GGO_NATIVE (hinted outline) for every printable ASCII glyph of five faces at 18, 24, 32, 48 and 72 px; the capture is byte-identical across processes. (1) gasp: ExtTextOut draws the font monochrome below its first GASP_DOGRAY range (Arial 9 to 17, Tahoma 9 to 16, Times New Roman 9 to 17, Courier New 9 to 36 px), which the converter already does; GetGlyphOutline ignores the table and returns gray there, so those sizes are not comparable and are skipped. (2) Where both are gray, 45 to 79 of 94 converter bitmaps are exact (Segoe UI 56 to 90) and the differences are one 1/16 sample on edges. (3) Rasterizing GDI's own GGO_NATIVE outline with the converter's grayscale rasterizer reproduces the native bitmap for 90 to 94 of 94 glyphs at 18 to 32 px (Arial 64 of 94 at 72 px; a scratch rasterizer taking exact quadratic crossings instead of subdividing was no better: 92, 75 and 67 of 94 at 18, 48 and 72 px against 91, 78 and 64), so scan conversion is not the main source; the hinted outline is: ours equals the native hinted outline in about 72 of 94 glyphs for Arial, Times New Roman, Tahoma and Courier New at every size (1 to 3 points of 1/64 pixel off on diagonal strokes: MDRP/MIRP/SHPIX after SDPVTL, then IUP, e.g. Arial 24 X points 3, 9, 13, 19 and V points 0, 9, 10). Scored against this oracle (2,914 glyphs, 84,008 points, 3,199 points off) and none improved it: truncating, flooring or ceiling the move mulDiv, the dot product, the vector normalisation (also an integer square root), the point scaling and the CVT scaling; SPVTL or SDPVTL from original instead of current points; MDRP distance from original instead of unscaled points. Segoe UI's GGO_NATIVE outlines are not the outlines its bitmaps come from (16 of 94 equal), so only its bitmaps are pinned. A hinted-outline oracle for the next attempt: outline-diff style comparisons of font.outline(glyph) against the parsed GGO_NATIVE points, with the interpreter traced to the first point that differs.
  • Diagonal hinting arithmetic, closed for GDI (round 7, T). Private fonts whose glyphs run one instruction on controlled points (generate-hint-sweep.ps1, src/ttf-hint-sweep.fixture.test.ts; 61 kinds x 250 vectors x 4 sizes when built in full, 3.1 million points, all read through GGO_NATIVE, identical across processes) recovered the per-instruction rules: the projection and dual projection round each product alone; the move divisor is the per-product dot, and a dot below 1/16 keeps its sign (+-1.0); a move along x truncates after adding half the divisor (negative quotients round toward zero), a move along y rounds half away from zero, a freedom vector copied from the projection vector (or a dot of exactly 1.0) rounds to nearest on both axes, and with the projection vector along x the x move is the distance itself; IUP interpolates with the x-style division; an axis shortcut for the dot product must not skip the other component. The mono-text workstream found the same rules independently (glyph programs truncated after k instructions); they are gdiArithmetic. Against the 94-glyph GGO_NATIVE set the hinted outline is now identical to GDI's for 93 to 94 of 94 glyphs of Arial, Times New Roman, Tahoma and Courier New at 18 to 72 px (1,591 of 1,598 compared glyphs and 10 points off, from 1,238 and 1,666 off), and 140 of 3.1 million sweep points differ. GetGlyphOutline ignores lfQuality (identical bytes at quality 5), so ClearType and GDI+ hinting cannot be probed this way. Switching GDI (not GDI+) ClearType text to the new arithmetic moves textx-arial-cleartype 22,224 -> 22,200 px, textx-color-cleartype 1,761 -> 1,758 and textx-segoeui-cleartype 26,464 -> 26,462 with no exact capture lost (shipped); GDI+ gray and ClearType lose 2 to 53 px per fixture and stay on the old arithmetic (the native state of those images differs between captures, see Native state above); rotated glyph runs do not change at all (the fonts switch most hinting off). Left over: the 140 sweep points (ties of the half-divisor rule), random-line ISECT, first divergences in ALIGNRP and CALL.

Round 8 (workstream R3): rotated GDI glyphs, metrics and advances ​

Private fonts whose points sit 468 em from the origin (RotationMatrixProbe.cs, build-rotation-matrix-font.py, generate-rotation-matrix.ps1; GetGlyphOutline(GGO_NATIVE) under a world rotation and under an escapement, 5-degree steps) show the matrix to a relative 1e-6, where an ordinary glyph pins it to 1e-3. Fixture residuals are against the native playback references; "before" is the round 7 state.

  • How GDI scales a rotated glyph. head.flags bit 3 ("force ppem to integer values", set in every stock font here) is what matters, not the font's programs (a font with an empty prep, fpgm and glyph program behaves like one without): without the bit the outline is the exact rotation of the font-size outline. With it the glyph is hinted unrotated at the whole-pixel ppem round(ppem * max(|cos|, |sin|)) and the hinted 26.6 points are then multiplied by the rotation divided by its major component (1 on the major diagonal; on the minor ones A / B, A and B being min and max of |cos|, |sin| times 32 * ppem rounded, the 16.16 em scale of a 2048-unit em; rotationMatrix in src/gdi-font-engine.ts). The round 7 model hinted at the font ppem and scaled by the rounded ratio (roundedRotationMatrix, still used for matrices that are not rotations). Hinting at the rounded ppem with gdiArithmetic reproduces every point of the straight-edged glyphs (T, E, 4, 7, 1) of Arial, Times New Roman and Tahoma in rotated-glyph-bitmaps-small.json.gz (2,709 of 2,709; Tahoma 1,107 of 1,107, which the round 7 note could not explain: its instructions simply ran at the wrong size), and 1,252 of 1,272 compared points (98%) of rotated-glyph-matrix.json.gz (2,539 of 5,436, 47%, with the round 7 model; glyphs whose point counts differ are not compared). In the 62-glyph set of the placement probe (4 faces x 6 sizes x 14 angles with an escapement; Arial also with a world rotation) exact glyph bitmaps rise from 3,647 to 4,723 of 5,544 for Arial (differing pixels 6,593 -> 1,176 of 430,000 ink pixels), 3,630 to 4,697 for Times New Roman (6,918 -> 1,325), 1,554 to 4,087 for Tahoma (110,119 -> 2,927) and 3,265 to 4,580 for Courier New (8,788 -> 1,492); the Arial world rows go from 1,177 to 1,626 of 1,848 (1,139 -> 305 pixels).
  • Not exact: the minor ratio and the target at ties. The minor ratio is k / 65536 with an integer k that is not round(65536 tan): it differs from the tangent by up to 0.2% (8.378 px against 8.393 px for the 20 px, 25 degree case), and A / B with 32 * ppem, as a 16.16 number, reproduces 38,436 of 40,052 far points (96%) and 484 of 1,292 whole rows under a world rotation (src/gdi-rotation-matrix.fixture.test.ts; the unrounded quotient gives 38,356 and 456, floor and ceil mixes of A and B and a 2.14 quotient are worse). The whole-pixel target is rounded half up at 1/32 pixel (12 px at 45 degrees is hinted at 9, not 8: 8.4853 -> 272/32 = 8.5), which is right for 1,268 of 1,292 world sizes (plain rounding: 1,240); the 24 left are native major components a hair above the half (32 px at 40 degrees: 24.513 -> native 24, the model gives 25). An escapement's sine and cosine are less precise than a world matrix's (relative error up to 3e-4; its pairs reproduce 33,620 of the 40,052 points), so under lfEscapement the same model is a little worse. An angle table would be needed and was not built.
  • The pixel centre on an edge. Rasterizing the native GGO_NATIVE outlines, a centre that lies exactly on an edge is in the bitmap when the contour runs downward there (y up) and out when it runs upward, in every sweep direction (12,995 tie centres of the straight-edged glyphs of the 45, 135, 225 and 315 degree sheets: the converter now disagrees at 529, and every pixel it sets on an upward edge that the native bitmap lacks is Tahoma's, whose curves and dropout still differ). The converter's sweep took both ends of a span; directedTies in rasterizeMono is now on for glyphs at a non-axis angle (not for the 90/180/270 degree glyphs, which keep the upright rule: the Arial world sheet at 180 degrees worsened when it was applied there). Rounding the implied on-curve points to the 26.6 grid (as upright glyphs do) is also right for rotated glyphs: 313 against 298 of 357 Arial glyphs. A GGO_BITMAP row is padded to a DWORD, which for glyphs wider than 32 pixels is more than four bytes; the first measurements of this round misread the -28 and -40 px glyphs because of it.
  • Metrics of a rotated font. GetTextMetrics of a font with an escapement differs from the upright one, and TA_TOP / TA_BOTTOM place rotated text by it (RotatedMetricsProbe.cs, 5 faces x lfHeight -8..-60 x 8 angles; world rotation and escapement are identical): at a non-axis angle floor(headYMax * ppem / upem + ppem / 64 + 0.964) (and the same for the descent with -headYMin; all 265 sizes of five faces at 25 and 160 degrees, 262 of 265 at 45 and 300 degrees where the last digit of the pad moves by 0.005), at a quarter turn the OS/2 win box with the same pad (+ 0.969; all 265 sizes at 90 and at 270 degrees), at a half turn round(win * ppem / upem) (all 265); the upright metrics (VDMX) apply only at 0 degrees. The round 7 formula floor(yMax * ppem / upem + 1.27) held up to 32 px only (157 of 265 sizes of five faces). rotatedMetrics in RealizedFont; textx-rotalign-esc-small goes from 207 to 13 differing pixels because its 90 degree line at 13 px was placed by the upright ascent.
  • Advances along a quarter-turn baseline. The linear advance is taken to 26.6 and rounded half up (Times New Roman at 9 px: E 5.4976 -> 6, H 6.4995 -> 7), along a half turn rounded plainly (E -> 5, H -> 6): all 840 widths at 90, 180 and 270 degrees and (rounded the same way) the 3,360 non-axis ones of rotated-placement*.json.gz. Glyphs of the directly drawn rotated runs placed by a pixel fall from 50 to 32 of 4,200 and the Dx runs stay at 0; exact glyph shapes (a different measure from the earlier "raster") rise to 3,695 and 3,731 of 4,200.
  • Fixtures (differing pixels, before -> after): textx-rotalign-esc-small 207 -> 13, textx-rotalign-esc 34 -> 15, textx-rotalign-world 34 -> 15, textx-world-aa 13 -> 3, textx-world-mono 12 -> 2, textx-wmf-escapement-mono 17 -> 10, rotate-text-25deg against the native playback 1 -> 0 (exact), textx-escapement-aa / -mono 14 -> 15 (single pixels; the ceiling of 0.01% still holds). Exact fixtures in the GDI report 777 -> 778 of 898. Test ceilings in src/gdi-parity.fixture.test.ts are tightened to the new figures.
  • Open. Rotated curved glyphs still differ by single pixels in about 15% of the glyphs (Arial 4,723 of 5,544 exact): the implied points and the minor ratio above; Tahoma's curves and dropout (its prep selects the smart dropout types 4 and 5; switching dropout control off for such glyphs fixes the straight-edged ones in a 13 to 20 px set but costs 266 Tahoma glyphs in the 62-glyph set, so it was not shipped). The upright mono and grayscale residuals of the workstream list (textx-*-aa, -mono, -cell-mono, textx-fon-msshelldlg, text-msshelldlg-hm13, emfrec-text-exttextouta; 1 to 93 px each) are scattered single-pixel hinting and dropout decisions and were not touched. Grayscale at 72 px: rasterizing GDI's own outline gives 64 of 94 Arial glyphs; the differences are +-1 sample (1/16) on curves and straight diagonals ('^' loses one sample on every edge pixel), shifting the outline by 0.05 of a 26.6 unit (1/1280 pixel) in either axis loses 181 to 262 of 538 exact glyphs of seven face/size sets (so the samples on edges are nearly all ties and the current both-ends rule is right for most), and the direction rule that fixes rotated mono ties (directedTies on the 4x4 grid) loses 10 of 94 Arial glyphs at 24 px and 4 at 48 px, so the grayscale gap is not this tie rule.

Round 9 (workstream W3): upright GDI monochrome and grayscale text, the escapement table ​

Sources, kept apart. Documented by Microsoft: the TrueType instruction set (https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions, SCANCTRL and SCANTYPE) lists six scan-conversion rules. Rule 1: a pixel whose centre is inside the outline is on. Rule 2: a pixel whose centre a contour passes exactly through is on. Rule 3 (SCANTYPE 0, simple): when a scan line between two adjacent pixel centres is crossed by an on-transition and an off-transition contour and neither pixel was turned on by rules 1 and 2, the left-most (horizontal line) or bottom-most (vertical line) pixel is turned on. Rule 4 (SCANTYPE 1): apply rule 3 only if the two contours continue to intersect other scan lines in both directions, which is judged on "the scanline segments that form a square with the intersected scan line segment"; "these could be different contours than the ones intersecting the dropout scan line segment". Rule 5 (SCANTYPE 4): turn on the pixel closer to the midpoint of the two contours. Rule 6 (SCANTYPE 5): rule 5 with rule 4's stub test. SCANCTRL bits 0 to 7 are a ppem threshold and bits 8 to 13 the conditions (ppem, rotated, stretched) that switch dropout control on or off. GetGlyphOutline documents GGO_GRAYn_BITMAP as n squared plus one levels (5, 17, 65), that is an n x n oversampling (https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getglyphoutlinew). ISECT (same page) puts a point at the intersection of two lines and, for parallel lines, at (a0 + a1) / 4 + (b0 + b1) / 4 on each axis; no rounding is stated. Not documented: how lfEscapement becomes a matrix, how a pixel centre exactly on a horizontal edge is treated, and how the intersection of non-parallel lines is rounded. Inferred from re-implementations (behaviour only, no code read or taken): FreeType's black rasterizer, which this converter's sweep follows, decides a stub from its own profile structure (a tip that ends before the next scan line, with an "overshoot" exemption); Wine's freetype.c and ReactOS' font engine call FreeType's rasterizer and add no Microsoft scan converter, so they could not decide any of the questions below. Measured here: everything that follows.

Where the 140 mismatching sheet glyphs came from. mono-sheet-glyphs.json.gz holds the native bitmap and hinted outline of 6,740 glyphs. Comparing our hinted outline with the native one separates hinting from scan conversion: 123 of the 140 glyphs that differed had the native outline point for point (all of them scan conversion), 3 differed in the outline, 14 are italic or bold (not compared). Most of the 123 were one dropout pixel that FreeType's profile rule kept or dropped differently from the native scan converter: on curves (the profile rule had never been calibrated on them) and on glyphs of several contours (i, j, %, accents) whose contours lie within a pixel of each other.

Stub rule by the specification squares (this branch only: it gives up 20 controls that were exact). Reading rule 4 literally (a dropout is kept only if the unit square on each side of the scan segment is crossed at least once, by any contour, on its far scan segment or on the two segments that join it to the dropout's pixel centres; a contour that only touches a segment counts twice; curves flattened at 16 steps plus their extrema on the 26.6 grid) reproduces the native decision in 9,061 of 9,070 isolated decisions of the private polygon fonts (flipping one decision at a time in 62k native GGO_BITMAP masks and keeping the glyphs where exactly one flip changes the bitmap; the nine others that were inspected touch a pixel-centre line within 0.004 pixel: a curve apex, a vertex on the scan line). The same rule decides the grayscale oversampled outline, because GDI's gray bitmaps are the oversampled monochrome ones. Measured against the round 8 code:

native dataexact beforeexact with the rulelost
6,740 real-font mono sheet glyphs (mono-sheet-glyphs)6,600 (175 differing samples)6,718 (28)0
2,068 native gray sheet bitmaps (gdi-gray-glyphs, five faces, 18 to 72 px)1,8451,8571 (Segoe UI 48 px &)
31,584 real GDI+ gray glyphs (text-real-glyphs)27,19327,2880
61,952 private mono controls (mono-stubs*, mono-multiple*, SCANTYPE 1/4/5)51,971 (14,391 differing samples)61,465 (743)18
56,320 private gray bitmaps and GDI+ images (text-raster-*)38,75343,3092 (one glyph: st5, 40 ppem, #99, a tip within a sample)
3,720 GDI+ ClearType size-sheet captures3,0763,0790
textx-segoeui-cell-mono / -tahoma-cell-mono / -timesnewroman-cell-mono (px)40 / 18 / 241 / 2 / 4

The 18 and 2 losses are controls that the profile rule happened to get right where a contour passes within about 0.004 pixel of a pixel centre or square corner (the edge of a thin sliver at (-0.875,-1.0), a curve apex at -1.9988 against the centre line -2); varying the tie convention (touch counted once or twice, 1/64 pixel tolerance, rounding the flattened points to 26.6, FreeType's overshoot exemption, merging overlapping spans before the smart pick) lost between 22 and 6,500 previously exact controls for the same or fewer gains (61,465 exact is the best of them). The rule that ships in the converter's ClearType scan conversion (0 losses of 3,720 and 1,976) is this one. The branch worktree-agent-a5c6aaaa56009cbeb keeps the round 8 rule for monochrome and grayscale text because the committed controls forbid even one loss; this branch (worktree-agent-a5c6aaaa56009cbeb-squares, one commit on top of it) applies the rule to them too, with a finer arc split for GDI monochrome (fineArcs: GDI evaluates curved edges almost exactly; 1,024 native ovals 921 to 933 exact). Its evidence is ttf-mono-squares.fixture.test.ts (per-case ceilings from compare-mono-squares.ts against the frozen round 8 renderer in mono-squares-bounds.json.gz, which replaces ttf-mono-stub and ttf-mono-multiple), and the 18 controls it gives up are pinned there by name; the gray one is st5 at 40 ppem, #99. Fixtures: 803 to 810 of 910 exact in report.ts, none worse (emfrec-text-exttextouta 7 to 2, textx-segoeui-cell-mono 40 to 1, textx-tahoma-cell-mono 18 to 2, textx-wmf-segoeui-mono 17 to 1, textpb-segoeui-cell-q3 against the direct drawing 45 to 0 px).

A scan line exactly on a horizontal edge (shipped, gray). A sample centre on a contour is on it (rule 2). The sweep took one side of two descending edges that a horizontal edge joins (FreeType merges the shared row), so a Segoe UI capital's bar, whose underside lies on a sample centre of the 4x grid (cap height 23 px, bar 20.625 to 23 px), lost a sample row that the native bitmap has. closedTies inks such a row with the union of the spans just above and just below it. Native 4x4 gray bitmaps of five faces at 18 to 72 px: 1,845 to 1,857 of 2,068 exact (Segoe UI 12 more, none lost); GDI+ AntiAlias and AntiAliasGridFit images of 31,584 real glyphs (nine faces): 27,193 to 27,204 (none lost); textx-segoeui-aa 93 to 64 px, textx-tahoma-aa 50 to 47, textx-couriernew-aa 25 to 24. Not for monochrome or ClearType: the private diagonal GDI+ SingleBitPerPixel and ClearType controls (text-diagonal-coverage, text-signed-diagonal-coverage) leave a top edge's row out, and the ClearType gain is only two captures.

lfEscapement is a chord (shipped). EscapementAngleProbe.cs reads GetGlyphOutline(GGO_NATIVE) of a private font whose points lie 30,000 pixels out at every tenth of a degree (3,600 angles; escapement-angles.json.gz). A world rotation is exact to the 16.16 matrix, an escapement is not: its length dips by up to 3.2e-4, with the dips repeating every 2.8125 degrees. The matrix is the linear interpolation of the exact sine and cosine at 128 equal steps of a turn, which reproduces all 3,600 angles to 2e-5 (exact trigonometry is off by 3.1e-4). escapementSinCos rotates the glyph outlines; the baseline direction of the layout stays exact (the table in the layout moved textx-rotalign-esc from 15 to 61 px). Under an escapement the model of "How GDI scales a rotated glyph" now reproduces 38,204 of 40,052 far points (33,620 with exact trigonometry) and 476 of 1,292 whole rows (452). The fixtures do not move (13, 15, 14 and 9 px on the escapement sheets); what is left there is the minor ratio and curve ties.

ISECT, negative. The 960 random-line controls of freedom-isect stay at 431 exact. Tried: the rational intersection rounded to nearest on every line (435; floor, truncation or ceiling 195 to 197), the parallel formula of the specification (matches the one pair that is parallel to 0.03 degrees; native does not use it for lines 0.5 to 2 degrees apart), a t quantised to 2^12 to 2^20 (425 to 436), directions normalised to 2.14 (431 to 439), FreeType's formula with the products scaled by 1 to 4,096 (45 to 442, best 16), the intersection of the font-unit points scaled afterwards (310). The error is a rounding-sized one for well-conditioned lines (492 of 508 within one unit between 45 and 90 degrees) and grows as 1 / sin(angle) (the native point is 275 units from the rational one for lines 2.2 degrees apart), which says that native keeps its input points at a precision this interpreter does not; not reproduced.

Left open, and why. (1) The 22 mono sheet glyphs that the candidate rule leaves: a curve whose crossing lies within about 0.002 pixel of a sample centre, which depends on the native arc subdivision (replacing the exact arcs by integer-midpoint subdivision to fixed depth or tolerance leaves at best 577 of the 1,024 ovals exact against 933); (2) gray pixels one sample off at 72 px (about 3 per glyph; the native outline rasterized with ours is exact in 64 to 75 of 94 glyphs): the same arc ties; (3) Segoe UI's gray bitmaps, whose GGO_NATIVE outline is not the outline the bitmap comes from; (4) the escapement layout and rotated minor ratio; (5) ISECT. None of these is a scan-conversion rule that a native probe on this machine could still separate from tie noise.

Round 10 (workstream C): GDI integer advances, phantom points and the curve ties ​

Measured 22 October 2026 against local main (report: 820 of 910 exact, 819 before; no fixture worse).

  • Advances: head.flags bit 4 and LTSH. GdiAdvanceProbe.cs (generate-advances.ps1, gdi-advances.json.gz, test src/gdi-advances.fixture.test.ts) read GetCharWidth32 and GGO_METRICS (they agree) of U+0020..U+00FF of five faces at 123 em and 91 cell heights: 239,680 widths. The converter differed in 4,731 (587 of 101,650 printable ASCII). Program-free private fonts (build-advance-fonts.py, AdvanceFontProbe.cs, 2,047 advances at 195 sizes each) isolate the rounding: with bit 4 clear the advance is round(advance * ppem / upem) exactly (0 of 399,000 differ); with it set, with or without a one-instruction glyph program, the scaled advance is rounded to 26.6 and then to a pixel (0 differ). A real font's LTSH makes a glyph advance linearly from its yPels on (Times New Roman A: hinted to 68 px, linear from 69; V and X from 67; % from 8), an hdmx record for the size winning. Now 0 of the ASCII and Latin-1 widths differ (U+007F of Segoe UI and Tahoma aside). textx-wmf-timesnewroman-mono 21 -> 0 px (exact), -cell-mono 24 -> 3. EMFs record Dx, so only WMF playback and Dx-less text are affected. The GDI+ AntiAliasGridFit widths were left alone (no native evidence).
  • The left phantom point. (1) A glyph program may move the left phantom point by a fraction of a pixel (Microsoft Sans Serif 7 at 11 to 15 px: SHPIX -28/64). GGO_NATIVE stays relative to the moved point (our outline equals it) but the bitmap is rasterized from the point's starting position plus the whole pixels it moved (rasterShift, ms-sans-glyphs*.json.gz, generate-ms-sans-glyphs.ps1): the five glyphs 6 to 8 px -> 0, and their GGO_GRAY4_BITMAP 23 to 27 samples -> 0. text-msshelldlg-hm13 8 -> 2. (2) GDI's interpreter does not round the left phantom point and rounds the advance instead, pp2 = pp1 + round(width) (Times New Roman Italic < and >, lsb 150 against xMin 39 and 37). Instruction-prefix variants (build-hint-prefix-font.py, PrefixHintProbe.cs; not committed, derived from a Microsoft font) of > at 11 and 17 px equal native at all 58 prefixes after the change. The mono-condensed corpus goes from 1,177 to 1,187 of 1,200 exact (84 -> 18 px); times-italic-glyphs.json.gz pins the glyphs. No fixture contains these glyphs. A rule tried and refuted: starting pp2 at the LTSH-rounded width (< at 20 px stays 10 px off and >, = got worse).
  • Curve ties, negative (again). On the 1,024 program-free ovals (curve-ovals) the converter equals the exact curve; both differ from native in 31 interior pixels (23 with more native ink) plus the tip dropouts. Native ink against the signed normal distance of the pixel centre to the exact curve is a step near +0.15 unit (1/64 pixel) blurred by about 0.5 unit. None of these reproduces it better than the exact curve (31 interior pixels): uniform N = 2..40 segments and recursive integer-midpoint subdivision (rounding none, round, floor, ceil, truncate; thresholds 0 to 64; depths 3 to 10), tolerance-driven N (three flatness measures, five N rules, seven tolerances), control-polygon vertices, quantised t (2^-4 to 2^-20), forward differencing, and an outward offset of 0.05 to 0.5 unit (best 27). The 1-pixel mono residuals and the +-1 sample gray ones are of this kind. Deciding experiment: a capture of tens of thousands of random single-arc shapes (the cap kind of build-curve-fonts.py), which gives a few hundred flips instead of 31.
  • Open, found on the way. Times New Roman Italic j: the first instruction-prefix that differs is an ALIGNRP along a diagonal projection vector (one point 1 to 2 units apart; j 70 px at 72 px). Glyph < at 20 px. The C1 controls (U+0080..U+009F) of Segoe UI and Tahoma were not compared.

Round 11 (R11-G): DrawImage bilinear span (JPEG playbacks, rotated blur): negative result, mechanism narrowed ​

Read in gdiplus.dll: DpDriver::DrawImage (the 3-point matrix: source rectangle corners to the destination points, det = (A*B - sy*sx) + (-sx*h - sy*w), m0 = (h*X1 - h*X0) * r, m1 = (h*Y1 - h*Y0) * r, m2 = (X2*w - X0*w) * r, m3 = (Y2*w - Y0*w) * r, translation (X1*(-sx*h) + X0*P + X2*(-sy*w)) * r with P = A*B - sy*sx, then times the world-to-device matrix), CreateOutputSpan (modes Default/Low/Bilinear go to DpOutputBilinearSpan; the _MMX class is a stub on x64), the DpOutputBilinearSpan constructor (GpMatrix::Invert of that matrix) and OutputSpan (per run of covered pixels: the two end pixels through the inverse, step = difference / n, one add per pixel, 11-bit fractions from floor(f * 2048 + 0.5)), GpMatrix::ComputeComplexity (off-diagonals under 5.96e-4 of the larger diagonal count as zero, a diagonal within 5.96e-4 of 1 counts as a pure translation u = x + e) and GpMatrix::Invert. FPUStateSaver sets MXCSR to round-down (0x3f80) in the API entry points. Whether the model fits was checked with a new float32-resolution probe, ImagePointsBisectProbe.cs (generate-image-points-bisect.ps1, capture image-points-bisect-jpeg.json.gz: 124 flip origins of the JPEG playbacks' 37x19 to 260x170 geometry), plus the existing image-coordinate and image-points-positions captures.

Measured: with the matrix and span above (all float32 rounded down) the rect-form image-coordinate sweeps fall from 13,004 missed flips to 6,247 (sweep 5 from 1,312 to 0, 4 from 1,628 to 237, 2 from 3,005 to 528, 6 from 2,756 to 922), but sweep 0 rises from 2,359 to 2,678, the three JPEG playbacks go from 12, 1 and 3 differing pixels to 22, 2 and 7, and the exact float32 reproduction of the 124 JPEG-geometry flips is 2 (51 at best with a nearest-rounded inverse and a step rounded up; a simulated-annealing search over the rounding mode of each of the 42 operations reaches 65). image-points-positions vertical sweeps (887 flips) reproduce 5. The native vertical scale of the points form fits sh/dh * (1 + 3.7e-7 to 5.1e-7) and the horizontal u sits one float32 unit above the model; neither is explained by the operation order or rounding mode (tried: per-stage nearest/down/up, inverse nearest, step up, span chunks of 32 to 256, end pixel +-2, bitmap and graphics DPI (flip origins are DPI independent), the InferAffineMatrix rect formula, an exact-arithmetic inverse, a translation or scale of the playback matrix (a fitted translation of -6e-5 and scale 1 - 2.4e-7 takes the JPEG fixtures to 2, 0 and 2 pixels but is a fit, not a mechanism, and does not fix the blur: 3 pixels)). So no change to the image resampler is shipped; the fitted compensations (points-form reciprocal step, vertical bias, corner-relative start) stay, and replacing them needs the source of the 4e-7 vertical term, which the probe above can now measure at float32 resolution.

Round 11 (R11-G2): the DrawImagePoints 4e-7 term found (a second pass through the inferred matrix) ​

Experiments, in the brief's order. (1) ImagePointsBisectProbe now has a playback mode (generate-image-points-bisect.ps1 second call: the same DrawImage(image, Rectangle(20, 10, 260, 170), srcRect) recorded into an EMF+ metafile on a 300 x 200 host, the recorded x of the first and third point patched to every searched float32 origin, native DrawImage(metafile) playback read): all 124 first-flip values equal the direct draw's (image-points-bisect-jpeg-playback.json.gz). (2) So the metafile player's frame-to-device matrix adds nothing and nothing needed reading through EnumerateMetafile; the term is in the points-form arithmetic. (3) Read: GdipDrawImagePointsRect, GpGraphics::DrawImage (both overloads), GpMatrix::InferAffineMatrix (points overload), GpMatrix::Transform, GpGraphics::DrvDrawImage, ApplyVisibleClipToSourceRect (a no-op when the clip covers the draw), DpDriver::DrawImage, CreateOutputSpan, GpMatrix::Invert, GpMatrix::ComputeComplexity.

Mechanism (confirmed by executing the real InferAffineMatrix, Transform and Invert under MXCSR 0x3F80 in an emulator: 300 random draws, every matrix, corner and inverse bit-identical to src/gdiplus-image-points.ts): GpGraphics::DrawImage(points) infers a matrix M from the points and the source rectangle, then sends the rectangle's corners back through M (Transform) to get the points the driver is given; DpDriver::DrawImage infers the matrix N from those points again, multiplies by the world-to-device matrix and inverts. Under round-down arithmetic w * X2 and (-w) * X0 round in opposite directions, so M's off-diagonal entries are tiny and not zero (about 1e-8), ComputeComplexity still calls M a scale and Transform drops them, the driver's points move by a few float32 units, and N's off-diagonals are not zero either: det = a d - b c is one float32 unit under a d (a number minus a far smaller one rounds down to the next float32 below, which a double sum hides, hence addDown). That one unit in the determinant is the 4e-7 vertical term and the one-unit horizontal offset, and it depends on the origin's y, which was the unexplained "columns that move when the origin's y changes". Rounds 11-G's fitted constants were these.

Measured against native flips (a flip is reproduced when the model's quantised coordinate differs between the float32 origin before and the native one): image-points-positions vertical 887 of 887 (the round-down model of round 11-G reproduced 5), horizontal 684 of 720, JPEG-geometry bisect 105 of 124 (from 2). Shipped: resampleImage uses the chain for plain Bilinear DrawImagePoints, axis aligned, no wrap attributes, PixelOffsetMode None (worldPoints and worldMatrix on the resample spec). Whole-set report against the same tree without it: codec-jpeg-arith-prog-420-dri2-playback 12 to 0 differing pixels, codec-jpeg-arithmetic-playback 1 to 0, codec-jpeg-cmyk-photo-playback 3 to 0, no other fixture changes (910 compared; an attempt without the wrap exclusion made gpx-image-attr-{clamp,flipxy,tile}-bilinear 0 to 2, so those keep the old fitted path, as do specs without points and Half pixel offset). plus-effect-blur-r3-rotate30 and plus-only-effect-blur-r3-rotate30 stay at 6 (rotated, so a different path). The fitted points-form reciprocal step, vertical bias and corner-relative start remain only for those excluded cases.

Left: 19 of the 124 JPEG-geometry flips and 36 horizontal sweep flips are off by one to three float32 units of u (a span-start or run-end detail: shifting the run start or end by one column, any chunking of the run, nearest or upward rounding of any single operation do not help), the high-quality spans (DpOutputBicubicImageSpan, DpOutputSpanStretch) behind gpx-image-highqualitybilinear and gpx-image-rotated-highqualitybicubic were not read, and the rect-form DrawImage goes through the other InferAffineMatrix overload and the same second pass, which this round did not model.

Round 12 (R12-I): DrawImage spans read from gdiplus.dll (rotated blur, rotated and axis-aligned high quality) ​

Read: DpOutputBicubicImageSpan (constructor, OutputSpan shared with the nearest-neighbour span, OutputSpanIncremental, Do1DBicubic), DpOutputSpanStretch<0> and <1> (InitializeClass, OutputSpan_Original, StretchScanline, Apply1DWrapModeX, GpValidFixed16, ValidateKernelRange), CreateOutputSpan (modes 6 and 7 with a scale or translation matrix choose the stretch spans, a rotation chooses the plain Bilinear and Bicubic ones), DpDriver::DrawImage, GpGraphics::DrvDrawImage (the rotated high-quality branch: ceil(sqrtf()) edge lengths, an intermediate bitmap drawn with SourceCopy, a second draw of that bitmap to the same points), GpGraphics::DrawImage (the rectangle overload builds a source-to-destination scale anchored at the right and bottom edges) and DrawImagePointsEPR::Play. Mechanism and measurements: parity-notes.md, EMF+. Result: plus-effect-blur-r3-rotate30 and plus-only-effect-blur-r3-rotate30 6 to 0 pixels (a rotated points-form plain Bilinear draw takes the float32 chain and span positions), gpx-image-rotated-highqualitybicubic 5 to 0 (second pass with the 16.16 bicubic span), gpx-image-highqualitybilinear 1 to 0 (stretch span), 885 to 889 of 910 report comparisons exact and no comparison worse; the 600 hq-rotated captures get no worse in any group and most improve (k7 Half 1.1x impulse 45 to 12 pixels) with the pinned counts tightened; hq-axis-noise is exact on all 51,105 values (one off before).

Negative and partial results: (1) the rect form versus the points form. A recorded rectangle draw is a points record whose points went through the rectangle matrix; reading them as the driver's points reproduces the directly drawn fixtures, and reading them as an API call (another inference and transform) reproduces freshly recorded native playbacks (56 of 60); the two differ by 26 pixels on the fixture's own 98, 4, 58, 20 draw, and the fixtures' playback equals the direct draw, which an x scale of 1.0000001 in the world matrix explains (not derived from the header). The converter reads the points as the driver's. (2) The stretch span is used only for whole-bitmap, attribute-free, unmirrored PixelOffsetMode None draws; the cropped third draw of the gpx-image-attr-* fixtures (source rectangle plus a margin, wrap inside the margin-extended rectangle) and Half offsets keep the fitted path (applying it to every draw took those three fixtures from 0 to 142, 116 and 165 pixels). (3) Not isolated: ApplyVisibleClipToSourceRect (a draw partly outside the visible clip gets a cropped source rectangle plus a margin), the fill coverage of left and top edges a hair above a whole pixel (4 of 148 grid draws), and the plain-Bilinear DrawImagePoints flips of round 11 (19 of 124 and 36 horizontal flips), which this round did not touch.

Round 11 (workstream B): the native scan converter and interpreter arithmetic, read from fontdrvhost.exe ​

Measured against origin/main ee0eb73 (831 of 910 fixtures exact in the GDI report; 878 on this branch after merging local main, which adds the path-gradient fixes; the text lines below are this workstream's, none worse). The functions read (public Microsoft symbols; behaviour reimplemented in src/ttf-msscan.ts and src/ttf-hinting.ts, nothing copied): fsc_FillGlyph, fsc_CalcLine, fsc_CalcSpline, EvaluateSpline, fsc_SetupScan, fsc_FillBitMap, LookForDropouts, DoHorizDropout, DoVertDropout, HorizCrossings, VertCrossings, CheckHorizTopology, CheckVertTopology, AddHorizOn/Off, AddVertOn/Off, CalcHorizSpSubpix and friends, fsc_RemoveDups, fsc_MeasureGlyph, fsc_CalcGrayMapGdiCompatible, fsg_ExecuteGlyph (the SCANCTRL decision), itrp_ISECT, itrp_MUL, itrp_IUP, mth_Max45Trick, mth_IntelMul. Each mechanism was confirmed by native GetGlyphOutline captures, and the scan converter additionally by emulating the native fsc_FillGlyph with Unicorn on 10,400 random outlines (all equal to the TypeScript port).

  • Scan converter (shipped, ttf-msscan.ts). GDI does not flatten curves or sweep profiles: each edge is walked over the scanline and column centres it crosses with integer arithmetic (Bresenham for lines; for a quadratic arc split at its x and y extremes with a rounded de Casteljau, a decision variable that is the arc's implicit function at the next corner, truncated in its partial sums once the arc is larger than 8 units), vertices exactly on a centre line add crossings by their neighbours, and dropout control looks for equal start and end crossings (simple: left or lower pixel; smart: the pixel nearest the midpoint evaluated on the original segment by integer bisection; stub rule: crossings counted in the squares beside the dropout). The pixel box comes from the control points (a dropout pixel outside it moves onto its edge, which is why Courier New 8 px o had a pixel in column 1 that no distance rule gives). Results: 6,740 of 6,740 mono-sheet-glyphs bitmaps (bold, italic and condensed included; 6,718 before), all 2,068 gdi-gray-glyphs bitmaps (63 to 94 of 94 per set before), every private-font gray bitmap (ttf-gray-dropout: 517, 3,852, 3,747, 4,027 and 4,045 of 4,096 at 8 to 32 ppem before, 4,096 each now, and 1,024 of 1,024 above 32 ppem), 3,500 of 3,564 gray-sheet-glyphs captures (generate-gray-sheet-glyphs.ps1) at the sizes where the converter draws gray (the 64 left are weight-600 Segoe UI and Tahoma style sets, a face mapping question). GDI gray text is the 4x4-oversampled scan of the outline multiplied by 4 (left edge aligned to a multiple of 4), counted per block. A font without SCANCTRL gets simple dropouts up to 32 ppem in gray as in mono.
  • Hinting arithmetic (shipped). ISECT divides twice with half-away rounding on the form that divides by the larger component of the second line (parallel lines meet halfway between the lines' midpoints); MUL of operands up to 46,340 is (a * b + 32) >> 6 (a tie rounds up: -144 * 34 = -76); IUP orders touched points of equal font units the other way (the later one first), lets the second shift win when a point is at or before the first's original position and at or after the second's, shifts by the first's delta when the font units are equal, and uses a 16.16 scale once either span reaches 0x8000; SCANCTRL keeps the last value only and is evaluated once per glyph (on when bit 8 and ppem at most the threshold, or rotated and bit 9, or stretched and bit 10; the off bits play no part). Upright regular glyph outlines now equal GGO_NATIVE point for point in 5,540 of 5,540 (63 differed), the single-instruction sweeps are off at 3 of 166,400 points (5 before).
  • Rotated glyphs (shipped). The scan converter reproduces rotated bitmaps from the native outline at every angle except odd multiples of 45 degrees, where native behaves as if the outline were one 26.6 unit to the right (221 of 221 glyphs at each of 45, 135, 225, 315 with the shift, 134, 123, 95 and 115 without; mth_Max45Trick tests whether a matrix row has two components within 33/65536). The engine applies the shift when the rotation matrix is that close to a diagonal. rotated-glyph-bitmaps-small: 1,986 of 1,989 exact.
  • Fixtures (differing pixels, before -> after): textx-arial-aa 49 -> 1, -segoeui-aa 65 -> 10, -timesnewroman-aa 55 -> 2, -tahoma-aa 47 -> 0, -couriernew-aa 13 -> 0, -wmf-arial-aa 28 -> 1, -world-aa 3 -> 0, -escapement-aa and -mono 14 -> 5, -wmf-escapement-mono 9 -> 0, -rotalign-esc, -esc-small, -world 15, 13, 15 -> 0, every -mono and -cell-mono and -styles-mono sheet to 0, textx-fon-msshelldlg and -cell 16, 11 -> 0, text-msshelldlg-hm13 2 -> 0, emfrec-text-exttextouta 2 -> 0, textpb-segoeui-cell-q3 44 -> 0 and -em-q3 8 -> 0 against the native playback.
  • Open. (1) Where two glyph bitmaps of a grayscale run overlap, native is neither the larger level (what the converter does) nor the sum nor the union of the glyphs' 4x4 samples: pairs (4, 10) -> 12, (4, 5) -> 8, (4, 13) -> 16, (3, 2) -> 4, (9, 3) -> 11, (6, 15) -> 16, (10, 6) -> 14, but (4, 8) and (2, 8) are the larger level; all the remaining pixels of textx-segoeui-aa (10), -timesnewroman-aa (2), -arial-aa (1), -wmf-arial-aa (1) and textx-eto-aa (1) are such pixels. Tried: max (current), sample union (four fixtures worse, 14 more wrong pixels, one better). (2) The remaining 5 pixels of textx-escapement-* are three rotated curved glyphs whose rotation matrix differs by one 16.16 unit: native computes the matrix in bSetXform / fs__NewTransformation / scl_InitializeScaling as float32 to 16.16 (bFloatToL), scaled by FixMul with upem * 9 * 2^35 / (xRes * pointSize) and again by the folded point size, then divided per row by the rounded major component (mth_IntelMul rounds each product half away from zero). The pieces are read but the values GDI puts in the font context are not reproduced; the deciding experiment is a capture of the point-size and resolution fields. (3) GDI+ AntiAlias and AntiAliasGridFit still use the old rasterizer: with the new scan converter the private-font controls rise (AntiAlias st0 3,709 -> 3,945, st4 3,712 -> 4,059, st1 4,028 -> 4,096, st5 4,046 -> 4,096 of 4,096, Georgia 1,060 -> 1,066) but two diagonal-coverage controls (projection:16:3:2, vectors:16:3:11) get worse, so it was not shipped. (4) Weight-600 style sets of Segoe UI and Tahoma in gray-sheet-glyphs.

Round 12 (GDI+ scaled grayscale text) ​

The GDI scan converter for installed-font GDI+ AntiAlias and AntiAliasGridFit text now also runs under a world scale other than 1 (it was identity only). emf-plus-text-alignment-scale: 27 captures become exact (25 Arial, 2 held-out Arial), none that was exact is lost, 30 improve in total, and Arial 16 px x1.25 "AV" goes from 129 to 130 differing pixels (ceiling raised, accepted by the project owner); other groups unchanged. Private font collections keep the old rasteriser.

Round 12 (GDI+ text): SingleBitPerPixel dropout control ​

textx-plus-singlebit (30 differing pixels, never classified before) is all scan conversion, none placement or outline: every pixel was an isolated one on a curve apex or a thin diagonal join (Arial 16, Segoe UI Bold 12) or a missing one in Times New Roman Italic 22. Unhinted GDI+ monochrome glyphs (SingleBitPerPixel, no grid fit) run no glyph program, so the font sets no SCANCTRL and the converter used the default of dropout control on up to 32 ppem. Sweeping the rasterizer modes on the fixture: font default 30 pixels, no dropout control 22 (the Times pixels then go missing), simple control without stubs (mode 1) 0, modes 0, 4 and 5 give 30, 48 and 22. UNHINTED_MONO_DROPOUT applies mode 1 to unhinted GDI+ monochrome text; grid-fit monochrome keeps the font's own SCANCTRL (textx-plus-singlebitgridfit stays exact). GDI report 885 to 886 of 910 exact, no other line changes; the other four GDI+ text lines (AntiAlias, AntiAliasGridFit, ClearType, gpx-rec-textcontrast-cleartype) are unchanged.

Round 12 (rotated GDI text with an escapement): the playback stretch ​

Measured against main effcf33 (885 of 910 report comparisons exact; 887 after: textx-escapement-aa and -mono 5 -> 0 px, nothing worse). Method: instead of capturing the font context, the 16.16 matrix was read off native GetGlyphOutline of private fonts (the round 8 far-point fonts, build-rotation-matrix-font.py, now also in the variants intppem and bigint) at 3,600 escapements and 41 heights, and the fixture's own glyphs were compared as bitmaps (GetGlyphOutline(GGO_BITMAP) of "Escape 0123456789", Times New Roman -16, at 30 and 120 degrees).

  • The matrix was not off by one unit; the fixture glyphs were drawn without the playback stretch. Native bitmaps of those glyphs, outside any metafile, equal the converter's for 30 of 32 glyphs, and the two that differ ('6') are not in the fixture. The 5 pixels came from the recording: its GM_COMPATIBLE record stores exScale / eyScale and native playback stretches the text space by their ratio, 1.000558 (playbackStretch was applied to upright runs only).
  • Order of the stretch. A GM_ADVANCED world transform diag(k, 1) with an escapement gives the matrix diag(k, 1) * rotation (x vector (k cos, sin), y vector (-k sin, cos): reproduced by the converter's rotationMatrix for all 32 glyph bitmaps), but native playback matches rotation * diag(k, 1) (x vector k (cos, sin), y vector (-sin, cos)): in a sweep of Arial and Times New Roman at 12, 16, 20 and 28 px, 50 escapements, 8 single-glyph TextOut records per metafile played back natively, 231 of 3,200 glyph cells differ without the stretch, 206 with diag(k, 1) * rotation and 25 with rotation * diag(k, 1). Drawing the same glyphs directly differs from the playback in 27 cells of Arial 16 px both under a world transform diag(k, 1) and without one, so playback is neither.
  • 16.16 values read natively (upem 64 and 2048 private fonts, ma0 / ma1 style sweeps, kept in the scratchpad). For a pure escapement the minor ratio is round(65536 * A / B) with A, B the minor and major components times ppem * 65536 / unitsPerEm rounded: 1,051 of 1,424 rows at upem 64, and for 2048-unit fonts all 2,492 far-point rows within the 1/64-pixel resolution. The residual rows differ by one unit; a rounding order (float32 chain, bFloatToL, FixMul steps) was not found by fitting. Read, not reproduced: bSetXform in fontdrvhost.exe appears to scale the matrix entries by FixMul with upem * 72 * 2^16 / (xRes * pointSize) (through CompDiv) before fs_NewTransformation.
  • Shipped. rotationMatrix accepts a rotation with a stretched x axis and divides each axis vector by its own major component; drawGdiTextCall multiplies the glyph frame of a rotated run by diag(k, 1) on the right when the record is GM_COMPATIBLE. New standalone probe mode text-escapement-playback (TextEscapementPlaybackProbe.cs; 20 metafiles and their native playback in src/__fixtures__/gdi/text-escapement-playback/, 1.9 MB, kept out of the report's top level) pinned by src/gdi-escapement-playback.fixture.test.ts (395 px in all; 14 of 20 sheets within 3 px).
  • Open. The whole-pixel size a rotated glyph is hinted at is round(ppem * major) at 1/32-pixel resolution here. When the value is within 1/64 of a half pixel, native is not a function of it: 14 px at 55.2 degrees (11.499) and 13 px at 223.1 degrees (9.495) go down natively, 18 px at 113.6 degrees (16.499) goes up, and of the unstretched bigint rows with ppem * major in that zone 2,096 round up and 2,120 down with no feature found (quadrant, major axis, parity, A, B, minor remainder). Plain rounding of the exact value fixes the 13 and 14 px lines and breaks the 18 px one (a wider sweep of the same five faces at 9 to 48 px: 184 -> 148 differing cells, 1,579 -> 1,069 pixels) and loses the world-rotation probe (1,244 of 1,292 sizes against 1,268), so the grid rule stays. This is what is left of the 12 px lines of the new sheets (a whole line each) and of single lines at 9, 13 and 14 px. To settle: a unicorn run of fs__NewTransformation and scl_InitializeScaling on the 16.16 matrix with the context fields bSetXform writes, or a native read of the ppem GDI hands to the scaler.

Round 12 (overlapping grayscale glyphs) ​

Probe: ExtTextOut of two characters with lpDx offsets from -30 to 30 (so the glyphs overlap by every amount), black on white at ANTIALIASED_QUALITY, against each character drawn alone at the same positions; 12 pairs over Arial 16, 24, 40 and 33 bold, Segoe UI 20, Times New Roman 30 italic and Tahoma 13. For every pixel inked by both glyphs the combined level depended only on the two single levels, and for levels 2 to 16 (all 15 x 15 pairs seen) it is the bitwise OR of (level - 1): (4, 10) -> 12, (2, 3) -> 4, (5, 9) -> 13, (3, 5) -> 7, anything with 16 -> 16. Level 1 is value 0 and leaves the other glyph alone. The converter merges the glyph bitmaps of a gray run that way instead of taking the larger level (compositeGlyphs). textx-arial-aa, -segoeui-aa, -timesnewroman-aa, -eto-aa and -wmf-arial-aa are exact (1, 10, 2, 1, 1 pixels before); 890 of 910 report comparisons exact (885 before), none worse. Only black on white was probed; the rule is on the coverage values before the blend. The win32kfull routine was not read; the probe table fixes the rule.

Tooling ​

  • Regenerating existing groups: running existing fixture groups on the Windows runner can change their PNGs, because the runner's OS, fonts and DPI can differ. Compare before replacing committed fixtures.

Every new generator run writes an environment-<groups>.json manifest associating reference hashes with Windows/native-library versions, screen DPI and installed font hashes. This makes subsequent environment changes detectable; it cannot recover the environment of earlier captures.

Released under the Apache-2.0 License.