microsoft / Windows-classic-samples

This repo contains samples that demonstrate the API used in Windows classic desktop applications.
Other
5.07k stars 3.24k forks source link

Vertical reading direction / Right to left flow not supported with a custom text renderer #189

Open JLL opened 3 years ago

JLL commented 3 years ago

I'm trying to use the custom text renderer (from the DirectWrite Hello World sample) in order to render fonts with an outline color different from the fill in. However, when I set the text reading direction and flow vertically (for Japanese), two exceptions are thrown and nothing gets displayed

Exception thrown at 0x7675A6E2 in DWriteHelloWorld.exe: Microsoft C++ exception: OSException at memory location 0x0053EFFC. Exception thrown at 0x7675A6E2 in DWriteHelloWorld.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.

I was thinking, maybe the implementation of DrawGlyphRun() is incomplete but the function is actually never called: exception gets thrown before it can call it.

I have attached a patch file (just remove the .txt extension) that enables a quick switch between both behaviors:

How to reproduce:

Environment:

Thank you in advance for the help.

vertical_jp_test_patch.diff.txt

JLL commented 3 years ago

@oldnewthing Sorry for the ping, could someone please take a look at this and confirm? Thank you.