How to print pseudographic symbols?
Posted: Tue Apr 21, 2015 3:10 am
I tried to print it just like normal character, but it displays me a blank white character. Can i print them by printing their ASCII codes?
The Place to Start for Operating System Developers
http://f.osdev.org/
Define "normal". Which exact character are you trying to print using which method? There are many ways I know of, all of which considered normal depending on context, and several of them work fundamentally different when it comes to non-alphanumeric characters.just like normal character
I'm using standard terminal_putchar function, normal chars is 'a', '!', '_', just anything except pseudographic. I'm trying to print a borders for my window, but it displays me blank chars.Combuster wrote:Define "normal". Which exact character are you trying to print using which method? There are many ways I know of, all of which considered normal depending on context, and several of them work fundamentally different when it comes to non-alphanumeric characters.just like normal character
Code: Select all
-uint16_t c16 = c;
+uint16_t c16 = (uint8_t)c;
Isn't UTF-8 compatible with ASCII (i.e. ASCII symbols in Unicode are just one-byte ASCII)?mallard wrote:Are you typing/pasting the pseudographic characters directly into your source code, or are you using character codes? The former won't work since the character encodings (some form of Unicode, probably UTF-8) used by your editor/IDE won't match the character positions in the VGA ROM (the "IBM extended ASCII" set)...
UTF-8 is compatible with standard 7-bit ASCII, but not the full 8-bit "IBM extended ASCII" set.Roman wrote:Isn't UTF-8 compatible with ASCII (i.e. ASCII symbols in Unicode are just one-byte ASCII)?
Thanks! I didn't know about the extended set. I always thought ASCII only takes 7 bits.mallard wrote:UTF-8 is compatible with standard 7-bit ASCII, but not the full 8-bit "IBM extended ASCII" set.Roman wrote:Isn't UTF-8 compatible with ASCII (i.e. ASCII symbols in Unicode are just one-byte ASCII)?
Code: Select all
void drawObj(window target)
{
terminal_setcolor(26);
goToPos(target.x, target.y);
terminal_putchar(0xAD);
for(size_t topcount = 0; topcount < target.width - 2; topcount++)
{
terminal_putchar(0x4C);
}
terminal_putchar(0xFB);
for(size_t middlecount = 1; middlecount < target.height - 2; middlecount++)
{
goToPos(target.x, target.y+middlecount);
terminal_putchar(0x3B);
for(size_t middlecount2 = 0; middlecount2 < target.width - 2; middlecount2++)
{
terminal_putchar(' ');
}
terminal_putchar(0x3B);
}
goToPos(target.x, target.y+target.height-2);
terminal_putchar(0x0C);
for(size_t bcount = 0; bcount < target.width - 2; bcount++)
{
terminal_putchar(0x4C);
}
terminal_putchar(0x9D);
goToPos(target.x, target.y+2);
terminal_putchar(0x3C);
for(size_t captioncount = 0; captioncount < target.width - 2; captioncount++)
{
terminal_putchar(0x4C);
}
terminal_putchar(0x4B);
terminal_setcolor(26);
goToPos(target.x,target.y);
size_t newy = 0;
terminal_setcolor(26);
goToPos(target.x+1, target.y+1);
terminal_writestring(target.caption);
terminal_setcolor(26);
goToPos(target.x+1, target.y + 3);
terminal_writestring(target.text);
}
Looks right to me.catnikita255 wrote:It displays me a wrong characters!
Code: Select all
0C ♀
3B ;
3C <
4B K
4C L
9D ¥
AD ¡
FB √
I don't know, i'm found ASCII codes of pseudographic in Wikipedia, and it dispayed me a blank chars, then i'm typed their ASCII codes in reverse order, and it showed me that. I'll try to type them in normal order.Octocontrabass wrote:Looks right to me.catnikita255 wrote:It displays me a wrong characters!What kind of ASCII chart are you using, anyway?Code: Select all
0C ♀ 3B ; 3C < 4B K 4C L 9D ¥ AD ¡ FB √
Did you fix this yet?Combuster wrote:Well, that's what you get for blindly trusting tutorials. It was pretty easy to find though, here's a hint:Code: Select all
-uint16_t c16 = c; +uint16_t c16 = (uint8_t)c;