Automatic paragraph direction in gtktextlayout
- From: dov imagic weizmann ac il
- To: gtk-i18n-list gnome org, gtk-devel-list gnome org
- Subject: Automatic paragraph direction in gtktextlayout
- Date: Sat, 29 Sep 2001 21:32:46 IST
I've been thinking about changing the textlayout widget to add the
option of "automatic" paragraph directionality. The change is more in
the spirit of unicode than is the current implementation. Now the
paragraph direction is determined either by the global textlayout
direction, or overridden through a style. The idea is that the first
strong character (according to the Unicode classification) of each
paragraph should determine the paragraphs direction as either LTR or
RTL. In case there is no strong character in the paragraph, then
either using the last paragraph's directionality or the global
textviewing direction should be ok.
For the BiDi users on this list, I wonder if you agree that this is
a desired behaviour. For Owen and Havoc, I wonder what is a good place
to insert this change? 8-) It seems to me that the following position
in gtktextlayout.c would be a good place:
/* We have to delay setting the paragraph values until we
* hit the first pixbuf or text segment because toggles at
* the beginning of the paragraph should affect the
* paragraph-global values
*/
if (!para_values_set)
{
set_para_values (layout, style, display, &align);
para_values_set = TRUE;
}
I could add a routine to fribidi that calculates the base direction
based on the first strong character. I would call this routine before
the set_para_values() to get the implicit base direction. I would then
add this base direction as a parameter to set_para_values().
Of course this behaviour should be made configurable, e.g. by the
variable "use_bidi_algorithm_paragraph_direction" or something shorter
if you have any better idea. Also, if an explicit directionality
directive has been set in the style, then it should override the
paragraph direction. An additional idea when exporting the paragraph
is to automatically add RLM and LRM as a first character in the
paragraph in order to resolve ambiguity in case the paragraph
direction and the first strong character are not the same.
So what do you think? (You can tell me to leave you alone until
gtk-2.0 is out, that's ok. 8-)
Regards,
Dov
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]