本文整理汇总了Java中sun.text.CodePointIterator类的典型用法代码示例。如果您正苦于以下问题:Java CodePointIterator类的具体用法?Java CodePointIterator怎么用?Java CodePointIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CodePointIterator类属于sun.text包,在下文中一共展示了CodePointIterator类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getFontAtCurrentPos
import sun.text.CodePointIterator; //导入依赖的package包/类
static Font getFontAtCurrentPos(AttributedCharacterIterator aci) {
Object value = aci.getAttribute(TextAttribute.FONT);
if (value != null) {
return (Font) value;
}
if (aci.getAttribute(TextAttribute.FAMILY) != null) {
return Font.getFont(aci.getAttributes());
}
int ch = CodePointIterator.create(aci).next();
if (ch != CodePointIterator.DONE) {
FontResolver resolver = FontResolver.getInstance();
return resolver.getFont(resolver.getFontIndex(ch), aci.getAttributes());
}
return null;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:TextLine.java
示例2: nextFontRunIndex
import sun.text.CodePointIterator; //导入依赖的package包/类
/**
* Determines the font index for the code point at the current position in the
* iterator, then advances the iterator to the first code point that has
* a different index or until the iterator is DONE, and returns the font index.
* @param iter a code point iterator, this will be advanced past any code
* points that have the same font index
* @return the font index for the initial code point found, or 1 if the iterator
* was empty.
*/
public int nextFontRunIndex(CodePointIterator iter) {
int cp = iter.next();
int fontIndex = 1;
if (cp != CodePointIterator.DONE) {
fontIndex = getFontIndex(cp);
while ((cp = iter.next()) != CodePointIterator.DONE) {
if (getFontIndex(cp) != fontIndex) {
iter.prev();
break;
}
}
}
return fontIndex;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:FontResolver.java
示例3: getFontAtCurrentPos
import sun.text.CodePointIterator; //导入依赖的package包/类
static Font getFontAtCurrentPos(AttributedCharacterIterator aci) {
Object value = aci.getAttribute(TextAttribute.FONT);
if (value != null) {
return (Font) value;
}
if (aci.getAttribute(TextAttribute.FAMILY) != null) {
return Font.getFont(aci.getAttributes());
}
int ch = CodePointIterator.create(aci).next();
if (ch != CodePointIterator.DONE) {
FontResolver resolver = FontResolver.getInstance();
return resolver.getFont(resolver.getFontIndex(ch), aci.getAttributes());
}
return null;
}
开发者ID:jgaltidor,项目名称:VarJ,代码行数:18,代码来源:TextLine.java
示例4: addFonts
import sun.text.CodePointIterator; //导入依赖的package包/类
/**
* Resolve the given chars into Fonts using FontResolver, then add
* font runs for each.
*/
private void addFonts(char[] chars, Map<? extends Attribute, ?> attributes,
int start, int limit) {
FontResolver resolver = FontResolver.getInstance();
CodePointIterator iter = CodePointIterator.create(chars, start, limit);
for (int runStart = iter.charIndex(); runStart < limit; runStart = iter.charIndex()) {
int fontIndex = resolver.nextFontRunIndex(iter);
addFont(resolver.getFont(fontIndex, attributes), runStart);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:StyledParagraph.java
示例5: singleFont
import sun.text.CodePointIterator; //导入依赖的package包/类
private static Font singleFont(char[] text,
int start,
int limit,
Map<? extends Attribute, ?> attributes) {
if (attributes.get(TextAttribute.CHAR_REPLACEMENT) != null) {
return null;
}
Font font = null;
try {
font = (Font)attributes.get(TextAttribute.FONT);
}
catch (ClassCastException e) {
}
if (font == null) {
if (attributes.get(TextAttribute.FAMILY) != null) {
font = Font.getFont(attributes);
if (font.canDisplayUpTo(text, start, limit) != -1) {
return null;
}
} else {
FontResolver resolver = FontResolver.getInstance();
CodePointIterator iter = CodePointIterator.create(text, start, limit);
int fontIndex = resolver.nextFontRunIndex(iter);
if (iter.charIndex() == limit) {
font = resolver.getFont(fontIndex, attributes);
}
}
}
if (sameBaselineUpTo(font, text, start, limit) != limit) {
return null;
}
return font;
}
开发者ID:Java8-CNAPI-Team,项目名称:Java8CN,代码行数:38,代码来源:TextLayout.java
示例6: singleFont
import sun.text.CodePointIterator; //导入依赖的package包/类
private static Font singleFont(char[] text,
int start,
int limit,
Map attributes) {
if (attributes.get(TextAttribute.CHAR_REPLACEMENT) != null) {
return null;
}
Font font = null;
try {
font = (Font)attributes.get(TextAttribute.FONT);
}
catch (ClassCastException e) {
}
if (font == null) {
if (attributes.get(TextAttribute.FAMILY) != null) {
font = Font.getFont(attributes);
if (font.canDisplayUpTo(text, start, limit) != -1) {
return null;
}
} else {
FontResolver resolver = FontResolver.getInstance();
CodePointIterator iter = CodePointIterator.create(text, start, limit);
int fontIndex = resolver.nextFontRunIndex(iter);
if (iter.charIndex() == limit) {
font = resolver.getFont(fontIndex, attributes);
}
}
}
if (sameBaselineUpTo(font, text, start, limit) != limit) {
return null;
}
return font;
}
开发者ID:jgaltidor,项目名称:VarJ,代码行数:38,代码来源:TextLayout.java
示例7: addFonts
import sun.text.CodePointIterator; //导入依赖的package包/类
/**
* Resolve the given chars into Fonts using FontResolver, then add
* font runs for each.
*/
private void addFonts(char[] chars, Map attributes, int start, int limit) {
FontResolver resolver = FontResolver.getInstance();
CodePointIterator iter = CodePointIterator.create(chars, start, limit);
for (int runStart = iter.charIndex(); runStart < limit; runStart = iter.charIndex()) {
int fontIndex = resolver.nextFontRunIndex(iter);
addFont(resolver.getFont(fontIndex, attributes), runStart);
}
}
开发者ID:jgaltidor,项目名称:VarJ,代码行数:14,代码来源:StyledParagraph.java
示例8: requiresBidi
import sun.text.CodePointIterator; //导入依赖的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 function 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
*/
public static boolean requiresBidi(char[] text, int start, int limit) {
CodePointIterator cpi = CodePointIterator.create(text, start, limit);
for (int cp = cpi.next(); cp != CodePointIterator.DONE; cp = cpi.next()) {
if (cp > 0x0590) {
int dc = nativeGetDirectionCode(cp);
if ((RMASK & (1 << dc)) != 0) {
return true;
}
}
}
return false;
}
开发者ID:jgaltidor,项目名称:VarJ,代码行数:24,代码来源:Bidi.java
示例9: singleFont
import sun.text.CodePointIterator; //导入依赖的package包/类
private static Font singleFont(char[] text,
int start,
int limit,
Map attributes) {
if (attributes.get(TextAttribute.CHAR_REPLACEMENT) != null) {
return null;
}
Font font = null;
try {
font = (Font)attributes.get(TextAttribute.FONT);
}
catch (ClassCastException e) {
}
if (font == null) {
if (attributes.get(TextAttribute.FAMILY) != null) {
font = Font.getFont(attributes);
if (font.canDisplayUpTo(text, start, limit) != -1) {
return null;
}
} else {
FontResolver resolver = FontResolver.getInstance();
CodePointIterator iter = CodePointIterator.create(text, start, limit);
int fontIndex = resolver.nextFontRunIndex(iter);
if (iter.charIndex() == limit) {
font = resolver.getFont(fontIndex, attributes);
}
}
}
if (sameBaselineUpTo(font, text, start, limit) != limit) {
return null;
}
return font;
}
开发者ID:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:38,代码来源:TextLayout.java
示例10: addFonts
import sun.text.CodePointIterator; //导入依赖的package包/类
/**
* Resolve the given chars into Fonts using FontResolver, then add
* font runs for each.
*/
private void addFonts(char[] chars, Map attributes, int start, int limit) {
FontResolver resolver = FontResolver.getInstance();
CodePointIterator iter = CodePointIterator.create(chars, start, limit);
for (int runStart = iter.charIndex(); runStart < limit; runStart = iter.charIndex()) {
int fontIndex = resolver.nextFontRunIndex(iter);
addFont(resolver.getFont(fontIndex, attributes), runStart);
}
}
开发者ID:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:14,代码来源:StyledParagraph.java
注:本文中的sun.text.CodePointIterator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论