本文整理汇总了Java中java.awt.font.GlyphVector.FLAG_RUN_RTL属性的典型用法代码示例。如果您正苦于以下问题:Java GlyphVector.FLAG_RUN_RTL属性的具体用法?Java GlyphVector.FLAG_RUN_RTL怎么用?Java GlyphVector.FLAG_RUN_RTL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.font.GlyphVector
的用法示例。
在下文中一共展示了GlyphVector.FLAG_RUN_RTL属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGlyphVector
public StandardGlyphVector createGlyphVector(Font font, FontRenderContext frc, StandardGlyphVector result) {
// !!! default initialization until we let layout engines do it
if (_flags == UNINITIALIZED_FLAGS) {
_flags = 0;
if (_count > 1) { // if only 1 glyph assume LTR
boolean ltr = true;
boolean rtl = true;
int rtlix = _count; // rtl index
for (int i = 0; i < _count && (ltr || rtl); ++i) {
int cx = _indices[i];
ltr = ltr && (cx == i);
rtl = rtl && (cx == --rtlix);
}
if (rtl) _flags |= GlyphVector.FLAG_RUN_RTL;
if (!rtl && !ltr) _flags |= GlyphVector.FLAG_COMPLEX_GLYPHS;
}
// !!! layout engines need to tell us whether they performed
// position adjustments. currently they don't tell us, so
// we must assume they did
_flags |= GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS;
}
int[] glyphs = new int[_count];
System.arraycopy(_glyphs, 0, glyphs, 0, _count);
float[] positions = null;
if ((_flags & GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS) != 0) {
positions = new float[_count * 2 + 2];
System.arraycopy(_positions, 0, positions, 0, positions.length);
}
int[] indices = null;
if ((_flags & GlyphVector.FLAG_COMPLEX_GLYPHS) != 0) {
indices = new int[_count];
System.arraycopy(_indices, 0, indices, 0, _count);
}
if (result == null) {
result = new StandardGlyphVector(font, frc, glyphs, positions, indices, _flags);
} else {
result.initGlyphVector(font, frc, glyphs, positions, indices, _flags);
}
return result;
}