Java 类sun.font.TextLineComponent 实例源码

项目:OpenJSharp    文件:TextMeasurer.java   
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);

    }
项目:OpenJSharp    文件:TextLine.java   
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);
    }
项目:OpenJSharp    文件:TextLine.java   
/**
 * 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);
}
项目:OpenJSharp    文件:TextLine.java   
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;
}
项目:jdk8u-jdk    文件:TextMeasurer.java   
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);

    }
项目:jdk8u-jdk    文件:TextLine.java   
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);
    }
项目:jdk8u-jdk    文件:TextLine.java   
/**
 * 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);
}
项目:jdk8u-jdk    文件:TextLine.java   
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;
}
项目:openjdk-jdk10    文件:TextMeasurer.java   
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);

    }
项目:openjdk-jdk10    文件:TextLine.java   
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);
    }
项目:openjdk-jdk10    文件:TextLine.java   
/**
 * 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);
}
项目:openjdk-jdk10    文件:TextLine.java   
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;
}
项目:openjdk9    文件:TextMeasurer.java   
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);

    }
项目:openjdk9    文件:TextLine.java   
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);
    }
项目:openjdk9    文件:TextLine.java   
/**
 * 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);
}
项目:openjdk9    文件:TextLine.java   
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;
}
项目:Java8CN    文件:TextMeasurer.java   
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);

    }
项目:Java8CN    文件:TextLine.java   
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);
    }
项目:Java8CN    文件:TextLine.java   
/**
 * 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);
}
项目:Java8CN    文件:TextLine.java   
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;
}
项目:jdk8u_jdk    文件:TextMeasurer.java   
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);

    }
项目:jdk8u_jdk    文件:TextLine.java   
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);
    }
项目:jdk8u_jdk    文件:TextLine.java   
/**
 * 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);
}
项目:jdk8u_jdk    文件:TextLine.java   
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;
}
项目:lookaside_java-1.8.0-openjdk    文件:TextMeasurer.java   
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);

    }
项目:lookaside_java-1.8.0-openjdk    文件:TextLine.java   
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);
    }
项目:lookaside_java-1.8.0-openjdk    文件:TextLine.java   
/**
 * 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);
}
项目:lookaside_java-1.8.0-openjdk    文件:TextLine.java   
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;
}
项目:VarJ    文件:TextMeasurer.java   
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);

    }
项目:VarJ    文件:TextLine.java   
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);
}
项目:VarJ    文件:TextLine.java   
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;
    }
项目:VarJ    文件:TextLine.java   
/**
 * 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);
}
项目:VarJ    文件:TextLine.java   
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;
}
项目:jdk-1.7-annotated    文件:TextMeasurer.java   
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);

    }
项目:jdk-1.7-annotated    文件:TextLine.java   
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);
    }
项目:jdk-1.7-annotated    文件:TextLine.java   
/**
 * 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);
}
项目:jdk-1.7-annotated    文件:TextLine.java   
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;
}
项目:infobip-open-jdk-8    文件:TextMeasurer.java   
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);

    }
项目:infobip-open-jdk-8    文件:TextLine.java   
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);
    }
项目:infobip-open-jdk-8    文件:TextLine.java   
/**
 * 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);
}