|
| CTextLayout::GetLineRectL incorrect for right-to-left lines |
 |
Mon, 03 Jul 2006 15:35:47 +020 |
Hi,
another right-to-left specific problem [add to Nokia wishlist: please
support at least one right-to-left localization in the S60 emulator, in
addition to Far Eastern languages... :-)].
I found that the CTextLayout::GetLineRectL method returns an incorrect
(typically empty) rectangle when applying it to a pair of text positions
within a line where aDocPos1 is to the left of aDocPos2, such as in
Arabic text.
The reason for this is fairly clear from the DevKit source (at least in
version 8.1b) - it seems that the code was written with the assumption
that aDocPos2 is either the end of the line, or to the right of
aDocPos1. If this does not hold, the rectangle collapses to zero width
at the start (i.e. left margin) of the line.
|
| Post Reply
|
| Re: CTextLayout::GetLineRectL incorrect for right-to-left lines |
 |
Mon, 10 Jul 2006 03:41:56 +010 |
Hi Marcus
In the presence of bidirectional text, the result cannot be assumed to be a
single rectangle, so the API "can't" work. We're considering what to
do
here.
Regards
H
"Marcus Groeber" <marcus.groeber@nuance.com> wrote in message
news:H3FpGXqnGHA.4968@UKCOL01WWEB01.symbian.intra...
> Hi,
>
> another right-to-left specific problem [add to Nokia wishlist: please
> support at least one right-to-left localization in the S60 emulator, in
> addition to Far Eastern languages... :-)].
>
> I found that the CTextLayout::GetLineRectL method returns an incorrect
> (typically empty) rectangle when applying it to a pair of text positions
> within a line where aDocPos1 is to the left of aDocPos2, such as in
> Arabic text.
>
> The reason for this is fairly clear from the DevKit source (at least in
> version 8.1b) - it seems that the code was written with the assumption
> that aDocPos2 is either the end of the line, or to the right of
> aDocPos1. If this does not hold, the rectangle collapses to zero width
> at the start (i.e. left margin) of the line.
>
> ciao marcus
|
| Post Reply
|
| Re: CTextLayout::GetLineRectL incorrect for right-to-left lines |
 |
Mon, 10 Jul 2006 10:19:26 +020 |
Hamish Willee wrote:
> In the presence of bidirectional text, the result cannot be assumed to be
a
> single rectangle, so the API "can't" work. We're considering what
to do
> here.
Agreed - in lines with ends of mixed directionality, it is not obvious
how this API should react short of returning a TRegion, but at least for
pure right-to-left lines the solution is just the same as for
left-to-right, inverted. ;-)
My first thought would be to go for a bounding box, but that may be
biased by my use case (I just want to highlight the current line, and/or
a whole word inside that line, with a closely hugging rectangle).
|
| Post Reply
|
| Re: CTextLayout::GetLineRectL incorrect for right-to-left lines |
 |
Tue, 11 Jul 2006 03:15:24 +010 |
Hmm. What about this? Do you see any use cases which would not be addressed
by the below?
/** Gets the rectangle of the text chunk (which is a logically and visually
contiguous piece of text on a single line with constant character formatting
attributes) from the formatting.
@param aChunkRect Returns the rectangle of the chunk containing aDocPos
@param aChunkStart Returns the document position of the start of the chunk
returned
@param aChunkEnd Returns the length of the chunk returned
@param aDocPos The position to find.
@return KErrNotFound if the position is not formatted, or KErrNone if all is
successful. */
TInt CTextLayout::GetChunk(TRect& aChunkRect, TInt& aChunkStart,
TInt&
aChunkLength, TTmDocPosSpec& aDocPos) const;
Cheers.
H
"Marcus Groeber" <marcus.groeber@nuance.com> wrote in message
news:L3NxDn$oGHA.1040@UKCOL01WWEB01.symbian.intra...
> Hamish Willee wrote:
>
> > In the presence of bidirectional text, the result cannot be assumed
to
be a
> > single rectangle, so the API "can't" work. We're considering
what to do
> > here.
>
> Agreed - in lines with ends of mixed directionality, it is not obvious
> how this API should react short of returning a TRegion, but at least for
> pure right-to-left lines the solution is just the same as for
> left-to-right, inverted. ;-)
>
> My first thought would be to go for a bounding box, but that may be
> biased by my use case (I just want to highlight the current line, and/or
> a whole word inside that line, with a closely hugging rectangle).
>
> ciao marcus
|
| Post Reply
|
| Re: CTextLayout::GetLineRectL incorrect for right-to-left lines |
 |
Tue, 11 Jul 2006 10:53:08 +020 |
Hamish Willee wrote:
> Hmm. What about this? Do you see any use cases which would not be
addressed
> by the below?
>
> /** Gets the rectangle of the text chunk (which is a logically and
visually
> contiguous piece of text on a single line with constant character
formatting
> attributes) from the formatting.
>
> TInt CTextLayout::GetChunk(TRect& aChunkRect, TInt& aChunkStart,
TInt&
> aChunkLength, TTmDocPosSpec& aDocPos) const;
How would I go about getting the bounds for a single word inside a line?
In this situation, I would understand GetChunk() to expand the range to
potentially cover the whole line, giving me no control over what part of
the line I want to highlight.
The other difference I can see is that GetChunk() also looks at the
formatting of the text, unlike GetLineRectL (which may or may not be a
good thing).
|
| Post Reply
|
|
|
|
|
|
|
|
|
|