Page 1 of 2

How to print pseudographic symbols?

Posted: Tue Apr 21, 2015 3:10 am
by osdever
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?

Re: How to print pseudographic symbols?

Posted: Tue Apr 21, 2015 6:07 am
by Combuster
just like normal character
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.

Re: How to print pseudographic symbols?

Posted: Tue Apr 21, 2015 10:52 am
by osdever
Combuster wrote:
just like normal character
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.
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.

Re: How to print pseudographic symbols?

Posted: Tue Apr 21, 2015 11:02 am
by Combuster
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;

Re: How to print pseudographic symbols?

Posted: Tue Apr 21, 2015 2:08 pm
by mallard
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)...

Re: How to print pseudographic symbols?

Posted: Tue Apr 21, 2015 2:38 pm
by Roman
Are you sure, you use pseudographics from ASCII, not Unicode?

Re: How to print pseudographic symbols?

Posted: Tue Apr 21, 2015 2:40 pm
by Roman
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)...
Isn't UTF-8 compatible with ASCII (i.e. ASCII symbols in Unicode are just one-byte ASCII)?

Re: How to print pseudographic symbols?

Posted: Tue Apr 21, 2015 2:48 pm
by mallard
Roman wrote:Isn't UTF-8 compatible with ASCII (i.e. ASCII symbols in Unicode are just one-byte ASCII)?
UTF-8 is compatible with standard 7-bit ASCII, but not the full 8-bit "IBM extended ASCII" set.

Re: How to print pseudographic symbols?

Posted: Wed Apr 22, 2015 12:30 am
by Roman
mallard wrote:
Roman wrote:Isn't UTF-8 compatible with ASCII (i.e. ASCII symbols in Unicode are just one-byte ASCII)?
UTF-8 is compatible with standard 7-bit ASCII, but not the full 8-bit "IBM extended ASCII" set.
Thanks! I didn't know about the extended set. I always thought ASCII only takes 7 bits.

Re: How to print pseudographic symbols?

Posted: Wed Apr 22, 2015 1:49 am
by osdever
I'm now tried to print char code, but now it displays me that: (' ' is the blank char, and * is some char that i can't print)
LLLLLLLLLLLLLLLLLLL
;window caption ;
<LLLLLLLLLLLLLLLLLK
;window text ;
; ;
; ;
; ;
; ;
*LLLLLLLLLLLLLLLLLL
It displays me a wrong characters! There's a code of drawObj function:

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);
}

Re: How to print pseudographic symbols?

Posted: Wed Apr 22, 2015 1:50 am
by osdever
Oops, phpBB deleted repeated spaces.

Re: How to print pseudographic symbols?

Posted: Wed Apr 22, 2015 2:55 am
by Octocontrabass
catnikita255 wrote:It displays me a wrong characters!
Looks right to me.

Code: Select all

0C ♀
3B ;
3C <
4B K
4C L
9D ¥
AD ¡
FB √
What kind of ASCII chart are you using, anyway?

Re: How to print pseudographic symbols?

Posted: Wed Apr 22, 2015 3:01 am
by osdever
Octocontrabass wrote:
catnikita255 wrote:It displays me a wrong characters!
Looks right to me.

Code: Select all

0C ♀
3B ;
3C <
4B K
4C L
9D ¥
AD ¡
FB √
What kind of ASCII chart are you using, anyway?
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.

Re: How to print pseudographic symbols?

Posted: Wed Apr 22, 2015 3:05 am
by osdever
Now it displays me only blank chars instead of window borders.

Re: How to print pseudographic symbols?

Posted: Wed Apr 22, 2015 4:08 am
by Combuster
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;
Did you fix this yet?