[mcclim-devel] Command and non-ASCII problems

Christophe Rhodes csr21 at cam.ac.uk
Fri Dec 30 08:49:39 UTC 2005


Troels Henriksen <athas at sigkill.dk> writes:

> Furthermore, non-ASCII-input (the Danish special characters Æ, Ø and
> Å, for example) does not show up in the text-editor pane. I assume
> that McCLIM lacks support for this. Where would I want to look, if I
> am to hack up some support for this?

This is (unfortunately) a complicated problem.

The CLX functions for drawing text take a :translate keyword argument,
for translating from characters to (font, glyph index) pairs.
<http://common-lisp.net/project/cmucl/doc/clx/6_7_Drawing_Text.html>
has much more detail about this; the default translate function simply
maps ascii characters to their char-codes, and assumes that the font
never changes.

So to hack support for Danish special characters, it might be as
simple as finding a font that is encoded in iso-8859-1, making sure
it's available on all X servers, using it in McCLIM, and writing a
slightly less conservative translate-function.  Of course, this won't
get (say) the euro symbol to work, because that's not in the
iso-8859-1 repertoire; it is in -15, but using that would mean losing
some other characters.

So a more proper answer might be to find a font encoded in
iso-10646-1, which is basically 16-bit Unicode.  Typically, fonts
don't actually have all 2^16 points filled, but at least the translate
function for those is still relatively simple.  Otherwise, one might
need to use sets of fonts and change between them where necessary.

(All of this assumes that you're using the CLX backend, of course; I
have no idea how any of this works in other backends...)

Cheers,

Christophe



More information about the mcclim-devel mailing list