Re: gdk and fonts


Subject: Re: gdk and fonts
From: WJCarpenter (bill-abisource@carpenter.ORG)
Date: Tue Jul 04 2000 - 18:47:24 CDT


wjc> It's kind of disappointing that they go to the trouble of
wjc> defining wide character forms of the functions and then actively
wjc> get it wrong.

hp> I kind of doubt it's broken that badly, lots of people are using
hp> GTK with wide characters and have been for over a year. Can you
hp> send a test case showing the problem?

I think it would be rather easy to use it this way without noticing
the problem. If you don't actually use any wide character values
>0xFF, or if all your font usage is actually fontsets, then you don't
see the problem. An application user who did see the problem might
just chalk it up as "another free software rough edge" and not report
it. BTW, my observation is based on gtk+-1.2.5, which are the sources
I had handy. I'm sure they're no longer the latest, so perhaps the
problem is fixed.

Nonetheless, maybe the gdk behavior is by design. The code certainly
makes it look like it's not an accident. So, let me rephrase that I
think there is an impedance mismatch between Abiword and gdk. Abiword
uses the gdk *_wc() functions, expecting characters to be measured or
rendered, even if missing in the given font. I can't think of a
useful purpose in having, for example, 0x2043 treated just like 0x43,
which is what the *_wc() routines seem to do.

To see this problem in action, use Abiword 0.7.10 and manually edit
this string into an existing *.abw file:

        ᅡ⁢Ⅳ≤

Although these are Unicode characters for who knows what glyphs, they
will render in Abiword (via gdk_draw_text_wc()) as "abcd".

hp> Please send a test case showing the problem to
hp> gtk-devel-list@gnome.org (or point out the offending code in the
hp> GDK sources).

I'll do that in a few days, after I have a chance to see if whether
Abi is doing the wrong thing with respect to the gdk API. Meantime,
here is my not-quite-qualified-to-comment view:

In gdkfont.c, in gdk_char_width_wc(), for character values which are not in
the min,max range for the given font the function XTextWidth() is called
with an argument which has been specifically downcast to a char. A
call to XTextWidth16() seems more appropriate.

Similarly, in gdk_text_extents_wc(), the passed-in array of wide
characters is copied into an array of 8bit characters, and
XTextExtents() is called. A call to XTextExtents16() seems more
appropriate.

In gdkdraw.c, in gdk_draw_text_wc(), the passed-in array of wide
characters is copied into an array of 8bit characters, and
XDrawString() is called. A call to XDrawString16() seems more
appropriate.

-- 
bill@carpenter.ORG (WJCarpenter)    PGP 0x91865119
38 95 1B 69 C9 C6 3D 25    73 46 32 04 69 D6 ED F3



This archive was generated by hypermail 2b25 : Tue Jul 04 2000 - 18:54:10 CDT