Java 类sun.font.GraphicComponent 实例源码

项目:OpenJSharp    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:jdk8u-jdk    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:openjdk-jdk10    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:openjdk9    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:Java8CN    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:jdk8u_jdk    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:lookaside_java-1.8.0-openjdk    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:VarJ    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:jdk-1.7-annotated    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:infobip-open-jdk-8    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:jdk8u-dev-jdk    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:jdk7-jdk    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:openjdk-source-code-learn    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:OLD-OpenJDK8    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:openjdk-jdk7u-jdk    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}
项目:openjdk-icedtea7    文件:TextLine.java   
/**
 * Returns an array (in logical order) of the TextLineComponents representing
 * the text.  The components are both logically and visually contiguous.
 */
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
                                                char[] chars,
                                                int textStart,
                                                int textLimit,
                                                int[] charsLtoV,
                                                byte[] levels,
                                                TextLabelFactory factory) {

    FontRenderContext frc = factory.getFontRenderContext();

    int numComponents = 0;
    TextLineComponent[] tempComponents = new TextLineComponent[1];

    int pos = textStart;
    do {
        int runLimit = Math.min(styledParagraph.getRunLimit(pos), textLimit);

        Decoration decorator = styledParagraph.getDecorationAt(pos);

        Object graphicOrFont = styledParagraph.getFontOrGraphicAt(pos);

        if (graphicOrFont instanceof GraphicAttribute) {
            // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos);
            // !!! For now, let's assign runs of text with both fonts and graphic attributes
            // a null rotation (e.g. the baseline rotation goes away when a graphic
            // is applied.
            AffineTransform baseRot = null;
            GraphicAttribute graphicAttribute = (GraphicAttribute) graphicOrFont;
            do {
                int chunkLimit = firstVisualChunk(charsLtoV, levels,
                                pos, runLimit);

                GraphicComponent nextGraphic =
                    new GraphicComponent(graphicAttribute, decorator, charsLtoV, levels, pos, chunkLimit, baseRot);
                pos = chunkLimit;

                ++numComponents;
                if (numComponents >= tempComponents.length) {
                    tempComponents = expandArray(tempComponents);
                }

                tempComponents[numComponents-1] = nextGraphic;

            } while(pos < runLimit);
        }
        else {
            Font font = (Font) graphicOrFont;

            tempComponents = createComponentsOnRun(pos, runLimit,
                                                    chars,
                                                    charsLtoV, levels,
                                                    factory, font, null,
                                                    frc,
                                                    decorator,
                                                    tempComponents,
                                                    numComponents);
            pos = runLimit;
            numComponents = tempComponents.length;
            while (tempComponents[numComponents-1] == null) {
                numComponents -= 1;
            }
        }

    } while (pos < textLimit);

    TextLineComponent[] components;
    if (tempComponents.length == numComponents) {
        components = tempComponents;
    }
    else {
        components = new TextLineComponent[numComponents];
        System.arraycopy(tempComponents, 0, components, 0, numComponents);
    }

    return components;
}