本文整理汇总了Java中com.ibm.icu.text.Bidi类的典型用法代码示例。如果您正苦于以下问题:Java Bidi类的具体用法?Java Bidi怎么用?Java Bidi使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Bidi类属于com.ibm.icu.text包,在下文中一共展示了Bidi类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bidiReorder
import com.ibm.icu.text.Bidi; //导入依赖的package包/类
@SuppressWarnings("unused")
public static String bidiReorder(IBFFontRenderer font, String text)
{
if (betterFontsEnabled && font.getStringRenderer() != null)
{
return text;
}
try
{
Bidi bidi = new Bidi((new ArabicShaping(8)).shape(text), 127);
bidi.setReorderingMode(0);
return bidi.writeReordered(2);
} catch (ArabicShapingException var3)
{
return text;
}
}
示例2: isBidi
import com.ibm.icu.text.Bidi; //导入依赖的package包/类
/**
* Figures out if the given text requires Bidi processing
*
* @param txt
* String to query Bidi processing
* @param inFormat
* String representing input Bidi format
* @param outFormat
* String representing output Bidi format
* @return Boolean indicating whether the string needs Bidi processing
*/
private boolean isBidi( String txt, String inFormat, String outFormat )
{
if ( txt == null || txt.length( ) < 1 )
return false;
if ( !( new Bidi( txt, DIRECTION_RIGHT_TO_LEFT ) ).isLeftToRight( ) )
return true;
boolean inIsRTL = BidiConstants.TEXT_DIRECTION_RTL.equals( BidiFormat
.getTextDirectionFromStr( inFormat ) );
boolean outIsRTL = BidiConstants.TEXT_DIRECTION_RTL.equals( BidiFormat
.getTextDirectionFromStr( outFormat ) );
return inIsRTL != outIsRTL;
}
示例3: initialize
import com.ibm.icu.text.Bidi; //导入依赖的package包/类
public void initialize( ) throws BirtException
{
hasStyle = false;
boxStyle = BoxStyle.DEFAULT;
localProperties = LocalProperties.DEFAULT;
maxAvaWidth = parent.getCurrentMaxContentWidth( );
width = maxAvaWidth;
// Derive the baseLevel from the parent content direction.
if ( parent.content != null )
{
// IContent#isDirectionRTL already looks at computed style
if ( parent.content.isDirectionRTL( ) )
baseLevel = Bidi.DIRECTION_RIGHT_TO_LEFT;
}
//parent.add( this );
}
示例4: initialize
import com.ibm.icu.text.Bidi; //导入依赖的package包/类
protected void initialize( )
{
int currentIP = 0;
if(contextList.size()>0)
{
currentIP = contextList.get(contextList.size()-1).currentIP;
}
currentContext = new ContainerContext( );
currentContext.currentIP = currentIP;
contextList.add( currentContext );
createRoot( );
currentContext.maxAvaWidth = parent.getCurrentMaxContentWidth( );
currentContext.maxAvaHeight = parent.getCurrentMaxContentHeight( );
currentContext.root.setWidth( parent.getCurrentMaxContentWidth( ) );
lineHeight = ( (BlockStackingLayout) parent ).getLineHeight( );
// Derive the baseLevel from the parent content direction.
if ( parent.content != null )
{
if ( CSSConstants.CSS_RTL_VALUE.equals( parent.content
.getComputedStyle( ).getDirection( ) ) )
baseLevel = Bidi.DIRECTION_RIGHT_TO_LEFT;
}
}
示例5: bidiReorder
import com.ibm.icu.text.Bidi; //导入依赖的package包/类
/**
* Apply Unicode Bidirectional Algorithm to string and return a new possibly reordered string for visual rendering.
*/
private String bidiReorder(String p_147647_1_)
{
try
{
Bidi bidi = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127);
bidi.setReorderingMode(0);
return bidi.writeReordered(2);
}
catch (ArabicShapingException var3)
{
return p_147647_1_;
}
}
示例6: verifyValidParaOrLine
import com.ibm.icu.text.Bidi; //导入依赖的package包/类
void verifyValidParaOrLine()
{
Bidi para = this.paraBidi;
/* verify Para */
if (this == para) {
return;
}
/* verify Line */
if ((para == null) || (para != para.paraBidi)) {
throw new IllegalStateException();
}
}
示例7: bidiReorder
import com.ibm.icu.text.Bidi; //导入依赖的package包/类
/**
* Apply Unicode Bidirectional Algorithm to string and return a new possibly reordered string for visual rendering.
*/
private String bidiReorder(String p_147647_1_)
{
try
{
Bidi var3 = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127);
var3.setReorderingMode(0);
return var3.writeReordered(2);
}
catch (ArabicShapingException var31)
{
return p_147647_1_;
}
}
示例8: directionFromFlags
import com.ibm.icu.text.Bidi; //导入依赖的package包/类
private byte directionFromFlags() {
/* if the text contains AN and neutrals, then some neutrals may become RTL */
if (!((flags & MASK_RTL) != 0 ||
((flags & DirPropFlag(AN)) != 0 &&
(flags & MASK_POSSIBLE_N) != 0))) {
return Bidi.DIRECTION_LEFT_TO_RIGHT;
} else if ((flags & MASK_LTR) == 0) {
return Bidi.DIRECTION_RIGHT_TO_LEFT;
} else {
return MIXED;
}
}
示例9: requiresBidi
import com.ibm.icu.text.Bidi; //导入依赖的package包/类
/**
* Return true if the specified text requires bidi analysis. If this returns
* false, the text will display left-to-right. Clients can then avoid
* constructing a Bidi object. Text in the Arabic Presentation Forms area of
* Unicode is presumed to already be shaped and ordered for display, and so
* will not cause this method to return true.
*
* @param text the text containing the characters to test
* @param start the start of the range of characters to test
* @param limit the limit of the range of characters to test
*
* @return true if the range of characters requires bidi analysis
*
* @stable ICU 3.8
*/
public static boolean requiresBidi(char[] text,
int start,
int limit)
{
final int RTLMask = (1 << Bidi.DIRECTION_RIGHT_TO_LEFT |
1 << AL |
1 << RLE |
1 << RLO |
1 << AN);
if (0 > start || start > limit || limit > text.length) {
throw new IllegalArgumentException("Value start " + start +
" is out of range 0 to " + limit);
}
for (int i = start; i < limit; ++i) {
if (Character.isHighSurrogate(text[i]) && i < (limit-1) &&
Character.isLowSurrogate(text[i+1])) {
if (((1 << UCharacter.getDirection(Character.codePointAt(text, i))) & RTLMask) != 0) {
return true;
}
} else if (((1 << UCharacter.getDirection(text[i])) & RTLMask) != 0) {
return true;
}
}
return false;
}
示例10: bidiReorder
import com.ibm.icu.text.Bidi; //导入依赖的package包/类
/**
* Apply Unicode Bidirectional Algorithm to string and return a new possibly reordered string for visual rendering.
*/
private String bidiReorder(String text)
{
try
{
Bidi bidi = new Bidi((new ArabicShaping(8)).shape(text), 127);
bidi.setReorderingMode(0);
return bidi.writeReordered(2);
}
catch (ArabicShapingException var3)
{
return text;
}
}
示例11: bidiReorder
import com.ibm.icu.text.Bidi; //导入依赖的package包/类
protected String bidiReorder(String p_147647_1_)
{
try
{
Bidi bidi = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127);
bidi.setReorderingMode(0);
return bidi.writeReordered(2);
}
catch (ArabicShapingException arabicshapingexception)
{
return p_147647_1_;
}
}
示例12: func_147647_b
import com.ibm.icu.text.Bidi; //导入依赖的package包/类
private String func_147647_b(String p_147647_1_)
{
try
{
Bidi var3 = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127);
var3.setReorderingMode(0);
return var3.writeReordered(2);
}
catch (ArabicShapingException var31)
{
return p_147647_1_;
}
}
示例13: createControl
import com.ibm.icu.text.Bidi; //导入依赖的package包/类
@Override
protected void createControl(Composite parent, int styles) {
// Use LEFT_TO_RIGHT unless otherwise specified.
if ((styles & SWT.RIGHT_TO_LEFT) == 0 && (styles & SWT.LEFT_TO_RIGHT) == 0)
styles |= SWT.LEFT_TO_RIGHT;
final int baseLevel= (styles & SWT.RIGHT_TO_LEFT) != 0 ? Bidi.DIRECTION_RIGHT_TO_LEFT : Bidi.DIRECTION_LEFT_TO_RIGHT;
super.createControl(parent, styles);
fBackspaceManager= new SmartBackspaceManager();
fBackspaceManager.install(this);
StyledText text= getTextWidget();
text.addBidiSegmentListener(new BidiSegmentListener() {
public void lineGetSegments(BidiSegmentEvent event) {
if (redraws()) {
try {
event.segments= getBidiLineSegments(getDocument(), baseLevel, widgetOffset2ModelOffset(event.lineOffset), event.lineText);
} catch (BadLocationException e) {
// don't touch the segments
}
}
}
});
}
示例14: bidiReorder
import com.ibm.icu.text.Bidi; //导入依赖的package包/类
private String bidiReorder(String p_147647_1_)
{
try
{
Bidi bidi = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127);
bidi.setReorderingMode(0);
return bidi.writeReordered(2);
}
catch (ArabicShapingException arabicshapingexception)
{
return p_147647_1_;
}
}