microsoft / microsoft/Windows-classic-samples

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

Open
#189 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
5.7k
Forks
3.3k
PR merge metrics
No merged PRs in 30d

Description

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:

  • in CustomText.cpp, there are three defines: ISOLATE_CALLS, ENABLE_JAPANESE_TEST, ENABLE_VERTICAL_TEST
  • ISOLATE_CALLS will remove all the superfluous calls (font weight, underline, typography etc)
  • ENABLE_JAPANESE_TEST will replace the string with some kanjis
  • ENABLE_VERTICAL_TEST will enable vertical reading and right to left flow
  • I have also added ENABLE_JAPANESE_TEST and ENABLE_VERTICAL_TEST to SimpleText.cpp, showing that without a custom text renderer it works

How to reproduce:

  • apply the patch file
  • build and run the sample
  • you can confirm in the Simple Test tab that vertical orientation works without a custom text renderer
  • switch to Custom Text Renderer tab to confirm it is not working
  • you can try a different combination of the defines to test the changes

Environment:

  • Windows 10 Pro 20H2 build 19042.985
  • Windows SDK 10.0.17763.0
  • DirectX 12
  • Visual Studio Pro 2017

Thank you in advance for the help.

vertical_jp_test_patch.diff.txt

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with CustomText.cpp and SimpleText.cpp, then apply the attached patch and run the sample using ENABLE_JAPANESE_TEST and ENABLE_VERTICAL_TEST. Compare the working Simple Text tab with the failing Custom Text Renderer tab, and trace the exception before DrawGlyphRun(); done means vertical right-to-left Japanese text renders with the custom renderer.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.