Unicode characters above 127 - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: Unicode characters above 127 (/showthread.php?tid=3095) Pages:
1
2
|
Unicode characters above 127 - PhilOfPerth - 10-04-2024 I think I asked this once before, but I can't find the post now, or the programme where I used it, so apologies to those who helped. How can I display a Unicode character in PE? I can use _MapUnicode for Unicode characters up to 127, (as in _MapUnicode 127 to 97) but not beyond. I don't want to access all of Unicode, just one character so I just want a simple way to map this to my character set. RE: Unicode characters above 127 - SMcNeill - 10-04-2024 _MapUnicode (unicode value) TO (ascii value) So if you want CHR$(255) to be a unicode symbol, use: _MapUnicode 9648 TO 255 (For unicode symbol 9648, which is the black parallelogram symbol) NOTE: 1) You have to have an unicode capable font loaded. 2) That font has to have the symbol in it. (Not all symbols are packed in all unicode fonts.) 3) You probably want to be in a graphic screen when printing an unicode character. If you're in SCREEN 0, that character will swap back as soon as you restore that _MapUnicode point back to whatever it was before. Get your unicode character values from any list like this one: https://symbl.cc/en/unicode-table/ RE: Unicode characters above 127 - grymmjack - 10-04-2024 @PhilofPerth I made a PETSCII translator (sorta) using unicode font to QB64PE if you are interested it is here: https://github.com/grymmjack/qb64/blob/8c28670a4c12a24eaa02ef0ba15052bc351e3cae/qb64/TEXTMODE-TESTS/PETSCII-TEST-REAL3.BAS#L76C1-L83C7 In my case I wanted to translate the entire PETSCII range: Code: (Select All)
This was stored int the font in the unicode Private Use Area, contiguously. So it was a matter of finding the character I wanted in the font, using charmap, then noting the hex code, (I could have just used &HEE00 I guess - but for some reason my brain wanted decimals since I was mapping to decimal range 0-255). Anyway, the end result worked exactly as intended. I also had to have the font loaded of course, first. Good luck! RE: Unicode characters above 127 - RhoSigma - 10-04-2024 The easiest solution is using _UPRINTSTRING Code: (Select All)
RE: Unicode characters above 127 - grymmjack - 10-04-2024 (10-04-2024, 10:54 AM)RhoSigma Wrote: The easiest solution is using _UPRINTSTRING Sweet! Has that always been a thing? Ah, nevermind only since 3.7.0 - this is why I didn't use it It wasn't there! But awesome that it is now! Also, can we print emojis in QB64PE with those joiners and stuff? RE: Unicode characters above 127 - PhilOfPerth - 10-05-2024 Thanks all. I got most of that. It seems I need to find a font with my character glyph in it. The _UPRINTSTRING method seems like the way to go; it gave me the Unicode character 1046 ok, but the character I want (2022) is apparently not in that font. Is there a way to find a common font that has this character in it? RE: Unicode characters above 127 - RhoSigma - 10-05-2024 (10-05-2024, 12:43 AM)PhilOfPerth Wrote: Thanks all. I got most of that. It seems I need to find a font with my character glyph in it. Ah, a list bullet. Why unicode, I see at least two, with _CONTROLCHR OFF even five alternatives in the QB64 inbuilt font: Code: (Select All)
Otherwise it could be hard to find a suitable font, my best guess was "Arial Unicode MS", the most complete unicode font I've found so far, but when I checked even that font doesn't have the U2022 in it. RE: Unicode characters above 127 - Kernelpanic - 10-05-2024 Searching for this character? U2022 is decimal 8226. Code: (Select All)
RE: Unicode characters above 127 - RhoSigma - 10-05-2024 (10-05-2024, 11:46 AM)Kernelpanic Wrote: Searching for this character? U2022 is decimal 8226. Oh, now you see how important it is to know the base of a number, especially if there are no letters in it which would immediatly identify it as a hex number. RE: Unicode characters above 127 - PhilOfPerth - 10-05-2024 (10-05-2024, 11:52 AM)RhoSigma Wrote:(10-05-2024, 11:46 AM)Kernelpanic Wrote: Searching for this character? U2022 is decimal 8226. Good grief!!!! I can't believe I never thunk of that! I must be seniler than I thought! Thanks RhoSigma. |