I want to use DirectWrite for mixed-colour text formatting (syntax highlighting, to be precise), but can't seem to find a way to do it, either in the Layout or Typography options. The only option is passing a Brush when rendering the text, which doesn't work for me because I basically have just one Layout. Help!
标签:
directwrite
相关问题
- What are the default typography settings used by I
- How to draw text with the default UI font in Direc
- Determine text boundary box with Direct2D/DirectWr
- How to create IDWriteTextFormat from IDWriteFontFa
- Unresolved external symbol
相关文章
- What are the default typography settings used by I
- How to draw text with the default UI font in Direc
- Determine text boundary box with Direct2D/DirectWr
- DirectWrite的RegisterFontFileLoader:创建一个字体文件加载器和德尔福
- 如何创建IDWriteFontFace IDWriteTextFormat(How to creat
- 我怎样才能呈现DirectWrite中混合彩色文本?(How can I render mixed-
- 确定使用Direct2D / DirectWrite的文本边界框(Determine text bo
- How to create IDWriteTextFormat from IDWriteFontFa
Use
IDWriteTextLayout::SetDrawingEffect
to apply drawing effects on subranges. If you're using DWrite with D2DDrawTextLayout
, which it sounds like you are, then that drawing effect would just be a brush (such asID2D1Brush
viaCreateSolidColorBrush
or one of the gradient brushes). If you have implemented your ownIDWriteTextRenderer
forIDWriteTextLayout::Draw
, then the drawing effect can be whatever you interpret it to be. In theIDWriteTextRenderer::DrawGlyphRun
callback, you then callQueryInterface
on the drawingEffect parameter, or if you are certain it is your own type, just static_cast it directly.