directwrite

Determine text boundary box with Direct2D/DirectWrite

浪尽此生 提交于 2019-12-04 14:04:10
ID2D1RenderTarget::DrawGlyphRun takes the following params: D2D1_POINT_2F baselineOrigin, __in CONST DWRITE_GLYPH_RUN *glyphRun, __in ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode /*= DWRITE_MEASURING_MODE_NATURAL */ Where DWRITE_GLYPH_RUN is struct DWRITE_GLYPH_RUN { __notnull IDWriteFontFace* fontFace; FLOAT fontEmSize; UINT32 glyphCount; __field_ecount(glyphCount) UINT16 const* glyphIndices; __field_ecount_opt(glyphCount) FLOAT const* glyphAdvances; __field_ecount_opt(glyphCount) DWRITE_GLYPH_OFFSET const* glyphOffsets; BOOL isSideways; UINT32 bidiLevel; }; I am trying to

How can I render mixed-colour text in DirectWrite?

天大地大妈咪最大 提交于 2019-12-04 07:40:10
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! Use IDWriteTextLayout::SetDrawingEffect to apply drawing effects on subranges. If you're using DWrite with D2D DrawTextLayout , which it sounds like you are, then that drawing effect would just be a brush (such as ID2D1Brush via CreateSolidColorBrush or one of the gradient brushes). If

What is the correct, modern way to handle arbitrary text input in a custom control on Windows? WM_CHAR? IMM? TSF?

▼魔方 西西 提交于 2019-12-03 16:31:28
I want to be able to support text input in a custom Windows control, just like the EDIT and rich edit controls already do, but not subclassing either of those. The control currently uses Direct2D and DirectWrite to draw text, and runs on Windows Vista SP1 with Platform Update or newer (I might change it to Windows 7 SP1 with Platform Update or newer if I decide I need newer Direct2D and DirectWrite features, assuming those are available there or on Windows 8 only, but that's a different question...) For what it's worth, on OS X I would use NSTextInputClient and on GTK+ I would use GtkIMContext

How do I balance script-oriented OpenType features with other OpenType features using DirectWrite?

孤人 提交于 2019-12-03 12:36:29
问题 Full disclosure: I'm working on my libui GUI framework's text API. This wraps DirectWrite on Windows, Core Text on OS X, and Pango (which uses HarfBuzz for OpenType shaping) on other Unixes. One of the text formatting attributes I want to specify is a collection of OpenType features to use, which all three provide; DirectWrite's is IDWriteTypography . Now, when you draw some text with these libraries, by default you'll get a few useful OpenType features enabled, such as the standard ligatures

How do I balance script-oriented OpenType features with other OpenType features using DirectWrite?

一世执手 提交于 2019-12-03 03:49:39
Full disclosure: I'm working on my libui GUI framework's text API. This wraps DirectWrite on Windows, Core Text on OS X, and Pango (which uses HarfBuzz for OpenType shaping) on other Unixes. One of the text formatting attributes I want to specify is a collection of OpenType features to use, which all three provide; DirectWrite's is IDWriteTypography . Now, when you draw some text with these libraries, by default you'll get a few useful OpenType features enabled, such as the standard ligatures ( liga ) like the f+i ligature. I thought this was font-specific, but it turns out this is specific to

Disable Cleartype (text anti-aliasing) in IE9

拟墨画扇 提交于 2019-11-28 06:56:16
It's well documented (e.g. here ) that IE9 ignores the OS-wide settings for font smoothing (aka anti-aliasing). Even if font-smoothing and ClearType are disabled in Windows, IE still shows anti-aliased fonts, which some users struggle to read, especially at small font sizes. How can I disable all font anti-aliasing (ClearType or otherwise) in IE9? More details: Our company builds a web application which uses a lot of small fonts. With the release of IE9, some of our users have complained that IE9's default anti-aliasing makes our small fonts fuzzy or blurry. So we need to help our users who've

Disable Cleartype (text anti-aliasing) in IE9

久未见 提交于 2019-11-27 01:37:25
问题 It's well documented (e.g. here) that IE9 ignores the OS-wide settings for font smoothing (aka anti-aliasing). Even if font-smoothing and ClearType are disabled in Windows, IE still shows anti-aliased fonts, which some users struggle to read, especially at small font sizes. How can I disable all font anti-aliasing (ClearType or otherwise) in IE9? More details: Our company builds a web application which uses a lot of small fonts. With the release of IE9, some of our users have complained that