本文整理汇总了Java中sun.text.CodePointIterator.charIndex方法的典型用法代码示例。如果您正苦于以下问题:Java CodePointIterator.charIndex方法的具体用法?Java CodePointIterator.charIndex怎么用?Java CodePointIterator.charIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.text.CodePointIterator
的用法示例。
在下文中一共展示了CodePointIterator.charIndex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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;
}
示例3: 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;
}
示例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 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);
}
}
示例5: 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;
}
示例6: 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);
}
}