Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: tlug: Noseguy
- To: tlug@example.com
- Subject: Re: tlug: Noseguy
- From: "Stephen J. Turnbull" <turnbull@example.com>
- Date: Fri, 27 Nov 1998 13:32:23 +0900 (JST)
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=us-ascii
- In-Reply-To: <Pine.LNX.3.96LJ1.1b7.981127101400.24851S-100000@example.com>
- References: <199811260012.JAA01985@example.com><Pine.LNX.3.96LJ1.1b7.981127101400.24851S-100000@example.com>
- Reply-To: tlug@example.com
- Sender: owner-tlug@example.com
>>>>> "Scott" == Scott Stone <sstone@example.com> writes: Scott> You'll have to relink noseguy with the i18n libraries so Scott> that it can map the encoding to the right font characters. The encoding is plain JIS. Says so, right at the end of the XLFD. The i18n lib don't know nothing about X font encodings, though. Scott> See, right now it doesn't know that it's supposed to Scott> interpret the string as double-byte characters... I don't think so. X11 does not depend on them there i18n libraries, it looks at the font description which says "this here is a font whose first byte runs over the range x0..x1 and whose second byte runs over the range y0..y1" and figures it out for itself. It is quite possible to display kanji fonts without setting locales or anything like that. Just XQueryLoad the font, and use XDrawString16. But I was wrong before when I wrote you don't have to mess with the source under XFree86. You do need to use the XDrawString16 function, and not XDrawString. Here's a patch to XEmacs that allows display of an ASCII string, interpreted as a sequence of shorts, as kanji in a non-Mule XEmacs; it should give an idea of what you need to do. If you've got Noseguy source this may get you rolling. I don't remember why this is necessary (XEmacs does a lot of protecting X from itself), so I'm not sure it answers the problem of Noseguy. But the symptom (blank space where you want mojibake ;-) suddenly sounded familiar. (Why did I want an XEmacs that would happily interpret an ASCII string as kanji? Because I'm seriously thinking about doing a Mule-ectomy on the C sources, and needed a guinea pig....) --- redisplay-x.c-20.5-b17 Sun Dec 7 07:26:50 1997 +++ redisplay-x.c Wed Apr 15 00:56:07 1998 @@ -239,12 +239,29 @@ Lisp_Object font_inst = FACE_CACHEL_FONT (cachel, run->charset); struct Lisp_Font_Instance *fi = XFONT_INSTANCE (font_inst); if (!fi->proportional_p) +#define MUX 1 +#if ((MUX) && ! (MULE)) + return fi->width * run->len/((FONT_INSTANCE_X_FONT (fi) -> min_byte1 + || FONT_INSTANCE_X_FONT (fi) -> max_byte1) + ? 2 : 1); +#else return fi->width * run->len; +#endif else { if (run->dimension == 2) return XTextWidth16 (FONT_INSTANCE_X_FONT (fi), (XChar2b *) run->ptr, run->len); +#define MUX 1 +#if ((MUX) && ! (MULE)) + /* Quick hack to try to get MBCS displayed under non-mule XEmacs * + * balloon_help.c also uses XDrawString but hasn't been hacked. * + * It doesn't seem to know anything about Mule anyway.... */ + else if ( FONT_INSTANCE_X_FONT (fi) -> min_byte1 + || FONT_INSTANCE_X_FONT (fi) -> max_byte1) + return XTextWidth16 (FONT_INSTANCE_X_FONT (fi), + (XChar2b *) run->ptr, run->len/2); +#endif else return XTextWidth (FONT_INSTANCE_X_FONT (fi), (char *) run->ptr, run->len); @@ -956,6 +973,24 @@ clip_box, 1, Unsorted); } +#if ((MUX) && ! (MULE)) + /* Quick hack to try to get MBCS displayed in non-mule XEmacs */ + if (runs[i].dimension != 1) + (bgc ? XDrawString16 : XDrawImageString16) (dpy, x_win, gc, xpos, + dl->ypos, + (XChar2b *) runs[i].ptr, + runs[i].len); + else if (FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font)) -> min_byte1 + || FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font)) -> max_byte1) + (bgc ? XDrawString16 : XDrawImageString16) (dpy, x_win, gc, xpos, + dl->ypos, + (XChar2b *) runs[i].ptr, + runs[i].len/2); + else + (bgc ? XDrawString : XDrawImageString) (dpy, x_win, gc, xpos, + dl->ypos, (char *) runs[i].ptr, + runs[i].len); +#else if (runs[i].dimension == 1) (bgc ? XDrawString : XDrawImageString) (dpy, x_win, gc, xpos, dl->ypos, (char *) runs[i].ptr, @@ -965,6 +1000,7 @@ dl->ypos, (XChar2b *) runs[i].ptr, runs[i].len); +#endif /* We draw underlines in the same color as the text. */ if (cachel->underline) @@ -1055,12 +1091,26 @@ XSetClipRectangles (dpy, cgc, cursor_start, dl->ypos - dl->ascent, clip_box, 1, Unsorted); +#if ((MUX) && ! (MULE)) + /* Quick hack to try to get MBCS displayed in non-mule XEmacs */ + if (runs[i].dimension != 1) + XDrawImageString16 (dpy, x_win, cgc, xpos, dl->ypos, + (XChar2b *) runs[i].ptr, runs[i].len); + else if (FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font)) -> min_byte1 + || FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font)) -> max_byte1) + XDrawImageString16 (dpy, x_win, cgc, xpos, dl->ypos, + (XChar2b *) runs[i].ptr, runs[i].len/2); + else + XDrawImageString (dpy, x_win, gc, xpos, dl->ypos, + (char *) runs[i].ptr, runs[i].len); +#else if (runs[i].dimension == 1) XDrawImageString (dpy, x_win, cgc, xpos, dl->ypos, (char *) runs[i].ptr, runs[i].len); else XDrawImageString16 (dpy, x_win, cgc, xpos, dl->ypos, (XChar2b *) runs[i].ptr, runs[i].len); +#endif XSetClipMask (dpy, cgc, None); XSetClipOrigin (dpy, cgc, 0, 0); -- University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN Institute of Policy and Planning Sciences Tel/fax: +81 (298) 53-5091 __________________________________________________________________________ __________________________________________________________________________ What are those two straight lines for? "Free software rules." ---------------------------------------------------------------- Next Technical Meeting: 12 December, 12:30 HSBC Securities Office Next Nomikai: 15 January 1999, 19:30 Tengu TokyoEkiMae 03-3275-3691 ---------------------------------------------------------------- more info: http://tlug.linux.or.jp Sponsors: PHT, HSBC Securities
- References:
- tlug: Noseguy
- From: Frank Bennett <bennett@example.com>
- Re: tlug: Noseguy
- From: Scott Stone <sstone@example.com>
Home | Main Index | Thread Index
- Prev by Date: tlug: Apache restart
- Next by Date: tlug: Apache restart
- Prev by thread: Re: tlug: qpopper vs. tcpd
- Next by thread: tlug: Moving sale (hypothetical question :-)
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links