| Previous | Next |
| D2DERR_TARGET_NOT_GDI_COMPATIBLE | D2DERR_TEXT_RENDERER_NOT_RELEASED |
D2DERR_TEXT_EFFECT_IS_WRONG_TYPE
D2DERR_TEXT_EFFECT_IS_WRONG_TYPE identifies a failure in Direct2D and DirectWrite text callback contracts. A drawing effect attached to a text range is not of the type expected by the Direct2D text renderer.
Facts worth preserving
| Record | Why it matters here |
|---|---|
| Text range and effect object identity | Recording text range and effect object identity separates the Direct2D and DirectWrite text callback contracts boundary from a later wrapper symptom. |
| COM interfaces supported by the effect object | Recording COM interfaces supported by the effect object ties the HRESULT to the Direct2D and DirectWrite text callback contracts boundary rather than to the final visible failure. |
| Custom IDWriteTextRenderer implementation | Comparing custom IDWriteTextRenderer implementation shows whether this result follows input, object state, or environment. |
| DrawText or DrawTextLayout call and callback sequence | Preserving DrawText or DrawTextLayout call and callback sequence provides the evidence needed to test this distinction: iNVALID_PROPERTY concerns Direct2D effect metadata; this code concerns DirectWrite text drawing effects passed through rendering callbacks. |
Subsystem context
Text rendering crosses IDWriteTextLayout, drawing effects, renderer callbacks, COM reference counting, font resources, and optional glyph-image formats. A drawing-effect type mismatch, retained callback renderer, and invalid glyph image are separate failures even though all may occur during one DrawTextLayout call.
IDWriteTextLayout drawing-effect objects and renderer interpretation.
Isolation procedure
Render plain outline text with no drawing effect, then add the effect object, custom renderer, and requested glyph image format one at a time. Track AddRef and Release around callbacks and retain the exact font face and glyph index.
- Use a known brush as the drawing effect.
- query the expected interface before rendering.
- Remove effects from ranges to establish baseline text rendering.
- Test custom renderer and Direct2D default renderer separately.
Do not hide the original condition
INVALID_PROPERTY concerns Direct2D effect metadata; this code concerns DirectWrite text drawing effects passed through rendering callbacks. 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.
What each result would imply
| Test | Interpretation | Hold constant |
|---|---|---|
| Same environment, reduced input | If this result disappears with a smaller faithful case, complexity within Direct2D and DirectWrite text callback contracts is implicated. | Keep text range and effect object identity fixed while simplifying custom IDWriteTextRenderer implementation. |
| Same input, fresh object instance | If it 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. | Place COM interfaces supported by the effect object on the timeline of the last successful transition. |
| Same operation on a controlled second path | If it follows one environment, the failure is not explained by source data alone. | Compare adapter and feature level, factory and device generations, target identity, debug-layer output, and thread ownership while preserving DrawText or DrawTextLayout call and callback sequence. |
Verification after repair
A correction 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 “Use a known brush as the drawing effect” and confirm that the following lifecycle step also succeeds.
Technical references
Looking for a different code? Search another status or error code.
