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


Java TextLineComponent类代码示例

本文整理汇总了Java中sun.font.TextLineComponent的典型用法代码示例。如果您正苦于以下问题:Java TextLineComponent类的具体用法?Java TextLineComponent怎么用?Java TextLineComponent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TextLineComponent类属于sun.font包,在下文中一共展示了TextLineComponent类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeTextLineOnRange

import sun.font.TextLineComponent; //导入依赖的package包/类
private TextLine makeTextLineOnRange(int startPos, int limitPos) {

        int[] charsLtoV = null;
        byte[] charLevels = null;

        if (fBidi != null) {
            Bidi lineBidi = fBidi.createLineBidi(startPos, limitPos);
            charLevels = BidiUtils.getLevels(lineBidi);
            int[] charsVtoL = BidiUtils.createVisualToLogicalMap(charLevels);
            charsLtoV = BidiUtils.createInverseMap(charsVtoL);
        }

        TextLineComponent[] components = makeComponentsOnRange(startPos, limitPos);

        return new TextLine(fFrc,
                            components,
                            fBaselineOffsets,
                            fChars,
                            startPos,
                            limitPos,
                            charsLtoV,
                            charLevels,
                            fIsDirectionLTR);

    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:TextMeasurer.java

示例2: getItalicBounds

import sun.font.TextLineComponent; //导入依赖的package包/类
public Rectangle2D getItalicBounds() {

        float left = Float.MAX_VALUE, right = -Float.MAX_VALUE;
        float top = Float.MAX_VALUE, bottom = -Float.MAX_VALUE;

        for (int i=0, n = 0; i < fComponents.length; i++, n += 2) {
            TextLineComponent tlc = fComponents[getComponentLogicalIndex(i)];

            Rectangle2D tlcBounds = tlc.getItalicBounds();
            float x = locs[n];
            float y = locs[n+1];

            left = Math.min(left, x + (float)tlcBounds.getX());
            right = Math.max(right, x + (float)tlcBounds.getMaxX());

            top = Math.min(top, y + (float)tlcBounds.getY());
            bottom = Math.max(bottom, y + (float)tlcBounds.getMaxY());
        }

        return new Rectangle2D.Float(left, top, right-left, bottom-top);
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:TextLine.java

示例3: createLineFromText

import sun.font.TextLineComponent; //导入依赖的package包/类
/**
 * Create a TextLine from the Font and character data over the
 * range.  The range is relative to both the StyledParagraph and the
 * character array.
 */
public static TextLine createLineFromText(char[] chars,
                                          StyledParagraph styledParagraph,
                                          TextLabelFactory factory,
                                          boolean isDirectionLTR,
                                          float[] baselineOffsets) {

    factory.setLineContext(0, chars.length);

    Bidi lineBidi = factory.getLineBidi();
    int[] charsLtoV = null;
    byte[] levels = null;

    if (lineBidi != null) {
        levels = BidiUtils.getLevels(lineBidi);
        int[] charsVtoL = BidiUtils.createVisualToLogicalMap(levels);
        charsLtoV = BidiUtils.createInverseMap(charsVtoL);
    }

    TextLineComponent[] components =
        getComponents(styledParagraph, chars, 0, chars.length, charsLtoV, levels, factory);

    return new TextLine(factory.getFontRenderContext(), components, baselineOffsets,
                        chars, 0, chars.length, charsLtoV, levels, isDirectionLTR);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:TextLine.java

示例4: getAdvanceBetween

import sun.font.TextLineComponent; //导入依赖的package包/类
public static float getAdvanceBetween(TextLineComponent[] components, int start, int limit) {
    float advance = 0;

    int tlcStart = 0;
    for(int i = 0; i < components.length; i++) {
        TextLineComponent comp = components[i];

        int tlcLength = comp.getNumCharacters();
        int tlcLimit = tlcStart + tlcLength;
        if (tlcLimit > start) {
            int measureStart = Math.max(0, start - tlcStart);
            int measureLimit = Math.min(tlcLength, limit - tlcStart);
            advance += comp.getAdvanceBetween(measureStart, measureLimit);
            if (tlcLimit >= limit) {
                break;
            }
        }

        tlcStart = tlcLimit;
    }

    return advance;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:TextLine.java

示例5: makeTextLineOnRange

import sun.font.TextLineComponent; //导入依赖的package包/类
private TextLine makeTextLineOnRange(int startPos, int limitPos) {

        int[] charsLtoV = null;
        byte[] charLevels = null;

        if (fBidi != null) {
            Bidi lineBidi = fBidi.createLineBidi(startPos, limitPos);
            charLevels = BidiUtils.getLevels(lineBidi);
            int[] charsVtoL = BidiUtils.createVisualToLogicalMap(charLevels);
            charsLtoV = BidiUtils.createInverseMap(charsVtoL);
        }

        TextLineComponent[] components = makeComponentsOnRange(startPos, limitPos);

        return new TextLine(fFrc, 
                            components, 
                            fBaselineOffsets,
                            fChars,
                            startPos,
                            limitPos,
                            charsLtoV,
                            charLevels,
                            fIsDirectionLTR);

    }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:26,代码来源:TextMeasurer.java

示例6: getItalicBounds

import sun.font.TextLineComponent; //导入依赖的package包/类
public Rectangle2D getItalicBounds() {
    
    float left = Float.MAX_VALUE, right = -Float.MAX_VALUE;
    float top = Float.MAX_VALUE, bottom = -Float.MAX_VALUE;

    for (int i=0, n = 0; i < fComponents.length; i++, n += 2) {
        int vi = fComponentVisualOrder==null? i : fComponentVisualOrder[i];
        TextLineComponent tlc = fComponents[vi];

        Rectangle2D tlcBounds = tlc.getItalicBounds();
        float x = locs[n];
        float y = locs[n+1];

        left = Math.min(left, x + (float)tlcBounds.getX());
        right = Math.max(right, x + (float)tlcBounds.getMaxX());

        top = Math.min(top, y + (float)tlcBounds.getY());
        bottom = Math.max(bottom, y + (float)tlcBounds.getMaxY());
    }

    return new Rectangle2D.Float(left, top, right-left, bottom-top);
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:23,代码来源:TextLine.java

示例7: getOutline

import sun.font.TextLineComponent; //导入依赖的package包/类
public Shape getOutline(AffineTransform tx) {

        GeneralPath dstShape = new GeneralPath(GeneralPath.WIND_NON_ZERO);

        for (int i=0, n = 0; i < fComponents.length; i++, n += 2) {
            int vi = fComponentVisualOrder==null? i : fComponentVisualOrder[i];
            TextLineComponent tlc = fComponents[vi];

            dstShape.append(tlc.getOutline(locs[n], locs[n+1]), false);
        }

        if (tx != null) {
            dstShape.transform(tx);
        }
        return dstShape;
    }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:17,代码来源:TextLine.java


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