[comp.windows.x] Printing characters

sbuck@GATEWAY.MITRE.ORG (Steve Buck) (07/28/89)

I'm trying to print a character at coordinates (x,y).  The following code
gives me a segmentation fault because I'm trying to pass a single character
instead of a pointer to a string:

		print_char(x1, y1, pr_char)
		float   x1, y1;
		char    pr_char;
		{
			XDrawString(display, displaywin, gc, (int)x1, (int)y1,
                                        pr_char, 1);
		}

Could someone please tell me how I should go about printing the single
character "pr_char"?

                     Thanks,
-- 
			-- Steve Buck

The MITRE Corporation, Networking Center
McLean, Virginia
phone:	(703) 883-5574
email:	sbuck@gateway.mitre.org

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (07/28/89)

> Could someone please tell me how I should go about printing the single
> character "pr_char"?

	print_char(x1, y1, pr_char)
	float   x1, y1;
	char    pr_char;
	{
		XDrawString(display, displaywin, gc, (int)x1, (int)y1,
	                    &pr_char, 1);
	}

			    ^
			    |
			 *******

Just passing the character by reference instead of by value should do the 
trick.

						Chris D. Peterson     
						MIT X Consortium 

Net:	 kit@expo.lcs.mit.edu
Phone:   (617) 253 - 9608	
Address: MIT - Room NE43-213

argv%eureka@Sun.COM (Dan Heller) (07/29/89)

In article sbuck@GATEWAY.MITRE.ORG (Steve Buck) writes:
> gives me a segmentation fault because I'm trying to pass a single character
> instead of a pointer to a string:
> 
> 			XDrawString(display, displaywin, gc, (int)x1, (int)y1,
>                                         pr_char, 1);

Try passing the address of pr_char:
> 			XDrawString(display, displaywin, gc, (int)x1, (int)y1,
>                                         &pr_char, 1);

dan <island!argv@sun.com>
-----
My postings reflect my opinion only -- not the opinion of any company.

te07@edrc.cmu.edu (Thomas Epperly) (09/29/89)

I would like to know if there is a way to print the foreign
characters(above 127) to an xterm without writing a full blown X
application.  I would like to print French words with the correct accents
on the letters.  The font "fixed" has these character, but I can't get
xterm to print them.  E.g.  putchar(233); doesn't print an 'e' with an
accent grave like I would like it to.  Please mail suggestions to me!
Tom Epperly
epperly@cs.cmu.edu or
epperly@osnome.che.wisc.edu

jim@EXPO.LCS.MIT.EDU (09/29/89)

> [asking about displaying 8th bit characters in xterm]

Unfortunately, the R3 xterm from MIT has some bugs that prevent it from  being
8-bit clean.  Also, you have to make sure that you've done the appropriate
stty command to set the terminal to pass 8-bit characters.  Fixing xterm
is relatively straightforward (several people posted suggestions about it
several months ago): you change the definition of Char to be unsigned and
rip out the silly loop in input.c that strips the eighth bit.

The R4 xterm will support both input and output of 8-bit characters (yup,
really "meta" characters in your non-X editors).

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (09/29/89)

> > [asking about displaying 8th bit characters in xterm]

> The R4 xterm will support both input and output of 8-bit characters (yup,
> really "meta" characters in your non-X editors).

The R4 Athena AsciiText widget will also support 8-bit characters.  (Yea I know
that makes the name slightly incorrect)

						Chris D. Peterson     
						MIT X Consortium 

Net:	 kit@expo.lcs.mit.edu
Phone:   (617) 253 - 9608	
Address: MIT - Room NE43-213