windrawlib
windrawlib copied to clipboard
WIP: Add new advanced text api (D2D1 + DWrite back-end only)
Disclaimer: This is work in progress. Anything here can be changed anytime. You have been warned.
WinDrawLib already supports simple string rendering. This PR is about more advanced text rendering, so things like this could be implemented on top of it:
- interactive work with the text.
- advanced text edit control component,
- rendering of rich/complex document formats (HTML, Markdown, etc).
Note all this is for D2D1 + DWrite back-end only. Once we have something reasonably complete, we might consider also adding support for gdi+ back-end.
Rendering features:
- [x] Render complex text paragraph using different font weights.
- [x] Ditto for font styles (normal/italic/oblique).
- [x] Ditto for font families (e.g. for nesting a monotype font span inside a normal text).
- [ ] Ditto for colors and/or brushes.
- [x] Ditto for font sizes.
- [x] Ditto for underlined text.
- [x] Ditto for strikethrough text.
- [ ] Inserting inline images and/or custom drawn areas
- [ ] Replacing/augmenting text range with some painted stuff (consider e.g. a visualization of a whitespace for editor like apps, text selection)
Additional features:
- [x] Overall text metrics
- [ ] Overhang metrics (see
IDWriteTextLayout::GetOverhangMetrics()
) - [ ] Per-line metrics (see
IDWriteTextLayout::GetLineMetrics()
) - [ ] Per-cluster metrics (see
IDWriteTextLayout::GetClusterMetrics()
) - [ ] Hit testing (mapping pixel coordinates back to offset/range in the input string)
- [ ] RTL support (something implemented but needs testing)
- [ ] BiDi support (probably built-in in DWrite but needs testing)
- [ ] Navigation over offsets in the text where cursor can be placed (i.e. handle Unicode surrogate pairs or composed diacritic characters etc.)