Forum > LCL

How to display coloured emojis on Windows?

(1/6) > >>

Gustavo 'Gus' Carreno:
Hey Y'all,

I was able to convince a couple of user over at the Discord server Unofficial Free Pascal(https://discord.gg/yQhwhfZS) to compile the attached project and they provided me with a screenshot of what it looks like under Windows 10. I'm also attaching how it looks under Ubuntu 21.04 64b.

If we go over to emojipedia.org, they use both UTF8 emojis and images to display their information.
When I was testing my project under a Windows Server 2012 VPS, I pointer Google Chrome at it and the UTF8 emojis where coloured.

So, what do I have to do to have my app tap into the coloured UTF8 emojis?

Is it a matter of font? Or something else like a codepage?

I'm lost and a complete ignorant of both how Windows renders UTF8 glyphs and the whole UTF8 thing to be honest, so any hint and/or pointer to some helpful implementation would be very welcomed!!

Cheers,
Gus
PS: I sure wish we could have a BBCode tag to include an image in the text and not only on the attachments...
Maybe I'm being spoiled by GitHub's Markdown editor or the Discord client LOL!!

Jurassic Pork:
hello,
i don't know if you can use this option in Lazarus :

--- Quote ---D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT
In Windows 8.1 and later, text is rendered using color versions of glyphs, if defined by the font.
--- End quote ---

Friendly, J.P

Gustavo 'Gus' Carreno:
Hey J.P.,


--- Quote from: Jurassic Pork on September 24, 2021, 10:08:06 am ---i don't know if you can use this option in Lazarus :

--- Quote ---D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT
In Windows 8.1 and later, text is rendered using color versions of glyphs, if defined by the font.
--- End quote ---

--- End quote ---

Thanks, I'll try and look this up. I hope I can suss this out even without access to a Windows machine :)

Cheer,
Gus

Martin_fr:
The "old" API does not support this according to my google searches. So functions like TextOutA / TextOutW (Afaik used by the LCL) will not do the trick.

https://stackoverflow.com/questions/46892844/gdi-can-i-use-the-new-windows-10-segoe-ui-emoji-colored-font-with-drawtext
The answer seems to lead to this: https://docs.microsoft.com/en-us/windows/win32/directwrite/direct-write-portal

Gustavo 'Gus' Carreno:
Hey Martin,


--- Quote from: Martin_fr on September 25, 2021, 04:15:05 pm ---The "old" API does not support this according to my google searches. So functions like TextOutA / TextOutW (Afaik used by the LCL) will not do the trick.

--- End quote ---

That's a bummer :(


--- Quote from: Martin_fr on September 25, 2021, 04:15:05 pm ---https://stackoverflow.com/questions/46892844/gdi-can-i-use-the-new-windows-10-segoe-ui-emoji-colored-font-with-drawtext
The answer seems to lead to this: https://docs.microsoft.com/en-us/windows/win32/directwrite/direct-write-portal

--- End quote ---

This looks quite more complicated than just drop some TLabels on a TFlowPanel...

Is there anything in laz-main that I can look at that uses this new approach?

And, Martin, THANK you SOOOO very much for doing the leg work, I really appreciate it :) really I DO!!

Well, if all else fails, the place I'm extracting the data for these lists has a *.png file that illustrates an example.
So a solid plan B would be to use TImages on the TFlowPanel instead of the current TLabels when it comes to Windows.

It's a pity that Windows always has to be de odd one out :(

Cheers,
Gus

Navigation

[0] Message Index

[#] Next page

Go to full version