Fix oversized GDI glyph buffers
This commit is contained in:
@@ -3062,6 +3062,14 @@ height/width, weight, `DEFAULT_CHARSET`, and raw CP932 face bytes. Each request
|
||||
or two-byte CP932 code for `GetGlyphOutlineA(GGO_GRAY4_BITMAP)` and `GetTextExtentPoint32A`; returned masks
|
||||
flow through the same normalized `GlyphMask` contract without another pixel conversion.
|
||||
|
||||
`GetGlyphOutline`'s queried allocation size is not always identical to the rows described by
|
||||
`GLYPHMETRICS`. On the reference Windows installation, 24-pixel bold MS Mincho `p` reports a 12x15 box with a
|
||||
12-byte row stride but requests 192 bytes rather than 180; a live SC0000 run likewise produced 672 bytes for a
|
||||
25x23 box with 28-byte rows. The adapter therefore allocates and reads the complete queried size, as the API
|
||||
requires, while exposing only `stride * gmBlackBoxY` row bytes to the normalized mask/compositor. Extra storage
|
||||
is outside the drawable metric box and can contain unspecified data. Zero-byte spacing glyphs retain their
|
||||
separate transparent-mask handling; nonzero undersized buffers still fail.
|
||||
|
||||
This exact ANSI reference requires Windows system ACP 932. `TryGetAvailability` reports the active-platform/
|
||||
code-page incompatibility and the constructor refuses to masquerade as exact when unavailable.
|
||||
`GlyphRasterizerBackendInfo` identifies the backend as `windows-gdi-gray4`, native-CP932, and pixel-exact.
|
||||
|
||||
@@ -87,11 +87,30 @@ style, `GetGlyphOutlineA(GGO_GRAY4_BITMAP)` returns the spacing glyph's advance
|
||||
reports a zero-byte bitmap requirement. The adapter incorrectly required the reported buffer size to equal the
|
||||
four-byte aligned metric box and threw before P009 could be published. It now treats only a zero-byte result as
|
||||
a zero-ink glyph: the GDI placement and advance metrics are retained and the implied mask is filled with
|
||||
transparent coverage. Nonzero short or oversized payloads remain hard failures. A focused Windows regression
|
||||
reproduces the original 0-versus-4 result and verifies that the ideographic space advances without drawing ink;
|
||||
the SYSTEM4/DEBUGMAP boundary regression remains in place. The user then repeated the normal exact-GDI
|
||||
DEBUGMAP entry and confirmed that the dialogue now continues into the map without the worker failure, accepting
|
||||
the fix end to end.
|
||||
transparent coverage. A focused Windows regression reproduces the original 0-versus-4 result and verifies that
|
||||
the ideographic space advances without drawing ink; nonzero buffers smaller than the metric-defined rows remain
|
||||
hard failures. The SYSTEM4/DEBUGMAP boundary regression remains in place. The user then repeated the normal
|
||||
exact-GDI DEBUGMAP entry and confirmed that the dialogue now continues into the map without the worker failure,
|
||||
accepting the fix end to end.
|
||||
|
||||
### SYSTEM4 P009 oversized GDI buffer corrected (2026-08-16)
|
||||
|
||||
A new-game run with Ctrl held reached `SYSTEM4 P009`, whose text is `SC0000@0xa77` and whose following wait is
|
||||
`SC0000@0xa7f`, then failed while rasterizing the retained line. GDI reported a 672-byte gray-4 requirement for
|
||||
a 25x23 metric box with 28-byte rows; the adapter rejected it because the metric-defined coverage is only 644
|
||||
bytes. This is not the earlier zero-ink spacing-glyph case. A focused independent ANSI/Unicode probe reproduces
|
||||
the same oversized-storage contract with 24-pixel bold MS Mincho `p`: `GLYPHMETRICS` reports 12x15 and a
|
||||
12-byte row stride, while `GetGlyphOutline` requests 192 bytes rather than the 180 bytes described by those
|
||||
rows. The surplus may contain unspecified data and is not an additional drawable metric row.
|
||||
|
||||
The adapter now follows the two returned contracts independently: it allocates and reads the complete size
|
||||
requested by GDI, but normalizes only `stride * gmBlackBoxY` bytes into `GlyphMask` for layout/composition.
|
||||
A nonzero undersized result, a failed read, or changed metrics between the query and read remains an error. The
|
||||
regression compares the ANSI adapter with an independent Unicode GDI call, proves that the raw buffer is larger
|
||||
than the normalized mask, and checks the exact metric-defined coverage. A second regression covers every glyph
|
||||
in the reported SC0000 line with its active 24-pixel bold Mincho style. The real direct-scene harness, exact GDI
|
||||
backend, and held-Ctrl input then recorded the reported P009 coordinate and continued through P166 without a
|
||||
worker failure; the probe stopped at the later interactive name-entry boundary.
|
||||
|
||||
## Stage B0 — Ground-truth reconnaissance
|
||||
|
||||
|
||||
Reference in New Issue
Block a user