Repository navigation
Conversation
GDI DrawText renders colour fonts (Segoe UI Emoji) black and white.
Rows whose text contains emoji-like characters are now drawn through an
ID2D1DCRenderTarget + DirectWrite with ENABLE_COLOR_FONT, using a
GDI-compatible layout and GDI classic rendering so ordinary letters in
the row match the GDI rows next to it. Rows without emoji and any
DirectWrite failure keep the old DrawText path.
Not covered: rows drawn by the RichEdit control ("Draw RTF text in
list"), search highlight (DrawHTML), the description window.
Part of sabrogden#251.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the first part of #251: emoji in the clip list are drawn in colour. The second part of the issue (rule-based colouring of single-colour characters) is not covered.
Problem
The clip list draws its rows with GDI
DrawText. GDI has no colour font support, so emoji from Segoe UI Emoji come out as black-and-white outlines, while the same text is shown in colour in Notepad, the browser or the terminal.Fix
src/ColorEmojiText.*:ColorEmojiText::DrawColorTextdraws a row through anID2D1DCRenderTargetbound to the list DC and DirectWrite withD2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT. Font and text colour are taken from the DC, so themes and the list font setting work as before.DrawTextcall, so ordinary rows look exactly the same.DrawTextwithDT_EXPANDTABS) and rendered withDWRITE_RENDERING_MODE_GDI_CLASSIC. The DirectWrite family name is resolved throughIDWriteGdiInterop, so faces like "Segoe UI Semibold" map correctly.QListCtrl.cpponly gets the call before the existingDrawText.Not changed: rows drawn by the RichEdit control when "Draw RTF text in list" is on, rows with search highlight (
DrawHTML), and the description window. They still show emoji in black and white.Testing
MSBuild CP_Main_10.sln /p:Configuration=Release /p:Platform=x64.