Re: wrong position of underline
- From: Owen Taylor <otaylor redhat com>
- To: Changwoo Ryu <cwryu adam kaist ac kr>
- Cc: gtk-list redhat com
- Subject: Re: wrong position of underline
- Date: 13 Nov 1998 02:57:50 -0500
Changwoo Ryu <cwryu@adam.kaist.ac.kr> writes:
> A multibyte bug.
>
> When I set LANG=ko and specify fontset in gtkrc, underline of label is
> placed at a wrong x coordinate.
>
> It looks that gtk_label_process_row() in gtk/gtklabel.c assumes that a
> text width is sum of its one byte characters' widths. I couldn't
> understand the code... But I think there's no need to call
> gdk_text_extents for every bytes.
The code does not call gdk_text_extents for each byte. Rather, it
calls gdk_text_extents for each contiguous sequence of underlined
characters, so that it can add the underlines with a minimum of wasted
space.
However, this isn't very relevant, because the real problem here is
that the code needs to iterate character-by-character through the
string to determine the underlined characters, and the code isn't
multi-byte aware.
I believe that you should be able to get the underlines to display
properly by underlining breaking the character you want to underline
in two and prepending a '_' to _both_ bytes. But that really isn't the
right solution...
This problem makes me wonder how underline accelerators work
in non-roman languages. For Korean entered on a Roman keyboard,
it seems relatively straightforward - I would image that
if the menu item was 'haemul' and 'hae' was underlined, than
the keyboard accelerator would be 'h'.
But for Japanese and Chinese the problem is much trickier - for
Japanese especially, going from Kanji to keyboard key does not
seem feasible. For these languages and probably also Korean,
perhaps one would want to extend the syntax of the underline
accelerators for menus so that: (using the Korean example)
&h_(hae)(mul)
would mean use 'h' as the accelerator, but don't display it, and
underline 'hae'. This still presents some problems when
dealing with non-roman keyboads. (How do you map from
the EUC encoding of the Japanese kana 'sa' to GDK_kana_SA?
Presumably you need a table.) But do Japanese and Chinese
language programs typically use underline accelerators
at all?
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]