Characters tables (Alternative to the PB tool)
Re: Characters tables (Alternative to the PB tool)
@Caronte3D, Infratec and ChrisR : All fixed in new available version 1.21 !
Please, test and give me feedback.
Please, test and give me feedback.
Re: Characters tables (Alternative to the PB tool)
Now works as expected
Re: Characters tables (Alternative to the PB tool)
And perfect for the buttons height when resizing
Merci
For the É in my name, I have been using ALT+0201 for years. Thanks to your tool, I discover that ALT+144 works too.
Merci
For the É in my name, I have been using ALT+0201 for years. Thanks to your tool, I discover that ALT+144 works too.
Re: Characters tables (Alternative to the PB tool)
@ChrisR
In my name and first name, I have two É. Which led me to use ALT+144 since a long time (Yes, I'm not very young!)
In my name and first name, I have two É. Which led me to use ALT+144 since a long time (Yes, I'm not very young!)
Re: Characters tables (Alternative to the PB tool)
Off topic! in fact, I don't really use ALT+0201 (or ALT+144) much now.
I now use the top left key under Escape, which I almost never use for the ²
And I made ~ the same program for my son's laptop which broke the letter R, not really great but the keyboard is too expensive to replace.
When he is at home, he uses an external keyboard to play his games, the hook, launched at startup, does not bother, the R key remains active.
I now use the top left key under Escape, which I almost never use for the ²
And I made ~ the same program for my son's laptop which broke the letter R, not really great but the keyboard is too expensive to replace.
When he is at home, he uses an external keyboard to play his games, the hook, launched at startup, does not bother, the R key remains active.
Code: Select all
EnableExplicit
#KEYEVENTF_UNICODE = $0004
Procedure.l KeyProc(nCode, wParam, lParam)
Protected *keyInput.KBDLLHOOKSTRUCT = lParam
Protected Result
If nCode = #HC_ACTION
If *keyInput\vkCode = 222 ; Key at the top left under Escape: ² (which is of very little use)
Protected InputData.INPUT
With InputData
\type = #INPUT_KEYBOARD
\ki\wScan = 201 ; É
\ki\dwFlags = #KEYEVENTF_UNICODE
If wParam = #WM_KEYUP
\ki\dwFlags | #KEYEVENTF_KEYUP
EndIf
EndWith
SendInput_(1, @InputData, SizeOf(INPUT))
Result = #True
Else
Result= CallNextHookEx_(0, nCode, wParam, lParam)
EndIf
Else
Result = CallNextHookEx_(0, nCode, wParam, lParam)
EndIf
ProcedureReturn Result
EndProcedure
Procedure SetHook()
Protected hInstance = GetModuleHandle_(0)
Protected Result
If hInstance
Result = SetWindowsHookEx_(#WH_KEYBOARD_LL, @KeyProc(), hInstance, 0)
Else
MessageRequester("Hook", "Can't get module handle")
EndIf
ProcedureReturn Result
EndProcedure
Procedure KillHook(myKeyHook)
ProcedureReturn UnhookWindowsHookEx_(myKeyHook)
EndProcedure
Procedure AddSysTray()
; Load Icon directly from the executable resource
Protected hInstance = GetClassLongPtr_(WindowID(0), #GCL_HMODULE)
Protected IconhWnd = LoadIcon_(hInstance, 1)
If IconhWnd
AddSysTrayIcon(1, WindowID(0), IconhWnd)
; Uncomment the 3 lines below, if compiled without icon
;Else
; UsePNGImageDecoder()
; AddSysTrayIcon(1, WindowID(0), LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/world.png"))
EndIf
SysTrayIconToolTip(1, "Remap Key ² to É")
If CreatePopupMenu(0)
MenuItem(0, "Exit")
MenuBar()
EndIf
EndProcedure
Define myKeyHook = SetHook()
If myKeyHook
If OpenWindow(0, -10, -10, 0, 0,"", #PB_Window_Tool | #PB_Window_Invisible)
AddSysTray()
Repeat
Select WaitWindowEvent()
Case #PB_Event_SysTray
Select EventType()
Case #PB_EventType_LeftClick, #PB_EventType_RightClick
DisplayPopupMenu(0, WindowID(0))
EndSelect
Case #PB_Event_Menu
If EventMenu() = 0
Break
EndIf
EndSelect
ForEver
EndIf
If KillHook(myKeyHook)
myKeyHook = 0
EndIf
EndIf
-
- Enthusiast
- Posts: 271
- Joined: Thu Dec 17, 2009 12:00 pm
- Location: Llangadog, Wales, UK
- Contact:
Re: Characters tables (Alternative to the PB tool)
@boddhi - looks like a very nice tool. Please continue development with it
Just a couple of comments :
The are are number of fonts with excellent Unicode coverage, my favourite is the DejaVu family which is under a free licence. There is also Junicode, Linux Libertine, the Noto family and others. One problem you may have is that the chosen font may not exist on the end-user system, but you could consider embedding the font in your program so that it always displays correctly. Of course the user will still need a suitable font to show specific characters in other applications.
A while back I wrote a tool with some similarities but a very different purpose and history. Not a character table but a "minimal" easy method for end-users to type accents and other awkward characters into applications. An extended edition for "techies" gives options to output in various code formats. It's still very popular with Windows users due to being non-intrusive and portable - thanks to PureBasic of course!
Just a couple of comments :
I personally do not think the the display of characters above 65537 is a "PB limitation" - you can happily show such characters if an appropriate font is used. A Unicode surrogate pair of characters is needed for the correct display - this has already been perfectly solved by the experts here, see - viewtopic.php?p=482622&hilit=surrogate+ ... de#p482622boddhi wrote: ↑Tue Jan 31, 2023 3:27 pmI will look soon if I can find and include a font that solves this problem.
- Due to a PB limitation, only characters whose ASCII value is les than 65537 are correctly handled.
- For those which are not displayed correctly in the tool, their use (via the copy of the symbol) nevertheless remains usable on other applications such as Word, Excel, Web editors,...
The are are number of fonts with excellent Unicode coverage, my favourite is the DejaVu family which is under a free licence. There is also Junicode, Linux Libertine, the Noto family and others. One problem you may have is that the chosen font may not exist on the end-user system, but you could consider embedding the font in your program so that it always displays correctly. Of course the user will still need a suitable font to show specific characters in other applications.
A while back I wrote a tool with some similarities but a very different purpose and history. Not a character table but a "minimal" easy method for end-users to type accents and other awkward characters into applications. An extended edition for "techies" gives options to output in various code formats. It's still very popular with Windows users due to being non-intrusive and portable - thanks to PureBasic of course!
Re: Characters tables (Alternative to the PB tool)
In general it has still the same problem.
But I found the solution.
You have to rename all files (more or less).
If you rename the language file to
Or rename the lang files already accordingly.
But I found the solution.
You have to rename all files (more or less).
If you rename the language file to
Then you have to rename the exe file toTablesCaractères-lang.xml
Or if you want to rename only the lang file you have to rename it toTablesCaractères.exe
So please remove the vXXX stuff from the exe file name in the ZIP file.TablesCaractères-v121-lang.xml
Or rename the lang files already accordingly.
Re: Characters tables (Alternative to the PB tool)
@deeproot
But what I meant by a limitation due to PB is the following problem:
I just need to find the right font. I'll take a look at the ones you told me about.
Thanks a lot for you supportdeeproot wrote: @boddhi - looks like a very nice tool. Please continue development with it
Thanks. I will study this...deeproot wrote: I personally do not think the the display of characters above 65537 is a "PB limitation" [..]
But what I meant by a limitation due to PB is the following problem:
Code: Select all
Define.s Char="🝱"
Define.l ASCIICode=Asc(Char)
Debug "String : "+Char+" (Decimal code : 128881)"
Debug "ASCII code : "+ASCIICode
Debug "Chr(ASCII code) : "+Chr(ASCIICode)
I planned to manage the display font (I had already mentioned it on the French forum ). This will likely be part of one of the next updates .deeproot wrote: The are are number of fonts with excellent Unicode coverage [...]
I just need to find the right font. I'll take a look at the ones you told me about.
Re: Characters tables (Alternative to the PB tool)
@infratec
I hope to have fixed, once and for all, this localization problem with the new version 2.00.
Test and tell me if it's ok...
I hope to have fixed, once and for all, this localization problem with the new version 2.00.
Test and tell me if it's ok...
Characters tables (Alternative to the PB tool)
New version 2.00 :
• Addition of color lists with almost 1000 colors and with, among others, their RGB, HSL, HTML codes and HTML entities
• Fixed a bug related to localization
• Addition of color lists with almost 1000 colors and with, among others, their RGB, HSL, HTML codes and HTML entities
• Fixed a bug related to localization
Characters tables (Alternative to the PB tool)
New version 2.10 :
• Management of a favorite list of characters added (Please, read 'A lire - Readme.txt' file)
• Storage of the coordinates/dimensions of the window and the widths of the lists columns added
• Management of a favorite list of characters added (Please, read 'A lire - Readme.txt' file)
• Storage of the coordinates/dimensions of the window and the widths of the lists columns added
Re: Characters tables (Alternative to the PB tool)
You can use these to do surrogate pairs
Code: Select all
Procedure.s _Chr(v.i) ;return a proper surrogate pair for unicode values outside the BMP (Basic Multilingual Plane)
Protected high, low
If v < $10000
ProcedureReturn Chr(v)
Else
v - $10000
high = (v >> 10) + $D800 ;high/lead surrogate value
low = (v & 1023) + $DC00 ;low/tail surrogate
ProcedureReturn Chr(high) + Chr(low)
EndIf
EndProcedure
Procedure _Asc(s.s)
Protected high,low
Protected *chr.unicode = @s
high = *chr\u
If (high > $D7FF And high < $DBFF)
*chr+2
low = *chr\u
If (low & $DC00) = $DC00
ProcedureReturn (high - $D800) << 10 + (low - $DC00) + $10000 ;return decoded surrogate pair
EndIf
EndIf
ProcedureReturn high
EndProcedure
-
- Enthusiast
- Posts: 271
- Joined: Thu Dec 17, 2009 12:00 pm
- Location: Llangadog, Wales, UK
- Contact:
Re: Characters tables (Alternative to the PB tool)
That looks like the code I used a while back - perfect solution and I remember the forum discussions were really helpful in understanding more about Unicode. As always - very grateful to all you experts!
Re: Characters tables (Alternative to the PB tool)
@idle
Thanks a lot for these great tricks that helped me improve my code.
Thanks a lot for these great tricks that helped me improve my code.
Re: Characters tables (Alternative to the PB tool)
Those codes are one I modified from demivec, unicode is complicated.