directwrite

How does DirectWrite (CreateTextFormat) pick the fallback font(s)?

馋奶兔 提交于 2021-02-07 08:27:00
问题 The documentation for CreateTextFormat says nothing about font fallback selection, but if the default (NULL = system) collection is chosen, then DirectWrite clearly implements font fallback. For example, if I add two glyphs not found in the Gabriola font to the test string used by the DirectWrite SDK demo app, then DirectWrite picks the missing glyphs from the Segoe UI Symbol font. This happens with the basic DrawText call and also with a custom renderer (that does nothing custom for font

Unresolved external symbol

别来无恙 提交于 2020-01-03 17:36:51
问题 Main article there is a header file and a source file. After copying those two files and adding few headers: #include <Windows.h> #include <d2d1.h> #pragma comment(lib, "d2d1") #include <dwrite.h> #include <d2d1helper.h> #include "SafeRelease.h" //Safe realease file template<class Interface> inline void SafeRelease( Interface **ppInterfaceToRelease ) { if (*ppInterfaceToRelease != NULL) { (*ppInterfaceToRelease)->Release(); (*ppInterfaceToRelease) = NULL; } } when I'm trying to compile this

What are the default typography settings used by IDWriteTextLayout?

梦想与她 提交于 2019-12-22 00:26:55
问题 I would like to disable ligatures, which appear to be enabled by default, at least in the fonts that I'm using (i.e. Calibri). It appears that the way to do this is to use IDWriteTextLayout::SetTypography to set an IDWriteTypography object to the layout which contains the various ligature-related font features with a value of zero to disable them. That works to disable the ligatures, but it also affects (disables) other typography settings that I don't want to mess with, such as kerning.

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

青春壹個敷衍的年華 提交于 2019-12-21 05:18: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

DirectWrite RegisterFontFileLoader :create a font file loader and register it in Delphi without access violation

為{幸葍}努か 提交于 2019-12-13 18:40:07
问题 I am trying to register a DirectWrite (Windows 7, Windows 8) API based font file loader, and recreate in Delphi, the CustomFont demo from the Windows 7 SDK that shows how to use DirectWrite APIs with a custom font collection. This allows DirectWrite to use fonts you loaded yourself from inside your application resources that are not globally registered in the Windows font system. I am stuck with an access violation. A minimal sample is below. First a doubt I have about the Delphi Direct2D

How to create IDWriteTextFormat from IDWriteFontFace

人盡茶涼 提交于 2019-12-10 19:19:09
问题 I'm creating W8 C++/CX DirectX application and I'm trying to use custom font file from application own storage. I figure out how to use IDWriteFactory::CreateFontFileReference to load IDWriteFontFile from directory and then how to create IDWriteFontFace from it. What I don't know now is how to use IDWriteFontFace for loading IDWriteTextFormat , if it is possible at all. Should I do this though IDWriteFontCollection ? Sorry if the answer is really stupid and trivial, I am very new to DirectX

How to draw text with the default UI font in DirectWrite?

ぃ、小莉子 提交于 2019-12-09 21:59:35
问题 The CreateTextFormat method expects a fontFamilyName parameter. How do I create an IDWriteTextFormat that uses the default UI font? 回答1: Please note, that all code here is done without any checks (too many methods here return HRESULT, would blow this example up!). For acquiring the system wide font you should use this: (This is from another stackoverflow question!) NONCLIENTMETRICS ncm; ncm.cbSize = sizeof(ncm); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); HFONT hFont =

Determine text boundary box with Direct2D/DirectWrite

两盒软妹~` 提交于 2019-12-06 08:25:59
问题 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

How can I render mixed-colour text in DirectWrite?

瘦欲@ 提交于 2019-12-06 03:33:38
问题 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! 回答1: 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

How to draw text with the default UI font in DirectWrite?

梦想与她 提交于 2019-12-04 17:23:02
The CreateTextFormat method expects a fontFamilyName parameter. How do I create an IDWriteTextFormat that uses the default UI font? Arthur P. R. Please note, that all code here is done without any checks (too many methods here return HRESULT, would blow this example up!). For acquiring the system wide font you should use this: (This is from another stackoverflow question!) NONCLIENTMETRICS ncm; ncm.cbSize = sizeof(ncm); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); HFONT hFont = CreateFontIndirect(&(ncm.lfMessageFont)); // for paint now use this: HDC hdc = BeginPaint(...)