本文整理汇总了Java中sun.font.TextLabelFactory.createExtended方法的典型用法代码示例。如果您正苦于以下问题:Java TextLabelFactory.createExtended方法的具体用法?Java TextLabelFactory.createExtended怎么用?Java TextLabelFactory.createExtended使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.font.TextLabelFactory
的用法示例。
在下文中一共展示了TextLabelFactory.createExtended方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createComponentsOnRun
import sun.font.TextLabelFactory; //导入方法依赖的package包/类
/**
* Returns an array in logical order of the TextLineComponents on
* the text in the given range, with the given attributes.
*/
public static TextLineComponent[] createComponentsOnRun(int runStart,
int runLimit,
char[] chars,
int[] charsLtoV,
byte[] levels,
TextLabelFactory factory,
Font font,
CoreMetrics cm,
FontRenderContext frc,
Decoration decorator,
TextLineComponent[] components,
int numComponents) {
int pos = runStart;
do {
int chunkLimit = firstVisualChunk(charsLtoV, levels, pos, runLimit); // <= displayLimit
do {
int startPos = pos;
int lmCount;
if (cm == null) {
LineMetrics lineMetrics = font.getLineMetrics(chars, startPos, chunkLimit, frc);
cm = CoreMetrics.get(lineMetrics);
lmCount = lineMetrics.getNumChars();
}
else {
lmCount = (chunkLimit-startPos);
}
TextLineComponent nextComponent =
factory.createExtended(font, cm, decorator, startPos, startPos + lmCount);
++numComponents;
if (numComponents >= components.length) {
components = expandArray(components);
}
components[numComponents-1] = nextComponent;
pos += lmCount;
} while (pos < chunkLimit);
} while (pos < runLimit);
return components;
}
示例2: createComponentsOnRun
import sun.font.TextLabelFactory; //导入方法依赖的package包/类
/**
* Returns an array in logical order of the TextLineComponents on
* the text in the given range, with the given attributes.
*/
public static TextLineComponent[] createComponentsOnRun(int runStart,
int runLimit,
char[] chars,
int[] charsLtoV,
byte[] levels,
TextLabelFactory factory,
Font font,
CoreMetrics cm,
FontRenderContext frc,
Decoration decorator,
TextLineComponent[] components,
int numComponents) {
int pos = runStart;
do {
int chunkLimit = firstVisualChunk(charsLtoV, levels, pos, runLimit); // <= displayLimit
do {
int startPos = pos;
int lmCount;
if (cm == null) {
LineMetrics lineMetrics = font.getLineMetrics(chars, startPos, chunkLimit, frc);
cm = CoreMetrics.get(lineMetrics);
lmCount = lineMetrics.getNumChars();
}
else {
lmCount = (chunkLimit-startPos);
}
TextLineComponent nextComponent =
factory.createExtended(font, cm, decorator, startPos, startPos + lmCount);
++numComponents;
if (numComponents >= components.length) {
components = expandArray(components);
}
components[numComponents-1] = nextComponent;
pos += lmCount;
} while (pos < chunkLimit);
} while (pos < runLimit);
return components;
}