| Previous | Next |
| DWRITE_E_FILEFORMAT | DWRITE_E_NOFONT |
DWRITE_E_UNEXPECTED
DWRITE_E_UNEXPECTED belongs to an unexpected DirectWrite condition. DirectWrite encountered an unexpected internal condition but documents the result as safe for the caller to recover from.
Read the HRESULT in context
DirectWrite documents this status as recoverable, but recovery does not remove the need to identify the object and callback that reached an unexpected state. Custom font loaders, face construction, shaping, glyph analysis, and rendering parameters each have different lifetimes and data contracts.
the exact DirectWrite object and operation, especially custom loaders, font parsing, shaping, or glyph analysis.
Evidence to preserve
- Factory version and object interface
- Font loader key, file identity, face index, and simulations
- Text range, script, locale, and rendering parameters
- First method and any custom callback result
A minimal test sequence
Create a fresh factory and a system-font baseline, then add the custom loader, font file, text properties, and glyph operation separately. Rebuilding uncertain objects is safer than continuing from a callback sequence whose invariants are unknown.
- recreate the smallest factory and font face that reproduces.
- Compare system font loading with the custom loader path.
- Use a known-good font and simple text to isolate the object.
- release and rebuild DirectWrite objects rather than reusing uncertain state.
Common wrong turns
CACHEFORMAT and CACHEVERSION identify cache-file conditions; UNSUPPORTEDOPERATION is a capability result. UNEXPECTED is the broader internal fallback. Do not suppress the HRESULT just because recovery is permitted; preserve the font and call sequence so the unexpected path can be fixed.
Technical references
Looking for a different code? Search another status or error code.