#include <bidi.h>
class TBidirectionalState |
The bidirectional state class. This class contains functions that implement the Unicode Bidirectional Algorithm, which changes text from logical order to display order for the correct display of right-to-left scripts, like Arabic and Hebrew. A TBidirectionalState object carries the embedding level and stack from one line to the next. On construction it is in its 'start of paragraph' state.
TBidirectionalState | ( | TChar::TBdCategory | aPrevCat, |
TChar::TBdCategory | aPrevStrongCat, | ||
TBool | aParRightToLeft | ||
) |
Constructor suitable for test code.
Finds the highest bit set in the input. Used to convert TBidirectionalState::TCategory into TChar::TBdCategory.
Parameter | Description |
---|---|
aCat | a TBidirectionalState::TCategory. |
Returns: The equivalent TChar::TBdCategory.
void | DeneutralizeRuns | ( | TRunInfo * | aStart, |
TRunInfo * | aEnd, | |||
TCategory | aStartCategory, | |||
TCategory | aEndCategory | |||
) | [static] |
Turn all ON (Other Neutral) into non-neutrals according to the rules N1 and N2.
Parameter | Description |
---|---|
aStart | The start of the run array to be altered. |
aEnd | One past the end of the run array to be altered. |
aStartCategory | The last non-neutral before the run, must be ELeftToRight or ERightToLeft. |
aEndCategory | The first non-neutral after the run, must be ELeftToRight or ERightToLeft. |
IMPORT_C void | ExternalizeL | ( | RWriteStream & | aDest | ) |
Serializes a bidirectional state to an output stream.
Parameter | Description |
---|---|
aDest | An output stream. |
TInt | GenerateBdRunArray | ( | const TText * | aText, |
TInt | aLength, | |||
TBidirectionalState::TRunInfo * | aRun, | |||
TInt | aMaxRuns | |||
) | [static] |
Analyse the input text for runs of characters that share the same bidirectional class. Categories TChar::EEuropeanNumberSeparator and TChar::ECommonNumberSeparator are kept as singletons due to a limitation in the reordering logic.
Parameter | Description |
---|---|
aText | The text to be analysed. |
aLength | The length of the text to be analysed. |
aRun | Output buffer for the runs after analysis. May be null if there is to be no output. |
aMaxRuns | The size of the aRun array. No more than this number of runs will be output. |
Returns: The number of runs that are required for the full results of the analysis.
void | HandleBdControls | ( | TReorderContext & | aContext | ) |
Handle LRO, RLO, LRE, RLE and PDF. After this phase, these categories will no longer be found.
This corresponds to Unicode(3.2) Bidirectional Algorithm phases X1-X7. Phase X8 is not required as the run is assumed to be all in one paragraph. Phases X9-X10 are implicit in other functions.
IMPORT_C void | InternalizeL | ( | RReadStream & | aSource | ) |
Reads a bidirectional state from an input stream, translating it from its serialized form.
Parameter | Description |
---|---|
aSource | A source stream. |
IMPORT_C TBool | IsDefault | ( | ) | const |
Returns Gets the default 'start of paragraph' state.
Returns: ETrue if the object is in its default 'start of paragraph' state.
void | PrepareForNextLine | ( | const TReorderContext & | aContext | ) |
Fold context information back into TBidirectionalState.
IMPORT_C void | ReorderLine | ( | TRunInfo * | aRunInfo, |
TInt | aRuns, | |||
TBool | aParStart, | |||
TBool | aParEnd, | |||
TBool | aParRightToLeft, | |||
TChar::TBdCategory | aNextCategory, | |||
TChar::TBdCategory | aNextStrongCategory, | |||
TBool & | aVisualEndIsAmbiguous | |||
) |
Reorders a line of text and updates the bidirectional state for the next line.
Parameter | Description |
---|---|
aRunInfo | An array of objects representing runs of characters with the same bidirectional category. Any number of characters can be combined into a run if they have the same category, except for the categories TChar::EEuropeanNumberSeparator and TChar::ECommonNumberSeparator, which should be put into single-character runs because the reordering logic depends on this. |
aRuns | Number of 'run info' objects. |
aParStart | Tells the function whether the line is the first line of a paragraph. |
aParEnd | Tells the function whether the line is the last line of a paragraph. |
aParRightToLeft | ETrue if the default directionality of the text to be re-ordered is right-to-left. |
aNextCategory | The category of the character immediately after the end of the line. This is ignored if aParEnd is ETrue. |
aNextStrongCategory | The category of the first strong character (one of the categories ELeftToRight, ELeftToRightEmbedding, ELeftToRightOverride, ERightToLeft, ERightToLeftArabic, ERightToLeftEmbedding or ERightToLeftOverride) after the end of the line. This is ignored if aParEnd is ETrue. |
aVisualEndIsAmbiguous | EFalse if the logical end of this line is at the visual end and the logical beginning of the next line is at the visual beginning. |
IMPORT_C void | ReorderLine | ( | TRunInfo * | aRunInfo, |
TInt | aRuns, | |||
TBool | aParStart, | |||
TBool | aParEnd, | |||
TBool | aParRightToLeft, | |||
TChar::TBdCategory | aNextCategory, | |||
TChar::TBdCategory | aNextStrongCategory | |||
) |
Reorders a line of text and updates the bidirectional state for the next line.
Parameter | Description |
---|---|
aRunInfo | An array of objects representing runs of characters with the same bidirectional category. Any number of characters can be combined into a run if they have the same category, except for the categories TChar::EEuropeanNumberSeparator and TChar::ECommonNumberSeparator, which should be put into single-character runs because the reordering logic depends on this. |
aRuns | Number of 'run info' objects. |
aParStart | Tells the function whether the line is the first line of a paragraph. |
aParEnd | Tells the function whether the line is the last line of a paragraph. |
aParRightToLeft | ETrue if the default directionality of the text to be re-ordered is right-to-left. |
aNextCategory | The category of the character immediately after the end of the line. This is ignored if aParEnd is ETrue. |
aNextStrongCategory | The category of the first strong character (one of the categories ELeftToRight, ELeftToRightEmbedding, ELeftToRightOverride, ERightToLeft, ERightToLeftArabic, ERightToLeftEmbedding or ERightToLeftOverride) after the end of the line. This is ignored if aParEnd is ETrue. |
IMPORT_C TInt | ReorderText | ( | const TText * | aText, |
TInt | aLength, | |||
TBool | aParRightToLeft, | |||
TText *& | aNewText | |||
) | [static] |
Reorders text according to the Unicode Bidirectional Reordering algorithm.
Reorders the input text from logical order (which may be bidirectional) to display order (strictly left to right).
Parameter | Description |
---|---|
aText | The input text in logical order. |
aLength | The length of the input text. |
aParRightToLeft | ETrue if the default directionality of the text to be re-ordered is right-to-left. |
aNewText | Returns the re-ordered text. If the text did not need re-ordering, or if there was an error, aText will be returned. Otherwise, ownership of a newly allocated buffer will be returned to the caller. This buffer must be deleted with delete[] (or CleanupArrayDeletePushL()) and not delete (or CleanupStack::PushL()). |
Returns: A system-wide error value if there has been an error; KErrNone if there has not.
void | ResolveImplicitLevels | ( | TReorderContext & | aContext | ) |
Phases I1 and I2.
void | ResolveNeutralTypes | ( | TReorderContext & | aContext | ) |
This phase removes the ON (Other Neutral) category, leaving only L, R, EN, and AN; no need to update aContext.iCategories.
void | ResolveWeakTypesW1W2W3 | ( | TReorderContext & | aContext | ) |
Unicode(3.2) Bidirectional Algorithm phases W1, W2 and W3.
void | ResolveWeakTypesW4W5W6 | ( | TReorderContext & | aContext | ) |
This phase removes categories NSM, AL, ES, ET, CS, BS, S, WS and BN, leaving only L, R, EN, AN and ON.
A utility to reverse text apart from combining characters, which remains after their base characters. This is what is needed when drawing right-to-left text.
Parameter | Description |
---|---|
aStart | Start position of text to be reversed. |
aLength | Length of text to be reversed. |
IMPORT_C TBool | operator== | ( | const TBidirectionalState & | aState | ) | const |
Return ETrue if two bidirectional states are identical.
Parameter | Description |
---|---|
aState | A bidirectional state. |
Returns: ETrue if two bidirectional states are identical.