zhufachang
zhufachang

Reputation: 21

Direct2D: How to convert fallback to SystemLink mode?

I am now converting a project's render engine from GDI to D2D. The GDI use "CreateFontIndirect" to assign font size "-13", font family "Segoe UI". The D2D use "CreateTextFormat" to assign font size "13", font family "Segoe UI". The effect is shown as follow picture:

enter image description here

In GDI case, the system didn't find chinese character in "Segoe UI", it will find in regedit "SystemLink" to locate the chinese font, on my machine is "YaHei". But In D2D case, the system didn't find "YaHei", Which chinese font it will choose to draw, How does it work?

Upvotes: 0

Views: 179

Answers (1)

bunglehead
bunglehead

Reputation: 1179

It works according to DirectWrite layout logic. See IDWriteTextLayout2::SetFontFallback(), you'll be able to provide your own fallback implementation, if default configuration is not satisfactory.

Basically, layout object will call your custom fallback methods to map characters to fonts, you can then detect which characters you want to map to which font, potentially reusing system fallback implementation for cases you don't care about.

Upvotes: 1

Related Questions