Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unicode characters above 127
#5
(10-04-2024, 10:54 AM)RhoSigma Wrote: The easiest solution is using _UPRINTSTRING

Code: (Select All)
SCREEN _NEWIMAGE(640, 320, 32)
f& = _LOADFONT("arial.ttf", 20)
IF f& > 0 THEN _FONT f&

'a single char is easy with Utf-16 or Utf-32,
'if you know the exact unicode codepoint
_UPRINTSTRING (10, 10), MKI$(1046), , 16 'use MKI$() for Utf-16 encoding
_UPRINTSTRING (10, 30), MKL$(1046), , 32 'use MKL$() for Utf-32 encoding
'if you otherwise have a Utf-8 multibyte sequence,
'then you can assemble it
_UPRINTSTRING (10, 50), CHR$(208) + CHR$(150), , 8 'use CHR$() for multibyte Utf-8 encoding

'to write complete text, just concatenate the values
_UPRINTSTRING (10, 80), MKI$(1046) + MKI$(1046), , 16 'use MKI$() for Utf-16 encoding
_UPRINTSTRING (10, 100), MKL$(1046) + MKL$(1046), , 32 'use MKL$() for Utf-32 encoding
_UPRINTSTRING (10, 120), CHR$(208) + CHR$(150) + CHR$(208) + CHR$(150), , 8 'use CHR$() for multibyte Utf-8 encoding

_UPRINTSTRING (10, 160), "press any key...": SLEEP 'or write ASCII as is with _UPRINTSTRING
_FONT 16
SCREEN 0
SYSTEM

Sweet! Has that always been a thing? Ah, nevermind only since 3.7.0 - this is why I didn't use it Smile It wasn't there! But awesome that it is now!

Also, can we print emojis in QB64PE with those joiners and stuff?
grymmjack (gj!)
GitHubYouTube | Soundcloud | 16colo.rs
Reply


Messages In This Thread
Unicode characters above 127 - by PhilOfPerth - 10-04-2024, 05:08 AM
RE: Unicode characters above 127 - by SMcNeill - 10-04-2024, 06:42 AM
RE: Unicode characters above 127 - by grymmjack - 10-04-2024, 10:53 AM
RE: Unicode characters above 127 - by RhoSigma - 10-04-2024, 10:54 AM
RE: Unicode characters above 127 - by grymmjack - 10-04-2024, 11:13 AM
RE: Unicode characters above 127 - by PhilOfPerth - 10-05-2024, 12:43 AM
RE: Unicode characters above 127 - by RhoSigma - 10-05-2024, 11:07 AM
RE: Unicode characters above 127 - by PhilOfPerth - 10-07-2024, 12:43 AM
RE: Unicode characters above 127 - by Kernelpanic - 10-05-2024, 11:46 AM
RE: Unicode characters above 127 - by RhoSigma - 10-05-2024, 11:52 AM
RE: Unicode characters above 127 - by PhilOfPerth - 10-05-2024, 11:30 PM



Users browsing this thread: 3 Guest(s)