10-04-2024, 11:13 AM
(This post was last modified: 10-04-2024, 11:15 AM by grymmjack.
Edit Reason: UPRINTSTRING in 3.7.0
)
(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 It wasn't there! But awesome that it is now!
Also, can we print emojis in QB64PE with those joiners and stuff?