[PR #1873] [MERGED] Fixed DirectX RTL text issue where it'd be over other text / offscreen #24677

Open
opened 2026-01-31 09:04:44 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/1873
Author: @schorrm
Created: 7/8/2019
Status: Merged
Merged: 7/10/2019
Merged by: @DHowett-MSFT

Base: masterHead: master


📝 Commits (8)

📊 Changes

1 file changed (+17 additions, -4 deletions)

View changed files

📝 src/renderer/dx/CustomTextLayout.cpp (+17 -4)

📄 Description

This is a partial fix of #538 . This does not change the Console RTL behavior, it does however fix an issue in the rendering. Basically, DirectX expects the origin to be on the right if it is going to draw RTL text. This PR is a simple fix for that. Rather than draw with the left point and then move the origin rightwards, we check if it's RTL, if so, we move the origin rightwards immediately, and then draw. LTR rendering is unchanged.
This doesn't fix underlying questions of RTL handling in the console. It's just a render bugfix. However, this render bugfix should still be a big help and solve the low-hanging issues.

PR Checklist

  • Closes #xxx
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Validation Steps Performed

Behavior was tested. No changes were made to underlying console.
Three sample cases:

  1. RTL text input
    Before:
    image
    After:
    image
  2. Hebrew Output
    Before (the Hebrew text is all being drawn to the left of the screen, hence the phantom text):
    image
    After:
    image
  3. Mixed Output
    So, this is where this is partial. Due to inherent stuff with RTL behavior, it doesn't look perfect. But the rendering itself is no longer at fault.
    Before:
    image
    After:
    image

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/1873 **Author:** [@schorrm](https://github.com/schorrm) **Created:** 7/8/2019 **Status:** ✅ Merged **Merged:** 7/10/2019 **Merged by:** [@DHowett-MSFT](https://github.com/DHowett-MSFT) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (8) - [`5cb148c`](https://github.com/microsoft/terminal/commit/5cb148cbf8457b136412b871d4a1be3182ed00f6) Fixed DirectX RTL text issue where it would appear to left, potentially over existing text - [`3535bc3`](https://github.com/microsoft/terminal/commit/3535bc3e2470d118751eda4dca5bc194afac1aa2) checking the formatting - [`c002178`](https://github.com/microsoft/terminal/commit/c0021786ae25565b8d00a01f3dfca7b66e35f43f) Revert "checking the formatting" - [`6ce474a`](https://github.com/microsoft/terminal/commit/6ce474aa2c15e0d3dca3b300206696583d43a0d2) Fixed commenting, added curly brackets - [`f1befdb`](https://github.com/microsoft/terminal/commit/f1befdbfd7e12fd1dfcf18f0a201fa2aef2e83f4) Make postOriginX const - [`19b9af5`](https://github.com/microsoft/terminal/commit/19b9af5569247d7bfadc8d3aa930f26b89c0bc47) Realigned spacing on postOriginX accumulate call - [`fb49f4d`](https://github.com/microsoft/terminal/commit/fb49f4d38eb8d6506abf6046f85d3678fe8526dc) Merge branch 'master' of https://github.com/schorrm/terminal - [`919b8b0`](https://github.com/microsoft/terminal/commit/919b8b04a5fca1c85a58299965070a56aaf5e2a6) Clang-Formatted ### 📊 Changes **1 file changed** (+17 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/renderer/dx/CustomTextLayout.cpp` (+17 -4) </details> ### 📄 Description This is a partial fix of #538 . This does *not* change the Console RTL behavior, it does however fix an issue in the rendering. Basically, DirectX expects the origin to be on the right if it is going to draw RTL text. This PR is a simple fix for that. Rather than draw with the left point and then move the origin rightwards, we check if it's RTL, if so, we move the origin rightwards immediately, and then draw. LTR rendering is unchanged. This doesn't fix underlying questions of RTL handling in the console. It's just a render bugfix. However, this render bugfix should still be a big help and solve the low-hanging issues. ## PR Checklist * [ ] Closes #xxx * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Requires documentation to be updated * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx ## Validation Steps Performed Behavior was tested. No changes were made to underlying console. Three sample cases: 1. RTL text input Before: ![image](https://user-images.githubusercontent.com/16987694/60816422-6737e100-a1a2-11e9-9e14-c62323fd5b02.png) After: ![image](https://user-images.githubusercontent.com/16987694/60816395-5ab38880-a1a2-11e9-9f0a-17b03f8268ce.png) 2. Hebrew Output Before (the Hebrew text is all being drawn to the left of the screen, hence the phantom text): ![image](https://user-images.githubusercontent.com/16987694/60816527-93ebf880-a1a2-11e9-9ba3-d3ebb46cc404.png) After: ![image](https://user-images.githubusercontent.com/16987694/60816456-77e85700-a1a2-11e9-9783-9e69849f026d.png) 3. Mixed Output So, this is where this is partial. Due to inherent stuff with RTL behavior, it doesn't look perfect. But the rendering itself is no longer at fault. Before: ![image](https://user-images.githubusercontent.com/16987694/60816593-b5e57b00-a1a2-11e9-82be-0fcabb80f7d4.png) After: ![image](https://user-images.githubusercontent.com/16987694/60816607-bb42c580-a1a2-11e9-849a-12846ec4d5c0.png) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:04:44 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24677