[comp.windows.x] Using 16 bit fonts

welch@sandstorm.Berkeley.EDU (Sean N. Welch) (02/17/90)

I've been playing around a little with some of the 16 bit fonts that
we have for use with X11R4 on our cluster of Apollo Domain 3500's 
and I would like to know how to specify a character as part of a
string for something like a titlebar.  However, it isn't for a program
that I'm writing.  I know about XChar2b and XDrawString16, but they
aren't what I need since I'm not going to rewrite a window manager.

Basically, after having specified something like k14 as the titlefont
for xterm in a .twmrc for twm v 1.104 89/12/14, how can we specify
characters to go into the title (printable characters, that is)?
We have tried fooling around with different quoting of hex and octal
representation, but without success.  Any helpful hints would be 
appreciated.

Sean Welch
welch@ocf.Berkeley.EDU

erik@sravd.sra.JUNET (Erik M. van der Poel) (02/17/90)

In article <1990Feb16.221802.20196@agate.berkeley.edu> Sean N. Welch writes:

> Basically, after having specified something like k14 as the titlefont
> for xterm in a .twmrc for twm v 1.104 89/12/14

The R4 twm does not call the 16 bit text drawing functions, so you
cannot get Kanji in a title bar unless you change twm.


> how can we specify characters to go into the title (printable
> characters, that is)?  We have tried fooling around with different
> quoting of hex and octal representation, but without success.

There are many ways to tell twm what to put in the titlebar, and I
don't claim to know all of them, but here are a couple:

	Client command line

		In xterm's case, for example, you might use -title.
		However, this does not work if you specify the string
		in a Kanji code with the 8th bit up, and you are using
		an ordinary shell that uses the 8th bit for something
		else. Some well known Kanji codes are JIS, Shift-JIS,
		and EUC, of which only JIS uses just 7 bits of each
		byte.

	Resource file

		For xterm, you might have the following:

			somename*title: kanjistring


In (new) JIS, for example, "Kanji" is "^[$B4A;z^[(J", where the "^["
is supposed to be Escape (033).

The "^[$B" takes you into JIS, and the "^[(J" takes you back out
again, so the actual characters (kan & ji) are "4A;z". That's 16 bits
per character.

You can easily create a program that prints Kanji on your X display if
you use some of the library functions that come with R4. For example,
to convert from JIS to an internal format you could use

	convJIStoJWS()

and to write that internal format out to the screen, you use

	XWSDrawImageString()

both under contrib/clients/kinput/xlocal/.

There is a lot of software for using Japanese in the R4 distribution,
so to give you some idea, I present a



		Guide to Oriental Language Support in X11R4


This is a list of directories and files in the X11R4 distribution
where you can find something related to oriental languages. This list
is not guaranteed to be complete, and is not in any particular order.

mit/lib/X/
mit/doc/Xlib/
mit/hardcopy/Xlib/

	XDrawText16(), XDrawString16(), XDrawImageString16()

mit/fonts/bdf/misc/k14.bdf

	A 14-by-14 dot Kanji font.

mit/clients/xfd/

	Yes! You can use the ordinary xfd to display Kanji!

contrib/clients/kterm/

	A terminal emulator based on xterm that can display Kanji, and
	allows Kanji input through kinput (see below).

contrib/clients/kinput/

	This daemon pops up a little window for converting from
	English letters to Kana and then to Kanji, by talking to
	another server called jserver (part of Wnn).

contrib/clients/kinput/xlocal/

	This library contains utilities for converting between various
	code types and for drawing text.

contrib/clients/mlx/

	This directory contains a terminal emulator, Japanese, Chinese
	and Taiwanese fonts, and some utilities.

contrib/lib/mbx/

	Multibyte X - some code to draw 16 bit characters. This code
	is associated with a proposal for multibyte processing in X.

contrib/lib/XJ/

	Another terminal emulator, and various libraries and utilities
	for input and output of Japanese. These also use Wnn.

contrib/lib/Wnn/

	This system contains the jserver which converts from Kana to
	Kanji, using general, specialized and customized dictionaries.


------------------------------------------------------------------------

Last but not least I should mention nemacs (Nihongo emacs), a Japanese
emacs based on GNU emacs. This is not in X11R4, but is used here by
many people on a daily basis. It is available through ftp in the US as
well.


Erik M. van der Poel                  erik@sra.co.jp             (Japan)
SRA, 1-1-1 Hirakawa-cho, Chiyoda-ku   erik%sra.co.jp@uunet.uu.net  (USA)
Tokyo 102 Japan. TEL +81-3-234-2692   erik%sra.co.jp@mcvax.uucp (Europe)

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (02/20/90)

    I've been playing around a little with some of the 16 bit fonts that
    we have for use with X11R4 on our cluster of Apollo Domain 3500's 
    and I would like to know how to specify a character as part of a
    string for something like a titlebar.

Unless the program was explicitly designed to deal with 2-byte/16-bit
glyph indexes, you can't do this.  R4 twm doesn't support this.  This
is just one aspect of internationalization support now being worked on
within the X Consortium.