Ar an t-aonú lá déag de mí Lúnasa, scríobh Stephen J. Turnbull:
[...] To give you an idea of how badly the JIS people need a good
fscking, it wasn't until 2000 that all officially registered personal and
place names were finally spellable in JIS standard kanji!)
Han characters are a rotten idea if you have a standard spoken language
anyway; the Koreans did it right. (Which is not to say that they needed to
establish a national character standard with all the precombined Jamo
instead of leaving the combining to software ...)
There needs to be a way to access the more bizarre spellings of
these
registries. Now, doing something like (font-list "-*-jisx0208*-*")
will get the user the relevant names, but is there still a way to
request the font in your scheme? Just give a full registry in the
XLFD I guess?
The registry and encoding in the XLFD will be frobbed--which is a good
thing, it’s the only way to automatically find the font that is identical to
the default font face except that its registry and encoding reflect the
desired charset--so that will do it almost all of the time.
A charset’s registries look like this:
(charset-registries 'japanese-jisx0208)
=> ["jisx0208.1983-0" "jisx0208.1990-0"
"jisc6226.1978-0"]
The “almost all” above comes into play when the user specifies a font with a
given registry and encoding for a charset (say, "jisc6226.1978-0" for
japanese-jisx0208), gives its full XLFD, and another font, identical in XLFD
to the desired one except that its registry comes before that of the desired
font in (charset-registries 'japanese-jisx0208), is available on the X
server. This will be a minor problem at best, since the repertoires will be
~identical; if a particular user prefers a particular registry and encoding,
re-ordering the charset registries for the charset before font instantiation
with (set-charset-registries []) will allow that.
If a particularly contrarian user prefers a particular encoding for once
face’s font and another for another face’s font, and both fonts have
otherwise identical XLFDs with both registry-encoding combinations, then
that user is probably out of luck with this patch, just as before it. (I say
“probably” and mean it to apply to both cases, because I can think of
possible solutions both before the patch and after it, but have no desire to
fuck around with fonts.dir and so on to check them--this is a really
marginal case.)
If the opportunity to use a legacy Japanese X11 installation arises, I would
appreciate a list of the registries and encodings and the corresponding
Japanese Mule character sets there.
Aidan> 2.“Stage-2” X11 support; that is, when lookup of a
font
Aidan> with the registry "Ethiopic-Unicode" fails, make a
Aidan> device-specific note of that, and try again with the
Aidan> registry "iso10646-1" and Unicode conversion in place.
This isn't stage-2 support, strictly speaking. Stage-2 is searching
through the font repertoires for a font that supports a given
character.
If you want to call this "stage-2" and the repertoire search
"stage-3", that's fine by me, but note that the search by repertoire
is evidently straightforward on Windows (and maybe Mac and Xft), and
that's what is implemented on Windows to the best of my knowledge.
Yeah, I’m using symbols instead of numbers anyway, so I’ll avoid that
terminology for the docstrings. With X11 server-side fonts, however, since
searching by repertoire is impossible without hard-coding repertoire
information--I intend doing the weak version of this, that is, keeping
Markus Kuhn’s Unicode XLFDs around as the best fallback for charset lookups
that would otherwise fail--the difference can only be theoretical.
I’ve been working with the Win32 build recently, and this isn’t particularly
well implemented there, which would seem to imply that it’s non-trivial. I
have fonts on this system that support Thai, Arabic, Ethiopic, Greek and
Russian, and it doesn’t find them, while Firefox does.
Aidan> 4. Addition of a heuristic to xft_find_charset_font to
Aidan> accept reasonable font values for the fallback Unicode
Aidan> charsets.
Is cruftification of xft_find_charset_font really worth it? We are
going to get rid of the (Mule) charsets Real Soon Now, I devoutly
hope!
Not before any release, I imagine. And we are going to have to keep around
the Mule charsets in some form for for ISO 2022 support and X11 server-side
font redisplay; using them now gives a useful improvement in functionality
without much work.
Aidan> 2006-08-06 Aidan Kehoe <kehoea(a)parhasard.net>
Aidan> * font-mgr.h:
Aidan> Move some XFT debug macros here from objects-x.c.
If you agree that's right, please just do it if you can partial commit
conveniently (if not, tell me and I'll do it). Don't forget to nuke
the now-irrelevant comment recommending doing so! :-)
I agree that it’s right; I do wonder why you’re not using vararg versions of
those macros, since anyone living on the edge enough to play with XFT support
certainly has a compiler that supports them, they are cleaner, and my patch
of 2005-01-17 used them, so it’s not for want of knowing about them.
Aidan> registry and encoding, _then_ call
Aidan> XListFonts. Eliminates calling XListFonts on a pattern of
Aidan> "*", which is nice, because the huge IPC necessary to parse
Aidan> that was a problem.
I think this analysis is incorrect. On both Linux (256MB, 450MHz PII)
and my Mac (1GB, 1GHz G4) the time to run is about 1 second, quite
comparable to the time required to run "xlsfonts | wc -l" from the
command line.
Try doing either over the network! Nine seconds each for me when the data
needs to find its way to Dublin. Though I haven’t tested if it’s better with
this patch,
Not a complaint against this patch, obviously, but what it suggests
to
me is that the regexp code is either fundamentally REALLY DAMN SLOW or
that the compiled regexp caching is broken, because it takes about 4
seconds for me to run
(let ((fonts nil))
(mapcar (lambda (font)
(when (string-match "^-.*jisx0208.1990-0$" font)
(push font fonts)))
(font-list "*"))
;; minimize read-eval-print i/o
(car fonts))
It does seem to be O(n), which is a relief.
My perception of the regex code is, yes, that it’s REALLY DAMN SLOW. The
same operation (with the list of fonts initialised by hand) is instantaneous
for on GNU Emacs, so it’s nothing fundamental, just some apparently
long-standing rottenness in our code.
--
Santa Maradona, priez pour moi!