emojis in webgadget showing without colors

Just starting out? Need help? Post your questions and find answers here.
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

emojis in webgadget showing without colors

Post by ricardo »

Hi,

Following this:

https://www.w3schools.com/charsets/ref_emoji.asp

If i put the code inside a string

HTML$ = "about:<span style='font-size:100px;'>&#129409;</span><p>i will display &#129409;</p><p>i will display &#x1F981;</p>"

and the load it in the webgadget, the emoji shows in black and white, no colors.

Anybody can help?

I need to load fro a string becuse im polanning to create the html with my code, im not trying to load the w3school.com pge

Thanks in advance
ARGENTINA WORLD CHAMPION
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: emojis in webgadget showing without colors

Post by IdeasVacuum »

Hi ricardo

...the emojis are displayed in black and white on the w3schools site too when viewed on my PC - they are font based and so they won't be shown in colour unless the host (your PC) already has a colour version of the font installed.

See: http://classic.getemoji.com

Edit: Different platforms, different results: https://emojipedia.org/smiling-face-with-smiling-eyes
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
firace
Addict
Addict
Posts: 946
Joined: Wed Nov 09, 2011 8:58 am

Re: emojis in webgadget showing without colors

Post by firace »

Works here:

Code: Select all

OpenWindow(1, 0, 0, 822, 450, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu )

coloremoji$ = "<body><center><font style='font-family:segoe ui emoji;font-size:188pt'>&#129409</font></body>"

WebGadget (10, 0, 0, 822, 450, "about:" + coloremoji$) 

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow  
The key is using the "Segoe UI Emoji" font (part of a default Windows 10 installation - not sure about earlier versions).
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: emojis in webgadget showing without colors

Post by IdeasVacuum »

If consistency is required, you either have to deliver the coloured font with your program or use images instead.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: emojis in webgadget showing without colors

Post by ricardo »

IdeasVacuum wrote: See: http://classic.getemoji.com
Anybody see this in black and white??
ARGENTINA WORLD CHAMPION
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: emojis in webgadget showing without colors

Post by ricardo »

firace wrote:Works here:

Code: Select all

OpenWindow(1, 0, 0, 822, 450, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu )

coloremoji$ = "<body><center><font style='font-family:segoe ui emoji;font-size:188pt'>&#129409</font></body>"

WebGadget (10, 0, 0, 822, 450, "about:" + coloremoji$) 

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow  
The key is using the "Segoe UI Emoji" font (part of a default Windows 10 installation - not sure about earlier versions).
Great!! Thanks !!
ARGENTINA WORLD CHAMPION
Little John
Addict
Addict
Posts: 4780
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: emojis in webgadget showing without colors

Post by Little John »

Hi, I stumbled across this old thread.
Very interesting, and thanks once more to firace for instructive code!

What I want to do is, showing the glyph of a red heart.

It works fine here with firace's above code (PB 6.20 on Windows 11):

Code: Select all

OpenWindow(1, 0, 0, 822, 450, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu )

coloremoji$ = "<body><center><font style='font-family:segoe ui emoji;font-size:188pt'>&#x2764;&#xFE0F;</font></body>"

WebGadget (10, 0, 0, 822, 450, "about:" + coloremoji$) 

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 

However, I actually want to show the red heart as part of a string in a textgadget.
I believed the following code should do it, because the font “Segoe UI Emoji” does contain the colored glyph.
So why does this code show a black heart, rather than a red one?

Code: Select all

Define font$

If OpenWindow(0, 100, 100, 150, 100, "Heart") = 0
   MessageRequester("Fatal error", "Can't open main window.", #PB_MessageRequester_Error)
   End
EndIf   

font$ = "Segoe UI Emoji"
If LoadFont(0, font$, 9)
   SetGadgetFont(#PB_Default, FontID(0))
Else
   Debug "Can't load font: " + font$
EndIf

TextGadget  (0, 15, 10, 120, 20, "Made with " + Chr($2764) + Chr($FE0F))
StringGadget(1, 10, 40, 120, 20, "Made with " + Chr($2764) + Chr($FE0F))

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
breeze4me
Enthusiast
Enthusiast
Posts: 633
Joined: Thu Mar 09, 2006 9:24 am
Location: S. Kor

Re: emojis in webgadget showing without colors

Post by breeze4me »

@Little John

The common controls in Windows don't support emoji colors, regardless of font, because the GDI string output functions don't support them. As far as I know, to output the colors of emoji characters, you have to draw a string using DirectWrite.

For example:
https://gist.github.com/nickav/ed3428fb ... 88956a7b22
Little John
Addict
Addict
Posts: 4780
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: emojis in webgadget showing without colors

Post by Little John »

@breeze4me:
I see. Many thanks for the information!
Post Reply