Re: [PATCH] Icon view RTL layout



On Fri, 2006-03-03 at 15:56 +0100, Christian Neumair wrote:

> My first thought was: Well, let's calc. the width needed by the layout
> and shift the final text position to the right by (max_width -
> layout_width). This seemed to work totally fine, until I discovered what
> happens when you mix RTL and LTR layouts. You may well up with something
> like:
> 
> [                         alephbeth ]
> [ somemorelatintext                 ]
> 
> So a simple offset will break your layout. A PangoLayout with a width of
> max_width will never be appropriate for arbitrary mixtures of LTR/RTL,
> because sometimes you just can't get the offset right.

I'm not sure what exactly the problem is here. Lets use some concrete
examples. Say upper case is RTL and lower case is LTR, the main
direction is RTL, and the max width is this:
[            ]

Lets start with some simple string that fits in max-width: "ABC abc",
"ABC", and "abc". These should be layed out as:
[     abc CBA]

[         abc]

[         CBA]

This is not a problem. We set the max width, get the pixel width and we
shift the layout by max-text-width - pixel_width.

With longer strings, like "abcd efgh ijkl mnop", "ABCD EFGH IJKL MNOP",
"ABCD efgh ijkl MNOP" we get:

[   abcd efgh]
[   ijkl mnop]

[   HGFE DCBA]
[   PONM LKJI]

[   efgh DCBA]
[   PONM ijkl]

For all these we can also just take max-text-width - pixel-width and
shift the layout by it.

Can you give an example string in this "language" where this method
would not work?

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an underprivileged bohemian sorceror looking for 'the Big One.' She's a 
transdimensional French-Canadian widow living homeless in New York's sewers. 
They fight crime! 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]