[PATCH] AWT DrawText Internationalization Problem

Takashi Okamoto toraneko at kun.ne.jp
Tue Jan 2 19:06:17 PST 2001


Hello ,Kaffe VM developers.

I made AWT internationalization patch.

Now ,we can't use multibyte character for X on Kaffe AWT.

Principal reason is that Kaffe's AWT have been constructed under
single font model. I made a patch for this problem. It uses
XwcDrawString instead of XDrawString16. If you are interested in it,
please chec kattached file. And you must modify following line at
Default.java for your fontset when you use this patch. for example:

original code at Default.java:

   String fntCat = Integer.toString(res) + '-' + res + "-*-*-*-*";
   //FsDefault = "-b&h-lucida-%s-%s-*-*-*-%d-" + fntCat;
   FsDefault = "-adobe-helvetica-%s-%s-*-*-*-%d-"  + fntCat;
   FsMonospaced = "-adobe-courier-%s-%s-*-*-*-%d-" + fntCat;
   FsSansSerif = "-adobe-helvetica-%s-%s-*-*-*-%d-" + fntCat;
   FsSerif = "-adobe-times-%s-%s-*-*-*-%d-" + fntCat;
   FsDialog = "-misc-fixed-%s-%s-*-*-*-%d-" + fntCat;
   FsDialogInput = "-b&h-lucidatypewriter-%s-%s-*-*-*-%d-" + fntCat;
   FsZapfDingbats = "-adobe-new century schoolbook-%s-%s-*-*-*-%d-" +
fntCat;

for japanese(kandata font):

   String fntCat = Integer.toString(res) + '-' + res + "-*-*-*-*";
   //FsDefault = "-b&h-lucida-%s-%s-*-*-*-%d-" + fntCat;
   FsDefault = "-misc-kandata-%s-%s-normal--*-%d-"  + fntCat;
   FsMonospaced = "-misc-kandata-%s-%s-normal--*-%d-" + fntCat;
   FsSansSerif = "-misc-kandata-%s-%s-normal--*-%d-" + fntCat;
   FsSerif = "-misc-kandata-%s-%s-normal--*-%d-" + fntCat;
   FsDialog = "-misc-kandata-%s-%s-normal--*-%d-" + fntCat;
   FsDialogInput = "-misc-kandata-%s-%s-normal--*-%d-" + fntCat;
   FsZapfDingbats = "-misc-kandata-%s-%s-normal--*-%d-" + fntCat;


Note: Specified fontset should include all style.
 (ex. -misc-kandata-medium-r-..
      -misc-kandata-medium-i-..
      -misc-kandata-bold-r-..
      -misc-kandata-bold-i-..)


I think default font should be modified by font.properties file (like
SUN and IBM JDK).


I also write main topic for this patch.

in library/clib/awt/X/gra.c

  XDrawString16( X->dsp, gr->drw, gr->gc, x+gr->x0, y+gr->y0, b, len);

XDrawString16 can't treat FontSet. It's only purpose for single font.
So, it's not good for internationalization.
I use XwcDrawString instead of XDrawString16.


in library/clib/awt/X/fnt.c

  XFontStruct* fs = 0;

  -- snip --

  fs = XLoadQueryFont( X->dsp, buf);


We must use XOC or XFontSet instead of XFontStruct for XwcDrawString.
I used XOC for font set.

Regards.
----------------------------
Takashi Okamoto
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kaffe-1.0.6-awt-X-multibyte-patch.tgz
Type: application/x-compressed
Size: 15619 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/20010103/2915c4df/attachment-0003.bin 


More information about the kaffe mailing list