It is currently Thu Dec 13, 2018 2:36 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Emojis work in StringGadget + List but not in EditorGadget
PostPosted: Fri Oct 05, 2018 11:43 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 572
Location: Portugal
Emojis > 65535 work in StringGadget and ListIconGadget but not in EditorGadget.

I know that PB had a limitation of Emoji up to ASCII 65535.

But, if I paste one of them into a StringGadget or ListIconGadget, it shows okay.

But in an EditorGadget, I get a corrupted character.

Is it fixable in the next beta?

Thank you!


Top
 Profile  
Reply with quote  
 Post subject: Re: Emojis work in StringGadget + List but not in EditorGadg
PostPosted: Fri Oct 05, 2018 12:56 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jan 10, 2008 1:30 pm
Posts: 1169
Location: Germany, Glienicke
You are correct, but please add an example code.
For example, here the different h's:
Code:
Procedure.s UnicodeChr(Number.i)
   Protected Buffer.l
   If Number <= $FFFF
      ProcedureReturn Chr(Number)
   Else
      Buffer = (Number&$3FF)<<16 | (Number-$10000)>>10 | $DC00D800
      ProcedureReturn PeekS(@Buffer, 2, #PB_Unicode)
   EndIf
EndProcedure


Enumeration
   #Window
   #StringGadget
   #ListIconGadget
   #EditorGadget
   #ButtonGadget
   #Font
EndEnumeration

LoadFont(#Font, "Cambria", 16)

Define Text.s = "H"+UnicodeChr($1D4D7)+"ℍ"+UnicodeChr($1D573)

OpenWindow(#Window, 0, 0, 330, 160, "WindowTitle", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
SetGadgetFont(#PB_Default, FontID(#Font))

StringGadget(#StringGadget, 10, 10, 150, 30, Text)

ListIconGadget(#ListIconGadget, 10, 50, 150, 100, "", 100)
AddGadgetItem(#ListIconGadget, -1, Text)

EditorGadget(#EditorGadget, 170, 10, 150, 100)
SetGadgetText(#EditorGadget, Text)

ButtonGadget(#ButtonGadget, 170, 120, 150, 30, Text)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow


Which font supports the emoji characters?

_________________
ImageImage


Top
 Profile  
Reply with quote  
 Post subject: Re: Emojis work in StringGadget + List but not in EditorGadg
PostPosted: Fri Oct 05, 2018 1:04 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 572
Location: Portugal
@Stargate:

Code:
    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

    SetGadgetFont(#PB_Default,FontID(1))


You can test it with the Emoji from LibreOffice:
:warning:
using the GB speller.

Just copy it from the document and paste in a StringGadget or ListIconGadget and it appears correct.

If you paste it into an EditorGadget you get no character.


Top
 Profile  
Reply with quote  
 Post subject: Re: Emojis work in StringGadget + List but not in EditorGadg
PostPosted: Fri Oct 05, 2018 1:08 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 572
Location: Portugal
The warning sign is chr(9888).

I have just tested your code and it only gets corrupted in the EditorGadget.

EDIT: "in the EditorGadget"


Top
 Profile  
Reply with quote  
 Post subject: Re: Emojis work in StringGadget + List but not in EditorGadg
PostPosted: Fri Oct 05, 2018 1:15 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jan 10, 2008 1:30 pm
Posts: 1169
Location: Germany, Glienicke
Arial does not support these characters!
One font that supports the emoji is "Segoe UI Symbol".

Here the emojis work, but not the h's:
Code:
Procedure.s UnicodeChr(Number.i)
   Protected Buffer.l
   If Number <= $FFFF
      ProcedureReturn Chr(Number)
   Else
      Buffer = (Number&$3FF)<<16 | (Number-$10000)>>10 | $DC00D800
      ProcedureReturn PeekS(@Buffer, 2, #PB_Unicode)
   EndIf
EndProcedure


Enumeration
   #Window
   #StringGadget
   #ListIconGadget
   #EditorGadget
   #ButtonGadget
   #Font
EndEnumeration

LoadFont(#Font, "Segoe UI Symbol", 16)

Define Text.s = UnicodeChr($1F603)+UnicodeChr(9888)+UnicodeChr($1F61E)+"H"+UnicodeChr($1D4D7)+"ℍ"+UnicodeChr($1D573)

OpenWindow(#Window, 0, 0, 330, 160, "WindowTitle", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
SetGadgetFont(#PB_Default, FontID(#Font))

StringGadget(#StringGadget, 10, 10, 150, 30, Text)

ListIconGadget(#ListIconGadget, 10, 50, 150, 100, "", 150)
AddGadgetItem(#ListIconGadget, -1, Text)

EditorGadget(#EditorGadget, 170, 10, 150, 100)
SetGadgetText(#EditorGadget, Text)

ButtonGadget(#ButtonGadget, 170, 120, 150, 30, Text)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow

_________________
ImageImage


Top
 Profile  
Reply with quote  
 Post subject: Re: Emojis work in StringGadget + List but not in EditorGadg
PostPosted: Fri Oct 05, 2018 1:21 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 572
Location: Portugal
STARGÅTE wrote:
Arial does not support these characters!
One font that supports the emoji is "Segoe UI Symbol".


Arial DOES seem to work.

Try your first code with:

Code:
LoadFont(#Font, "Arial", 16)

Define Text.s = Chr(9888)


Only the EditorGadget shows a corrupted character.


Top
 Profile  
Reply with quote  
 Post subject: Re: Emojis work in StringGadget + List but not in EditorGadg
PostPosted: Fri Oct 05, 2018 7:04 pm 
Offline
User
User

Joined: Fri Aug 04, 2017 11:03 pm
Posts: 48
Try. Work's on editor as well.

LoadFont(#Font, "Segoe UI Symbol", 16)
Define Text.s = Chr($26A0)


debug Chr($26A0


Top
 Profile  
Reply with quote  
 Post subject: Re: Emojis work in StringGadget + List but not in EditorGadg
PostPosted: Tue Oct 09, 2018 7:32 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 572
Location: Portugal
dcr3 wrote:
Try. Work's on editor as well.

LoadFont(#Font, "Segoe UI Symbol", 16)
Define Text.s = Chr($26A0)


debug Chr($26A0


Ahhhh... I forgot to mention this: the original idea was to have normal text with some emojis, so, using the font you suggested doesn't work in my case.

For example: in the GB speller page of Mozilla I have the warning emoji twice and I works with a normal font, so I wanted to be able to use it also in PB.


Top
 Profile  
Reply with quote  
 Post subject: Re: Emojis work in StringGadget + List but not in EditorGadg
PostPosted: Tue Oct 09, 2018 8:38 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jan 10, 2008 1:30 pm
Posts: 1169
Location: Germany, Glienicke
PB Gadgets supports only one font for the whole text.
So you cant insert styled text (multiple fonts).
You have to decide for one font which supports the character you want.

_________________
ImageImage


Top
 Profile  
Reply with quote  
 Post subject: Re: Emojis work in StringGadget + List but not in EditorGadg
PostPosted: Tue Oct 09, 2018 10:03 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 572
Location: Portugal
STARGÅTE wrote:
PB Gadgets supports only one font for the whole text.
So you cant insert styled text (multiple fonts).
You have to decide for one font which supports the character you want.


Hello!

See:
https://addons.mozilla.org/en-US/firefo ... ctionary-2

It is only one font in the description, right?

I copied and pasted into a .txt document and the warning signs appear well.

Scroll down in Mozilla to:
Code:
To make sure the words I add are the correct ones, I have been looking for them in credible sources:
1) Oxford Dictionaries;
2) Collins Dictionary;
3) Macmillan Dictionary;
4) Wiktionary (used with caution ⚠);
5) Wikipedia (used with caution ⚠);
6) Physical dictionaries.


In 4) and 5) you can see the emoji.

I don't know more what to say... :cry:


Top
 Profile  
Reply with quote  
 Post subject: Re: Emojis work in StringGadget + List but not in EditorGadg
PostPosted: Tue Oct 09, 2018 11:09 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Mar 09, 2006 9:24 am
Posts: 246
Location: S. Kor
It seems that using a newer version of the rich edit is a solution.
On Windows 10, the emojis are displayed normally.

But it's not working on Windows 7. An appropriate font is needed.
In addition to the edit version, it seems to support the emojis very poorly on Windows 7.

Code:
Procedure.s UnicodeChr(Number.i)
  Protected Buffer.l
  If Number <= $FFFF
    ProcedureReturn Chr(Number)
  Else
    Buffer = (Number&$3FF)<<16 | (Number-$10000)>>10 | $DC00D800
    ProcedureReturn PeekS(@Buffer, 2, #PB_Unicode)
  EndIf
EndProcedure


Enumeration
  #Window
  #StringGadget
  #ListIconGadget
  #EditorGadget
  #ButtonGadget
  #Font
EndEnumeration

Procedure CreateRichEdit(ParentID, x, y, w, h)
  OpenLibrary(0, "MSFTEDIT.dll")
  ;OpenLibrary(1,"riched32.dll")
  ProcedureReturn CreateWindowEx_(#WS_EX_CLIENTEDGE, "RichEdit50W", 0, #WS_CHILD | #WS_VISIBLE | #ES_MULTILINE | #WS_VSCROLL | #ES_AUTOVSCROLL, x, y, w, h, ParentID, 0, 0, 0)
EndProcedure

Procedure DestroyRichEdit(hRichEdit)
  DestroyWindow_(hRichEdit)
  CloseLibrary(0)
  ;CloseLibrary(1)
EndProcedure


LoadFont(#Font, "Arial", 16)


Define Text.s = "H"+UnicodeChr($1D4D7)+"ℍ"+UnicodeChr($1D573) + Chr($26A0)

OpenWindow(#Window, 0, 0, 330, 160, "WindowTitle", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
SetGadgetFont(#PB_Default, FontID(#Font))

StringGadget(#StringGadget, 10, 10, 150, 30, Text)

ListIconGadget(#ListIconGadget, 10, 50, 150, 100, "", 100)
AddGadgetItem(#ListIconGadget, -1, Text)

hRichEdit = CreateRichEdit(WindowID(#Window), 170, 10, 150, 100)
SendMessage_(hRichEdit, #WM_SETFONT, FontID(#font), 1)
SetWindowText_(hRichEdit, Text)

ButtonGadget(#ButtonGadget, 170, 120, 150, 30, Text)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow

DestroyRichEdit(hRichEdit)


Top
 Profile  
Reply with quote  
 Post subject: Re: Emojis work in StringGadget + List but not in EditorGadg
PostPosted: Wed Oct 10, 2018 7:29 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jan 10, 2008 1:30 pm
Posts: 1169
Location: Germany, Glienicke
marcoagpinto wrote:
It is only one font in the description, right?

No it isn't!
When you analyze the page (the description part) you can read:
Rendered Fonts wrote:
Fira Sans—Network resource(5005 glyphs)
Segoe UI Symbol—Local file(2 glyphs)

So the two ⚠ are loaded from the Segoe UI Symbol font.
It is the same here in the forum:

You can see the ⚠ in your posted code section, but the fonts are:
Rendered Fonts wrote:
Trebuchet MS—Local file(429 glyphs)
Courier New—Local file(225 glyphs)
Segoe UI Symbol—Local file(2 glyphs)

_________________
ImageImage


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye