Open dotMorten opened 5 years ago
I'm guessing this would be done on the DirectWrite level though
Yes, DWrite should already handle this if you tell it so:
https://blogs.windows.com/buildingapps/2017/06/06/using-color-fonts-beautiful-text-icons
@mikedn Thanks. Info added to issue
Ahm, but then WPF doesn't actually use D2D, it only uses DWrite. That might mean that to implement this you need to do some more involved work in WPF's rendering code. I think, it's been a while since I looked at WPF's text rendering...
@dotMorten - This looks like a great feature addition. Unfortunately, at this time we are unsure of the exact time when the native layers will be open sourced. I will move this to future for now.
@mikedn DWRITE already has complete color font support. Just use IDWriteFactory4::TranslateColorGlyphRun
@be5invis I know, but as I mentioned above DWrite isn't the problem. The problem is WPF's rendering which is unlikely to support colored glyph run. It's been a while since I looked at that code but I don't expect it to be easy to add such support.
@mikedn
It is not that complex. Color glyph conversion lies at the very final end so you can just wrap your original draw call into something like this: https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/DWriteColorGlyph/cpp/CustomTextRenderer.cpp (this one supports all latest DWRITE's color formats, even SVG).
Other notable features of Emoji support:
cc. @fdwr
I know it might not be ideal, but you can solve that issue with Xaml Islands.
https://github.com/windows-toolkit/WindowsCommunityToolkit/issues/3216#issuecomment-617431386
Can't believe this is still not supported out-of-the-box... It's 2020 already 🤦
@be5invis @dotMorten @virzak @mikedn @Bart-Verdonck Any news for support colored Emoji in WPF? AFTER 2 YEARS?????
@Lorymi, WPF is more like "put to maintenance mode". You won't get any new features sticking to it. Just bug fixes and .NET 5+ support. It will be superceded by WinUI, no matter what people wants.
@ShankarBUS Thanks. UWP status challenged by the destruction of WINDOWS PHONE No new features will be added to WPF It's very sad that in 2020 Microsoft does not care about desktop programmers While Google, Apple and Facebook and etc.. are all looking for innovations and new features tailored to the needs of users
@be5invis @dotMorten @virzak @mikedn @Bart-Verdonck Any news for support colored Emoji in WPF? AFTER 2 YEARS?????
If you want support for colored fonts, you could try UWP. It's not ideal, but it has gotten better over the years for desktop development.
I want to ask if there is any progress on this question? If PresentationNative_cor3.dll can be open sourced, maybe you can help solve this problem.
FYI, I now consider Emoji.Wpf to be in very good shape. It may have its shortcomings and does not replace a native solution, but it’s pretty robust for many uses.
If any people following this thread have been considering it but did not end up using it, I’d be happy to hear why. Also any suggestions and feature requests are welcome.
FYI, I now consider Emoji.Wpf to be in very good shape. It may have its shortcomings and does not replace a native solution, but it’s pretty robust for many uses.
If any people following this thread have been considering it but did not end up using it, I’d be happy to hear why. Also any suggestions and feature requests are welcome.
Well, in my case the biggest issue is that your library doesn't support the textbox control.
Well, in my case the biggest issue is that your library doesn't support the textbox control.
@XamDR Note that emoji:RichTextBox
has a bindable Text
property (which is even two-way bindable in the current master
branch), making it a more acceptable replacement for the standard TextBox
.
I understand why one would want a stripped down version that behaves a lot more like TextBox
, so you may now follow this issue.
It's been almost 5 years since this question was opened, is there any progress on this issue?
@fcharlie - Unfortunately no. We haven't been able to pick this item due to existing commitments.
We will get to this as soon as possible.
@pchaurasia14 When you get to it, feel free to ask me questions, as I worked on DirectWrite for 10 years and integrated color SVG/bitmap fonts into XAML rendering a while back (2016-03-04). Granted, I'm not sure how much code similarity there is between it and WPF.
@fdwr - Absolutely :)
Hey, this issue has been created for 6 years. How is the progress now?
Currently when you render emojis in WPF, they are rendered black'n'white, and not rendering with the correct emoji color. It would be good if we could update the text rasterizer renderers to render with the correct color. There's a proof of concept implementation here: https://github.com/samhocevar/emoji.wpf, so perhaps @samhocevar would be willing to contribute? (I'm guessing this would be done on the DirectWrite level though)
Screenshot from Emoji.WPF
Documentation how this works from https://blogs.windows.com/buildingapps/2017/06/06/using-color-fonts-beautiful-text-icons/#Crwe2VHsjP5PgAXS.97 (thanks @mikedn):
Also for discussion: Should we have a IsColorFontEnabled property that turns this behavior on/off, and should it be default like in UWP (behavior change). Also only 8.1+ uses the
D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT
flag, so I'm assuming the behavior would always be black/white on Win7 and 8.0