On Fri, Jan 28, 2011 at 5:10 PM, Steven R. Loomis <srl@...:
> Re-proposing on behalf of Mati.
> Reviewer: Markus (who filed #3660 a long time ago)
> Please respond by Feb 9th, 2011
> Target: 4.8 - yes, we really want to commit this, this time.
>
> [...]
>
> a) This proposal only addresses ICU4C. Once there is an agreement on
> ICU4C, I will submit a parallel proposal for ICU4J.
>
FYI: We ended up with the new com.ibm.icu.text.Bidi.java method copied
below. I don't think the Java signature had been sent to this list before.
Best regards,
markus
/**
* Set the context before a call to setPara().<p>
*
* setPara() computes the left-right directionality for a given piece
* of text which is supplied as one of its arguments. Sometimes this
piece
* of text (the "main text") should be considered in context, because
text
* appearing before ("prologue") and/or after ("epilogue") the main text
* may affect the result of this computation.<p>
*
* This function specifies the prologue and/or the epilogue for the next
* call to setPara(). If successive calls to setPara()
* all need specification of a context, setContext() must be called
* before each call to setPara(). In other words, a context is not
* "remembered" after the following successful call to setPara().<p>
*
* If a call to setPara() specifies DEFAULT_LTR or
* DEFAULT_RTL as paraLevel and is preceded by a call to
* setContext() which specifies a prologue, the paragraph level will
* be computed taking in consideration the text in the prologue.<p>
*
* When setPara() is called without a previous call to
* setContext, the main text is handled as if preceded and followed
* by strong directional characters at the current paragraph level.
* Calling setContext() with specification of a prologue will change
* this behavior by handling the main text as if preceded by the last
* strong character appearing in the prologue, if any.
* Calling setContext() with specification of an epilogue will change
* the behavior of setPara() by handling the main text as if followed
* by the first strong character or digit appearing in the epilogue, if
any.<p>
*
* Note 1: if <code>setContext</code> is called repeatedly without
* calling <code>setPara</code>, the earlier calls have no
effect,
* only the last call will be remembered for the next call to
* <code>setPara</code>.<p>
*
* Note 2: calling <code>setContext(null, null)</code>
* cancels any previous setting of non-empty prologue or
epilogue.
* The next call to <code>setPara()</code> will process no
* prologue or epilogue.<p>
*
* Note 3: users must be aware that even after setting the context
* before a call to setPara() to perform e.g. a logical to
visual
* transformation, the resulting string may not be identical to
what it
* would have been if all the text, including prologue and
epilogue, had
* been processed together.<br>
* Example (upper case letters represent RTL characters):<br>
* prologue = "<code>abc DE</code>"<br>
* epilogue = none<br>
* main text = "<code>FGH xyz</code>"<br>
* paraLevel = LTR<br>
* display without prologue = "<code>HGF xyz</code>"
* ("HGF" is adjacent to "xyz")<br>
* display with prologue = "<code>abc HGFED xyz</code>"
* ("HGF" is not adjacent to "xyz")<br>
*
* @param prologue is the text which precedes the text that
* will be specified in a coming call to setPara().
* If there is no prologue to consider,
* this parameter can be <code>null</code>.
*
* @param epilogue is the text which follows the text that
* will be specified in a coming call to setPara().
* If there is no epilogue to consider,
* this parameter can be <code>null</code>.
*
* @see #setPara
* @draft ICU 4.8
* @provisional This API might change or be removed in a future release.
*/
public void setContext(String prologue, String epilogue);
|