![]() |
How can an emoji be displayed? - 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: How can an emoji be displayed? (/showthread.php?tid=2609) |
How can an emoji be displayed? - PhilOfPerth - 04-21-2024 I would like to use an "emoji" (or similar) in my programme. Is there a (simple) way to do this? I don't see any appropriate symbols in the ASCII code. RE: How can an emoji be displayed? - TerryRitchie - 04-21-2024 (04-21-2024, 01:18 AM)PhilOfPerth Wrote: I would like to use an "emoji" (or similar) in my programme. Is there a (simple) way to do this? I don't see any appropriate symbols in the ASCII code.You'll need to either do this with an image (_LOADIMAGE then _PUTIMAGE) or find a font that contains the images you're looking for. Fonts can contain small images, often referred to as dingbats: https://www.dafont.com/mtheme.php?id=7 RE: How can an emoji be displayed? - PhilOfPerth - 04-21-2024 Thanks Terry. I found what I wanted in Wingding (a font I never expected to use). I found I can change fonts mid-stream, but the new font seems to place the print position as 1,1. I can fix this by using Locate r,c but wondered if there's a setting when using the new font that bypasses this? Also, I only want to use one character, then revert to my old font. Is there a shorter way than re-re-setting my font? RE: How can an emoji be displayed? - SMcNeill - 04-21-2024 Code: (Select All)
Instead of using _FONT to swap to the new font, use _SafeLoadFont instead. It's been a standard part of my extended toolbox of routines which I make use of for years now. ![]() RE: How can an emoji be displayed? - SMcNeill - 04-21-2024 For a quick print of a single character, like your emoji, just use the above with a little helper code: SUB PrintSmiley f& = _FONT 'get the current font so we can restore it. SafeLoadFont <whatever the handle is for the wingding font you loaded earlier in your code> Print Chr$(<whatever the value is for the character>); SafeLoadFont f& 'restore the current font back. END SUB RE: How can an emoji be displayed? - PhilOfPerth - 04-21-2024 Thanks Steve. I'll have a fiddle with that; I don't really see much difference between that and just re-declaring my original font though. Maybe the difference will become more obvious when I use it. RE: How can an emoji be displayed? - grymmjack - 04-21-2024 Since we display unicode we should be able to display emojis? I know that we should be able to do this in terminals that support UTF-8. Just print out the unicode code point code to the terminal and it will display the emoji configured in the system? Or is this wrong? Is it that when using a graphics screen mode the emojis will not render properly? TBH I haven't tried to render an emoji in terminal yet. (the terminal must support it - windows terminal, xterm, mac terminal, etc. all do). RE: How can an emoji be displayed? - a740g - 04-21-2024 (04-21-2024, 03:04 PM)grymmjack Wrote: Since we display unicode we should be able to display emojis? I know that we should be able to do this in terminals that support UTF-8. Just print out the unicode code point code to the terminal and it will display the emoji configured in the system? Or is this wrong?Yeah. I too am not sure if printing emojis to the terminal will work with QB64's PRINT. I'll need to play with that. However, printing to a graphics screen with _UPRINTSTRING should work. Note that we do not have color font support yet. So, the below will print in monochrome (you can pick a single color of your choice). Code: (Select All)
![]() Update: Added sample font with emojis. RE: How can an emoji be displayed? - bplus - 04-21-2024 curious if forum editor can display this ? if so how? guess not, looks fine in the edit window |