本文整理汇总了Java中sun.font.CoreMetrics类的典型用法代码示例。如果您正苦于以下问题:Java CoreMetrics类的具体用法?Java CoreMetrics怎么用?Java CoreMetrics使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CoreMetrics类属于sun.font包,在下文中一共展示了CoreMetrics类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paragraphInit
import sun.font.CoreMetrics; //导入依赖的package包/类
/**
* Initialize the paragraph-specific data.
*/
private void paragraphInit(byte aBaseline, CoreMetrics lm,
Map<? extends Attribute, ?> paragraphAttrs,
char[] text) {
baseline = aBaseline;
// normalize to current baseline
baselineOffsets = TextLine.getNormalizedOffsets(lm.baselineOffsets, baseline);
justifyRatio = AttributeValues.getJustification(paragraphAttrs);
NumericShaper shaper = AttributeValues.getNumericShaping(paragraphAttrs);
if (shaper != null) {
shaper.shape(text, 0, text.length);
}
}
示例2: fastInit
import sun.font.CoreMetrics; //导入依赖的package包/类
private void fastInit(char[] chars, Font font,
Map<? extends Attribute, ?> attrs,
FontRenderContext frc) {
// Object vf = attrs.get(TextAttribute.ORIENTATION);
// isVerticalLine = TextAttribute.ORIENTATION_VERTICAL.equals(vf);
isVerticalLine = false;
LineMetrics lm = font.getLineMetrics(chars, 0, chars.length, frc);
CoreMetrics cm = CoreMetrics.get(lm);
byte glyphBaseline = (byte) cm.baselineIndex;
if (attrs == null) {
baseline = glyphBaseline;
baselineOffsets = cm.baselineOffsets;
justifyRatio = 1.0f;
} else {
paragraphInit(glyphBaseline, cm, attrs, chars);
}
characterCount = chars.length;
textLine = TextLine.fastCreateTextLine(frc, chars, font, cm, attrs);
}
示例3: getCoreMetricsAt
import sun.font.CoreMetrics; //导入依赖的package包/类
public CoreMetrics getCoreMetricsAt(int logicalIndex) {
if (logicalIndex < 0) {
throw new IllegalArgumentException("Negative logicalIndex.");
}
if (logicalIndex > fCharsLimit - fCharsStart) {
throw new IllegalArgumentException("logicalIndex too large.");
}
int currentTlc = 0;
int tlcStart = 0;
int tlcLimit = 0;
do {
tlcLimit += fComponents[currentTlc].getNumCharacters();
if (tlcLimit > logicalIndex) {
break;
}
++currentTlc;
tlcStart = tlcLimit;
} while(currentTlc < fComponents.length);
return fComponents[currentTlc].getCoreMetrics();
}
示例4: fastInit
import sun.font.CoreMetrics; //导入依赖的package包/类
private void fastInit(char[] chars, Font font, Map attrs, FontRenderContext frc) {
// Object vf = attrs.get(TextAttribute.ORIENTATION);
// isVerticalLine = TextAttribute.ORIENTATION_VERTICAL.equals(vf);
isVerticalLine = false;
LineMetrics lm = font.getLineMetrics(chars, 0, chars.length, frc);
CoreMetrics cm = CoreMetrics.get(lm);
byte glyphBaseline = (byte) cm.baselineIndex;
if (attrs == null) {
baseline = glyphBaseline;
baselineOffsets = cm.baselineOffsets;
justifyRatio = 1.0f;
} else {
paragraphInit(glyphBaseline, cm, attrs, chars);
}
characterCount = chars.length;
textLine = TextLine.fastCreateTextLine(frc, chars, font, cm, attrs);
}