How do I use special characters in my string? Ex: "α" I can use lowercase and uppercase, but I don't know how to use the greek characters that can be accessed normally through a TI basic program. Thanks.
If youโre programming for the CE, the screen is 320 x 240 px. You can also use the LCD_WIDTH and LCD_HEIGHT defines if youโd prefer, which is probably cleaner.
Past projects: HailStorm CE | Contagion CE | HUE CE | VYSION CE || Current projects: VYSION 2 CE | Crossroads CE
- KaluW_
- Member (Posts: 169)
- Re: C++ CE libraries, print text using special characters.
- 08 Feb 2021 03:18:08 pm
Yolomep wrote:
How do I use special characters in my string? Ex: "α" I can use lowercase and uppercase, but I don't know how to use the greek characters that can be accessed normally through a TI basic program. Thanks.
I think if you want to use a special character, your best bet is to create your own font with fontlibc.
-
commandblockguy
- Minor Calculator Deity (Posts: 1130)
- Re: C++ CE libraries, print text using special characters.
- 08 Feb 2021 03:19:11 pm
Yolomep wrote:
How do I use special characters in my string? Ex: "α" I can use lowercase and uppercase, but I don't know how to use the greek characters that can be accessed normally through a TI basic program. Thanks.
Do you mean on the homescreen, or using graphx? If you mean on the homescreen, I believe you can just print the string "\xBB" to display the "α" character. For other characters, you can replace the "BB" with the relevant character code from this table.
In graphx, the font doesn't contain a symbol for the "α" character. If you want to display it you'll have to change the way a symbol that you currently aren't using (the ones with values less than 32 work well for this) looks by using gfx_SetCharData and then using that character in place of "α".
- Yolomep
- Advanced Newbie (Posts: 68)
- Re: C++ CE libraries, print text using special characters.
- 10 Apr 2021 07:11:27 pm
commandblockguy wrote:
Yolomep wrote:
How do I use special characters in my string? Ex: "α" I can use lowercase and uppercase, but I don't know how to use the greek characters that can be accessed normally through a TI basic program. Thanks.
Do you mean on the homescreen, or using graphx? If you mean on the homescreen, I believe you can just print the string "\xBB" to display the "α" character. For other characters, you can replace the "BB" with the relevant character code from this table.
In graphx, the font doesn't contain a symbol for the "α" character. If you want to display it you'll have to change the way a symbol that you currently aren't using (the ones with values less than 32 work well for this) looks by using gfx_SetCharData and then using that character in place of "α".
Wait do you mean using something like gfx_SetCharData(3, "α")? How do I get the pointer to the 8x8 font? Do I use fontlib?
The character data tells the calculator which pixels to turn on. The 8x8 font is just an 8-byte bitmap of pixels. You can generate it with https://www.min.at/prinz/o/software/pixelfont/#download, and then load it like this, using the numbers it generates in place of the example ones:
Code:
Fontlib is another option, and it works entirely separately from graphx text - I'd recommend reading the docs for it.
Code:
uint8_t char_data = {0x00, 0x18, 0x24, 0x24, 0x3C, 0x24, 0x24, 0x00}; // Bitmap for "A"
gfx_SetCharData(3, char_data);
gfx_PrintChar(3);
Fontlib is another option, and it works entirely separately from graphx text - I'd recommend reading the docs for it.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
» Go to Registration page
» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Advertisement