Skip to content

#10477: Handle things above U+FFFF in GDI renderer - #10580

Merged
1 commit merged into
microsoft:mainfrom
alabuzhev:main
Jul 8, 2021
Merged

1 commit merged into
microsoft:mainfrom
alabuzhev:main

Conversation

@alabuzhev

Copy link
Copy Markdown
Contributor

Implementation of #10477 - handle surrogate pairs in GDI renderer.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Why not let Windows draw surrogate pairs? It can do that.

Basically, the comment says everything:

// Our GDI renderer hasn't and isn't going to handle things above U+FFFF or sequences.
// So replace anything complicated with a replacement character for drawing purposes.

However, handling things above U+FFFF doesn't really require extra effort. It's enough to:

  • Put all characters to the output buffer
  • Set the first width to cluster width and the rest to 0
  • Sit back and relax while Windows does the rest

Validation Steps Performed

@echo off
chcp 65001

echo 𠜎𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎
echo 👨👩👧👦

Save this as a UTF-8 cmd file and run.

Before the change

image

After the change

image

An example of a third party app working with surrogate pairs in a patched OpenConsole:
image

As discussed, this change doesn't claim to be the full support for surrogate pairs (there are still corner cases possible), but brings it on par with Terminal with minimal effort.

@ghost ghost added Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Impact-Compatibility Sure don't work like it used to. Impact-Correctness It be wrong. Issue-Task It's a feature request, but it doesn't really need a major design. Priority-2 A description (P2) Product-Conhost For issues in the Console codebase labels Jul 7, 2021
@miniksa Michael Niksa (miniksa) added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jul 8, 2021
@ghost

Copy link
Copy Markdown

Hello Michael Niksa (@miniksa)!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost
ghost merged commit cdecfcd into microsoft:main Jul 8, 2021
@ghost

Copy link
Copy Markdown

🎉Windows Terminal Preview v1.10.1933.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues AutoMerge Marked for automatic merge by the bot when requirements are met Impact-Compatibility Sure don't work like it used to. Impact-Correctness It be wrong. Issue-Task It's a feature request, but it doesn't really need a major design. Priority-2 A description (P2) Product-Conhost For issues in the Console codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle things above U+FFFF in GDI renderer

3 participants