当前位置: 首页>>代码示例>>Java>>正文


Java CoreMetrics类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:TextLayout.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:TextLayout.java

示例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();
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:TextLine.java

示例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);
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:22,代码来源:TextLayout.java


注:本文中的sun.font.CoreMetrics类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。