[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#318923: xterm: localization hell again (even with UTF8 locales)



On Wed, Jul 20, 2005 at 09:02:13AM +0300, Wladimir Mutel wrote:
> On Tue, Jul 19, 2005 at 06:09:36PM -0400, Thomas Dickey wrote:
> 
> > Looking for a different way of seeing things, I find that xfd can display
> > TrueType fonts (in a limited way - no size changes).  If I run
> > 
> > 	xfd -fa Terminus
> 
> 	Oh yes. Running xfd in en_US.UTF-8 locale, I indeed get only 
> 	one glyph page. And running in in uk_UA.UTF-8, I get multiple
> 	pages, with most of required Cyrillic in code points starting 
> 	from 0x400.

I didn't notice that.  But checking, it does indeed match.  Looking at the
trace (see below) from fontconfig, it appears that the weights given for
the language support, without other parameters such as size to override it,
make that select the Unicode font.

Also, setting the locale before running xterm makes it select the Unicode
font.  I did consider last night whether the language feature was supposed
to select a Unicode font, but did not see this in the source - the relation
is indirect.
 
> > It shows me a single page (0 to 255).  Doing
> > 
> > 	xfd -fa FreeMono
> > 
> > shows several pages, populated with glyphs.  Looking for the files that
> > represent xfonts-terminus, I see only some bitmap fonts.
> 
> 	Yes, Terminus is bitmapped. But on my system it is managed
> 	through FontConfig and displayed in fc-list as well.
> 
> 	As to FreeMono, in en_US.UTF-8 xfd catches 'Bitstream Vera Sans
> 	Mono' that does not have Cyrillic page; and in uk_UA.UTF-8 -
> 	'Andale Mono' (Microsoft TTF) that does have it.

fontconfig has a property for language, which is used to limit the fonts
returned.  But since the 8-bit and Unicode flavors for Terminus fonts both
support your language, both are matched.
 
> > However, as you report, I can tell gvim to load "Terminus" font and display
> > the date in uk_UA.UTF-8 locale.
> 
> 	Yes, gvim and Mozilla were rock-solid as to i18n, since long.
>  
> > Here is another clue: I can see by the access times which font is actually
> > being loaded.  For whatever reason, both xterm and xfd are causing Xft
> > to load the 8859-1 version of the font rather than the unicode version.
> 
> 	Yes, indeed something may happen due to Xft/FontConfig. But why
> 	should it limit code points in such way ? To bring more hell to
> 	mixed-language users ? :>
> 	Anyway, gvim and Mozilla managed to overcome that in some way...

gvim is using pango, which interfaces to fontconfig.  Reading through
pango, I couldn't see that it used any features of fontconfig that xterm
wasn't.  So I went back to studying fontconfig.

When I tested gvim, I set the locale outside the program.  That would
make fontconfig return the right font.
 
> > The 8859-1 fonts of course are 8-bit, and the codes that you are attempting
> > to display are not.
> 
> 	I checked this too. I use strace rather that ls/find/etc
> 	options. Lots of useful can be dug out of strace logs.

I read/grep'd through the Xft and fontconfig source looking to see what
parameters could be set.  Neither has any documentation worth discussing -
perhaps 5% of the interface is documented.  But I did find (reading the
source code) that I could set an environment variable to trace it, e.g.,

	export FC_DEBUG=268435455
 
(a set of bits OR'd together - fontconfig uses atoi() which requires
decimal, rather than using strtol() would could allow octal/decimal/hex).

> 
> > So it does not appear to be a problem with the font-files themselves,
> > but perhaps the font server (perhaps requiring some new or modified
> > information).  I see that /usr/bin/X11/xfs is dated June 1.
> 
> 	I don't use xfs. I use client-side FontConfig and server-side
> 	FontPath for 'classic' applications.

It's still the same - the problem is how fontconfig handles the set
of Terminus fonts.
 
> 	Btw, I used XLFDs in app-defaults/XTerm and they worked for me
> 	until some upgrade (don't remember exactly, either xterm from 
> 	4.3.0 to 6.8.2, or between some 6.8.2s), when 'the hell' 
> 	returned again :>
> 
> XTerm:

...

that looks as if it should have worked.
 
> 	After one upgrade, I have found that my xterm started to display
> 	'fixed' font. It started to skip these 'terminus' XLFDs in some way. 
> 	Then I did some juggling (copied XLFDs from XTerm to UXTerm ot vice 
> 	versa, don't remember exactly), and Terminus returned back. But
> 	then it had bad boldification (artificial one, through
> 	overstrike). Then I thrown '*faceName: Terminus' in, which
> 	brought the proper boldification, but with bundled localization
> 	hell as well :>

Currently, all I can see to fix this is to set the uk_UA.UTF-8 locale
before xterm is started.  A better fix would be to either split Terminus
fonts to reflect fontconfig's limitations, or modify fontconfig to allow
the application to tell it to return a Unicode font.

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net

Attachment: pgpRWpWUkFiPi.pgp
Description: PGP signature


Reply to: