Hello!
Using sublibrary "gtk2" and Ubuntu 18.04:
I use a TextGadget with some text and an emoji and I change the colour of the gadget to #Red.
In Windows the gadget becomes all red, in Ubuntu 18.04 it gets the text red and the emoji black.
See screenshot:
Ubuntu 18.04:
Windows 10:
TextGadget colours in Ubuntu 18.04
- marcoagpinto
- Addict
- Posts: 940
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: [PB5.62] TextGadget colours in Ubuntu 18.04
<edit>: I don't have Ubuntu 18 at hand.
I can't confirm that, and that would be weird! What character is it? Are you sure there are not multiple TextGadgets? In the Windows screenshot there is a colon ':' in black too!
Works:
I can't confirm that, and that would be weird! What character is it? Are you sure there are not multiple TextGadgets? In the Windows screenshot there is a colon ':' in black too!
Works:
Code: Select all
win = OpenWindow(#PB_Any, 50,100, 800, 600, "window")
t = TextGadget(#PB_Any, 10, 10, 100, 30, "button " + Chr(9872))
SetGadgetColor(t, #PB_Gadget_FrontColor, #Red)
t = TextGadget(#PB_Any, 10, 30, 100, 30, "button " + Chr(9873))
SetGadgetColor(t, #PB_Gadget_FrontColor, #Red)
Repeat
WaitWindowEvent()
Until Event() = #PB_Event_CloseWindow
- marcoagpinto
- Addict
- Posts: 940
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: [PB5.62] TextGadget colours in Ubuntu 18.04
Hello!#NULL wrote:<edit>: I don't have Ubuntu 18 at hand.
I can't confirm that, and that would be weird! What character is it? Are you sure there are not multiple TextGadgets? In the Windows screenshot there is a colon ':' in black too!
Works:Code: Select all
win = OpenWindow(#PB_Any, 50,100, 800, 600, "window") t = TextGadget(#PB_Any, 10, 10, 100, 30, "button " + Chr(9872)) SetGadgetColor(t, #PB_Gadget_FrontColor, #Red) t = TextGadget(#PB_Any, 10, 30, 100, 30, "button " + Chr(9873)) SetGadgetColor(t, #PB_Gadget_FrontColor, #Red) Repeat WaitWindowEvent() Until Event() = #PB_Event_CloseWindow
The forums don't accept emoji, so here is the chr:
https://pastebin.com/7ND2jPCv
I tried a DEBUG ASC("symbol above here") and it gets 55356.
But if I try:
Code: Select all
win = OpenWindow(#PB_Any, 50,100, 800, 600, "window")
t = TextGadget(#PB_Any, 10, 10, 100, 30, "button " + Chr(55356))
SetGadgetColor(t, #PB_Gadget_FrontColor, #Red)
t = TextGadget(#PB_Any, 10, 30, 100, 30, "button " + Chr(9873))
SetGadgetColor(t, #PB_Gadget_FrontColor, #Red)
Repeat
WaitWindowEvent()
Until Event() = #PB_Event_CloseWindow
It is strange, because if I paste the emoji directly into the IDE, it appears a flag.
Re: [PB5.62] TextGadget colours in Ubuntu 18.04
Maybe its a multibyte/multichar sequence and works only as string but not as single character. Any problem with using a string literal? (can't post it, getting forum sql error).
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: [PB5.62] TextGadget colours in Ubuntu 18.04
Hi Marco
The character number is outside of the ASCII range, into Unicode, so prefix the number thus:
... but another issue is, everyone that uses your app must have the font you use that contains that character. Most fonts do not. If you have a license for the font to distribute, all is well, otherwise I would suggest using a tiny PNG on a tiny Canvas instead.
Edit: I just noticed that the debugger window, using the DejaVu font, gives a different symbol...... (Win 7)
The character number is outside of the ASCII range, into Unicode, so prefix the number thus:
Code: Select all
Chr($55356)
Edit: I just noticed that the debugger window, using the DejaVu font, gives a different symbol...... (Win 7)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
- marcoagpinto
- Addict
- Posts: 940
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: [PB5.62] TextGadget colours in Ubuntu 18.04
I am using a font compatible with all OSes:IdeasVacuum wrote:Hi Marco
The character number is outside of the ASCII range, into Unicode, so prefix the number thus:... but another issue is, everyone that uses your app must have the font you use that contains that character. Most fonts do not. If you have a license for the font to distribute, all is well, otherwise I would suggest using a tiny PNG on a tiny Canvas instead.Code: Select all
Chr($55356)
Edit: I just noticed that the debugger window, using the DejaVu font, gives a different symbol...... (Win 7)
Code: Select all
Procedure load_fonts()
t=LoadFont(1,"Arial",10,#PB_Font_HighQuality) ;Load Arial Font, Size 10 - 6/FEB/2014 + High Quality 8/FEB/2014
If t=#False : MessageRequester("Error", "Can't load Arial font.",#PB_MessageRequester_Error) : EndIf
t=LoadFont(2,"Arial",8,#PB_Font_HighQuality) ;Load Arial Font, Size 10 - 6/FEB/2014 + High Quality 8/FEB/2014
If t=#False : MessageRequester("Error", "Can't load Arial font.",#PB_MessageRequester_Error) : EndIf
SetGadgetFont(#PB_Default,FontID(1))
EndProcedure