Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example:
#Compiler PBWin 10
#Compile Exe
#Dim All
%Unicode = 1
#Include "Win32API.inc"
Enum Equates Singular
IDC_Text = 500
End Enum
Global hDlg, hFont As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "PowerBASIC",300,300,1200,100, %WS_OverlappedWindow To hDlg
Control Add TextBox, hDlg, %IDC_Text,"", 0,0,1200,100
Font New "FreeSerif", 48, 0 To hFont
Control Set Font hDlg, %IDC_Text, hFont
Control Set Text hDlg, %IDC_Text, GetSymbols
GetSymbols
Dialog Show Modal hDlg
End Function
Function UnicodeToUTF16(charpt As Dword) As WString
Local w1,w2 As Word
If charpt > &H0FFFF Then 'surrogate pair
charpt = charpt - &H010000
w2 = (charpt And &H3FF) + &HDC00
Shift Right charpt, 10
w1 = (charpt And &H3FF) + &HD800
Function = Chr$$(w1,w2)
Else
Function = Chr$$(charpt)
End If
End Function
Function GetSymbols() As WString
Function = UnicodeToUTF16(&h1D15D) + " " + UnicodeToUTF16(&h1D15E) + " " + UnicodeToUTF16(&h1D15F) + " " + UnicodeToUTF16(&h1D160) + " " + UnicodeToUTF16(&h1D161) _
+ " " + UnicodeToUTF16(&h1D13b) + " " + UnicodeToUTF16(&h1D13c) + " " + UnicodeToUTF16(&h1D13d) + " " + UnicodeToUTF16(&h1D13e) _
+ " " + UnicodeToUTF16(&h1D13f) + " " + UnicodeToUTF16(&h1D11E) + " " + UnicodeToUTF16(&h1D122) + " " + UnicodeToUTF16(&h266D) _
+ " " + UnicodeToUTF16(&h266E) + " " + UnicodeToUTF16(&h266F)
End Function
http://www.garybeene.com/sw/gbsnippets.htm