| Previous | Next |
| D2DERR_TOO_MANY_TRANSFORM_INPUTS | ERROR_IO_PREEMPTED |
D2DERR_INVALID_GLYPH_IMAGE
D2DERR_INVALID_GLYPH_IMAGE belongs to Direct2D and DirectWrite text callback contracts. Direct2D or DirectWrite could not decode or parse the requested glyph image data. The diagnostic goal for D2DERR_INVALID_GLYPH_IMAGE is to identify the first rejecting object and transition, not merely the final high-level symptom.
Locate the first rejecting layer
For D2DERR_INVALID_GLYPH_IMAGE, text rendering crosses IDWriteTextLayout, drawing effects, renderer callbacks, COM reference counting, font resources, and optional glyph-image formats. When D2DERR_INVALID_GLYPH_IMAGE is returned, a drawing-effect type mismatch, retained callback renderer, and invalid glyph image are separate failures even though all may occur during one DrawTextLayout call.
For D2DERR_INVALID_GLYPH_IMAGE, inspect the following boundary: font glyph-image format, table data, glyph index, palette, and rendering mode.
Controlled reproduction
Render plain outline text with no drawing effect, then add the effect object, custom renderer, and requested glyph image format one at a time in the D2DERR_INVALID_GLYPH_IMAGE path. For D2DERR_INVALID_GLYPH_IMAGE, track AddRef and Release around callbacks and retain the exact font face and glyph index.
- For D2DERR_INVALID_GLYPH_IMAGE, render an outline glyph from the same font.
- When D2DERR_INVALID_GLYPH_IMAGE is returned, test another glyph in the same image format.
- Validate the font with a trusted OpenType tool in the D2DERR_INVALID_GLYPH_IMAGE path.
- For D2DERR_INVALID_GLYPH_IMAGE, request only formats reported as supported.
Evidence that changes the diagnosis
| Record | Why it matters here |
|---|---|
| Font file hash and face index | Preserving font file hash and face index provides the evidence needed to test this distinction: this is narrower than a general font-loading failure: the face may load while one glyph image representation is invalid. |
| Glyph index and requested image format | For D2DERR_INVALID_GLYPH_IMAGE, recording glyph index and requested image format separates the Direct2D and DirectWrite text callback contracts boundary from a later wrapper symptom. |
| Color-font tables or embedded bitmap/SVG data | In D2DERR_INVALID_GLYPH_IMAGE diagnostics, recording color-font tables or embedded bitmap/SVG data ties the HRESULT to the Direct2D and DirectWrite text callback contracts boundary rather than to the final visible failure. |
| DirectWrite and Direct2D interface versions | Comparing DirectWrite and Direct2D interface versions shows whether D2DERR_INVALID_GLYPH_IMAGE follows input, object state, or environment. |
Comparison tests
| Test | Interpretation | Hold constant |
|---|---|---|
| Same environment, reduced input | If D2DERR_INVALID_GLYPH_IMAGE disappears with a smaller faithful case, complexity within Direct2D and DirectWrite text callback contracts is implicated. | For D2DERR_INVALID_GLYPH_IMAGE, keep font file hash and face index fixed while simplifying color-font tables or embedded bitmap/SVG data. |
| Same input, fresh object generation | If D2DERR_INVALID_GLYPH_IMAGE changes after rebuilding state, examine ownership across the caller’s object graph, custom effect or renderer, Direct2D validation layer, backing device, and deferred draw boundary. | For D2DERR_INVALID_GLYPH_IMAGE, place glyph index and requested image format on the timeline of the last successful transition. |
| Same operation on a controlled second path | If D2DERR_INVALID_GLYPH_IMAGE follows one environment, the failure is not explained by source data alone. | For D2DERR_INVALID_GLYPH_IMAGE, compare adapter and feature level, factory and device generations, target identity, debug-layer output, and thread ownership while preserving DirectWrite and Direct2D interface versions. |
Misleading responses
This is narrower than a general font-loading failure: the face may load while one glyph image representation is invalid. For D2DERR_INVALID_GLYPH_IMAGE, do not respond with a universal render-target recreation loop unless the returned status specifically documents device-loss recovery; graph, property, numeric, lifetime, and print-state errors require correcting their contract.
Closure criteria
A correction for D2DERR_INVALID_GLYPH_IMAGE should let the operation at the Direct2D and DirectWrite text callback contracts boundary complete repeatedly under the original supported conditions. Repeat the control that begins with “Render an outline glyph from the same font” and confirm that the following lifecycle step also succeeds. For D2DERR_INVALID_GLYPH_IMAGE, keep the original failing sample and one deliberate negative case so fallback cannot be mistaken for repair.
Technical references
When D2DERR_INVALID_GLYPH_IMAGE is returned, these references define the public API family, object model, or error list used to interpret this status.
- Microsoft: Direct2D error codes.
- Microsoft: Direct2D API overview.
- Microsoft: Introducing DirectWrite.
- Microsoft: Glyph image formats in DirectWrite.
Looking for a different code? Search another status or error code.