Java 类java.awt.font.GraphicAttribute 实例源码

项目:OpenJSharp    文件:GraphicComponent.java   
/**
 * Create a new GraphicComponent.  start and limit are indices
 * into charLtoV and levels.  charsLtoV and levels may be adopted.
 */
public GraphicComponent(GraphicAttribute graphic,
                        Decoration decorator,
                        int[] charsLtoV,
                        byte[] levels,
                        int start,
                        int limit,
                        AffineTransform baseTx) {

    if (limit <= start) {
        throw new IllegalArgumentException("0 or negative length in GraphicComponent");
    }
    this.graphic = graphic;
    this.graphicAdvance = graphic.getAdvance();
    this.decorator = decorator;
    this.cm = createCoreMetrics(graphic);
    this.baseTx = baseTx;

    initLocalOrdering(charsLtoV, levels, start, limit);
}
项目:jdk8u-jdk    文件:GraphicComponent.java   
/**
 * Create a new GraphicComponent.  start and limit are indices
 * into charLtoV and levels.  charsLtoV and levels may be adopted.
 */
public GraphicComponent(GraphicAttribute graphic,
                        Decoration decorator,
                        int[] charsLtoV,
                        byte[] levels,
                        int start,
                        int limit,
                        AffineTransform baseTx) {

    if (limit <= start) {
        throw new IllegalArgumentException("0 or negative length in GraphicComponent");
    }
    this.graphic = graphic;
    this.graphicAdvance = graphic.getAdvance();
    this.decorator = decorator;
    this.cm = createCoreMetrics(graphic);
    this.baseTx = baseTx;

    initLocalOrdering(charsLtoV, levels, start, limit);
}
项目:openjdk-jdk10    文件:GraphicComponent.java   
/**
 * Create a new GraphicComponent.  start and limit are indices
 * into charLtoV and levels.  charsLtoV and levels may be adopted.
 */
public GraphicComponent(GraphicAttribute graphic,
                        Decoration decorator,
                        int[] charsLtoV,
                        byte[] levels,
                        int start,
                        int limit,
                        AffineTransform baseTx) {

    if (limit <= start) {
        throw new IllegalArgumentException("0 or negative length in GraphicComponent");
    }
    this.graphic = graphic;
    this.graphicAdvance = graphic.getAdvance();
    this.decorator = decorator;
    this.cm = createCoreMetrics(graphic);
    this.baseTx = baseTx;

    initLocalOrdering(charsLtoV, levels, start, limit);
}
项目:openjdk9    文件:GraphicComponent.java   
/**
 * Create a new GraphicComponent.  start and limit are indices
 * into charLtoV and levels.  charsLtoV and levels may be adopted.
 */
public GraphicComponent(GraphicAttribute graphic,
                        Decoration decorator,
                        int[] charsLtoV,
                        byte[] levels,
                        int start,
                        int limit,
                        AffineTransform baseTx) {

    if (limit <= start) {
        throw new IllegalArgumentException("0 or negative length in GraphicComponent");
    }
    this.graphic = graphic;
    this.graphicAdvance = graphic.getAdvance();
    this.decorator = decorator;
    this.cm = createCoreMetrics(graphic);
    this.baseTx = baseTx;

    initLocalOrdering(charsLtoV, levels, start, limit);
}
项目:jdk8u_jdk    文件:GraphicComponent.java   
/**
 * Create a new GraphicComponent.  start and limit are indices
 * into charLtoV and levels.  charsLtoV and levels may be adopted.
 */
public GraphicComponent(GraphicAttribute graphic,
                        Decoration decorator,
                        int[] charsLtoV,
                        byte[] levels,
                        int start,
                        int limit,
                        AffineTransform baseTx) {

    if (limit <= start) {
        throw new IllegalArgumentException("0 or negative length in GraphicComponent");
    }
    this.graphic = graphic;
    this.graphicAdvance = graphic.getAdvance();
    this.decorator = decorator;
    this.cm = createCoreMetrics(graphic);
    this.baseTx = baseTx;

    initLocalOrdering(charsLtoV, levels, start, limit);
}
项目:lookaside_java-1.8.0-openjdk    文件:GraphicComponent.java   
/**
 * Create a new GraphicComponent.  start and limit are indices
 * into charLtoV and levels.  charsLtoV and levels may be adopted.
 */
public GraphicComponent(GraphicAttribute graphic,
                        Decoration decorator,
                        int[] charsLtoV,
                        byte[] levels,
                        int start,
                        int limit,
                        AffineTransform baseTx) {

    if (limit <= start) {
        throw new IllegalArgumentException("0 or negative length in GraphicComponent");
    }
    this.graphic = graphic;
    this.graphicAdvance = graphic.getAdvance();
    this.decorator = decorator;
    this.cm = createCoreMetrics(graphic);
    this.baseTx = baseTx;

    initLocalOrdering(charsLtoV, levels, start, limit);
}
项目:infobip-open-jdk-8    文件:GraphicComponent.java   
/**
 * Create a new GraphicComponent.  start and limit are indices
 * into charLtoV and levels.  charsLtoV and levels may be adopted.
 */
public GraphicComponent(GraphicAttribute graphic,
                        Decoration decorator,
                        int[] charsLtoV,
                        byte[] levels,
                        int start,
                        int limit,
                        AffineTransform baseTx) {

    if (limit <= start) {
        throw new IllegalArgumentException("0 or negative length in GraphicComponent");
    }
    this.graphic = graphic;
    this.graphicAdvance = graphic.getAdvance();
    this.decorator = decorator;
    this.cm = createCoreMetrics(graphic);
    this.baseTx = baseTx;

    initLocalOrdering(charsLtoV, levels, start, limit);
}
项目:jdk8u-dev-jdk    文件:GraphicComponent.java   
/**
 * Create a new GraphicComponent.  start and limit are indices
 * into charLtoV and levels.  charsLtoV and levels may be adopted.
 */
public GraphicComponent(GraphicAttribute graphic,
                        Decoration decorator,
                        int[] charsLtoV,
                        byte[] levels,
                        int start,
                        int limit,
                        AffineTransform baseTx) {

    if (limit <= start) {
        throw new IllegalArgumentException("0 or negative length in GraphicComponent");
    }
    this.graphic = graphic;
    this.graphicAdvance = graphic.getAdvance();
    this.decorator = decorator;
    this.cm = createCoreMetrics(graphic);
    this.baseTx = baseTx;

    initLocalOrdering(charsLtoV, levels, start, limit);
}
项目:jdk7-jdk    文件:GraphicComponent.java   
/**
 * Create a new GraphicComponent.  start and limit are indices
 * into charLtoV and levels.  charsLtoV and levels may be adopted.
 */
public GraphicComponent(GraphicAttribute graphic,
                        Decoration decorator,
                        int[] charsLtoV,
                        byte[] levels,
                        int start,
                        int limit,
                        AffineTransform baseTx) {

    if (limit <= start) {
        throw new IllegalArgumentException("0 or negative length in GraphicComponent");
    }
    this.graphic = graphic;
    this.graphicAdvance = graphic.getAdvance();
    this.decorator = decorator;
    this.cm = createCoreMetrics(graphic);
    this.baseTx = baseTx;

    initLocalOrdering(charsLtoV, levels, start, limit);
}
项目:openjdk-source-code-learn    文件:GraphicComponent.java   
/**
 * Create a new GraphicComponent.  start and limit are indices
 * into charLtoV and levels.  charsLtoV and levels may be adopted.
 */
public GraphicComponent(GraphicAttribute graphic,
                        Decoration decorator,
                        int[] charsLtoV,
                        byte[] levels,
                        int start,
                        int limit,
                        AffineTransform baseTx) {

    if (limit <= start) {
        throw new IllegalArgumentException("0 or negative length in GraphicComponent");
    }
    this.graphic = graphic;
    this.graphicAdvance = graphic.getAdvance();
    this.decorator = decorator;
    this.cm = createCoreMetrics(graphic);
    this.baseTx = baseTx;

    initLocalOrdering(charsLtoV, levels, start, limit);
}
项目:OLD-OpenJDK8    文件:GraphicComponent.java   
/**
 * Create a new GraphicComponent.  start and limit are indices
 * into charLtoV and levels.  charsLtoV and levels may be adopted.
 */
public GraphicComponent(GraphicAttribute graphic,
                        Decoration decorator,
                        int[] charsLtoV,
                        byte[] levels,
                        int start,
                        int limit,
                        AffineTransform baseTx) {

    if (limit <= start) {
        throw new IllegalArgumentException("0 or negative length in GraphicComponent");
    }
    this.graphic = graphic;
    this.graphicAdvance = graphic.getAdvance();
    this.decorator = decorator;
    this.cm = createCoreMetrics(graphic);
    this.baseTx = baseTx;

    initLocalOrdering(charsLtoV, levels, start, limit);
}
项目:cn1    文件:BasicMetrics.java   
/**
 * Constructs BasicMetrics from GraphicAttribute.
 * It gets ascent and descent from the graphic attribute and
 * computes reasonable defaults for other metrics.
 * @param ga - graphic attribute
 */
BasicMetrics(GraphicAttribute ga) {
    ascent = ga.getAscent();
    descent = ga.getDescent();
    leading = 2;

    baseLineIndex = ga.getAlignment();

    italicAngle = 0;
    superScriptOffset = 0;

    underlineOffset = Math.max(descent/2, 1);

    // Just suggested, should be cap_stem_width or something like that
    underlineThickness = Math.max(ascent/13, 1);

    strikethroughOffset = -ascent/2; // Something like middle of the line
    strikethroughThickness = underlineThickness;
}
项目:magarena    文件:OracleText.java   
public static AttributedString textIconReplace(final String text) {
    final String compacted = text.replaceAll("\\{[^}]+}", "M");
    final AttributedString attrString = new AttributedString(compacted);
    for (int i = 0, j = 0; i < text.length(); i++, j++) {
        char c = text.charAt(i);
        if (c == '{') {
            final int endSymbol = text.indexOf('}', i);
            // get mana-string, substring returns at -1 value
            String iconString = text.substring(i, endSymbol + 1);
            // get related Icon as Image
            Image iconImage = MagicImages.getIcon(iconString).getImage();
            // define replacement icon
            ImageGraphicAttribute icon = new ImageGraphicAttribute(iconImage, GraphicAttribute.BOTTOM_ALIGNMENT);
            // replace M with icon
            attrString.addAttribute(
                TextAttribute.CHAR_REPLACEMENT,
                icon,
                j,
                j + 1
            );
            // advance i to the end of symbol
            i = endSymbol;
        }
    }
    return attrString;
}
项目:openjdk-jdk7u-jdk    文件:GraphicComponent.java   
/**
 * Create a new GraphicComponent.  start and limit are indices
 * into charLtoV and levels.  charsLtoV and levels may be adopted.
 */
public GraphicComponent(GraphicAttribute graphic,
                        Decoration decorator,
                        int[] charsLtoV,
                        byte[] levels,
                        int start,
                        int limit,
                        AffineTransform baseTx) {

    if (limit <= start) {
        throw new IllegalArgumentException("0 or negative length in GraphicComponent");
    }
    this.graphic = graphic;
    this.graphicAdvance = graphic.getAdvance();
    this.decorator = decorator;
    this.cm = createCoreMetrics(graphic);
    this.baseTx = baseTx;

    initLocalOrdering(charsLtoV, levels, start, limit);
}
项目:freeVM    文件:BasicMetrics.java   
/**
 * Constructs BasicMetrics from GraphicAttribute.
 * It gets ascent and descent from the graphic attribute and
 * computes reasonable defaults for other metrics.
 * @param ga - graphic attribute
 */
BasicMetrics(GraphicAttribute ga) {
    ascent = ga.getAscent();
    descent = ga.getDescent();
    leading = 2;

    baseLineIndex = ga.getAlignment();

    italicAngle = 0;
    superScriptOffset = 0;

    underlineOffset = Math.max(descent/2, 1);

    // Just suggested, should be cap_stem_width or something like that
    underlineThickness = Math.max(ascent/13, 1);

    strikethroughOffset = -ascent/2; // Something like middle of the line
    strikethroughThickness = underlineThickness;
}
项目:freeVM    文件:BasicMetrics.java   
/**
 * Constructs BasicMetrics from GraphicAttribute.
 * It gets ascent and descent from the graphic attribute and
 * computes reasonable defaults for other metrics.
 * @param ga - graphic attribute
 */
BasicMetrics(GraphicAttribute ga) {
    ascent = ga.getAscent();
    descent = ga.getDescent();
    leading = 2;

    baseLineIndex = ga.getAlignment();

    italicAngle = 0;
    superScriptOffset = 0;

    underlineOffset = Math.max(descent/2, 1);

    // Just suggested, should be cap_stem_width or something like that
    underlineThickness = Math.max(ascent/13, 1);

    strikethroughOffset = -ascent/2; // Something like middle of the line
    strikethroughThickness = underlineThickness;
}
项目:openjdk-icedtea7    文件:GraphicComponent.java   
/**
 * Create a new GraphicComponent.  start and limit are indices
 * into charLtoV and levels.  charsLtoV and levels may be adopted.
 */
public GraphicComponent(GraphicAttribute graphic,
                        Decoration decorator,
                        int[] charsLtoV,
                        byte[] levels,
                        int start,
                        int limit,
                        AffineTransform baseTx) {

    if (limit <= start) {
        throw new IllegalArgumentException("0 or negative length in GraphicComponent");
    }
    this.graphic = graphic;
    this.graphicAdvance = graphic.getAdvance();
    this.decorator = decorator;
    this.cm = createCoreMetrics(graphic);
    this.baseTx = baseTx;

    initLocalOrdering(charsLtoV, levels, start, limit);
}
项目:OpenJSharp    文件:GraphicComponent.java   
public static CoreMetrics createCoreMetrics(GraphicAttribute graphic) {
    return new CoreMetrics(graphic.getAscent(),
                           graphic.getDescent(),
                           GRAPHIC_LEADING,
                           graphic.getAscent() + graphic.getDescent() + GRAPHIC_LEADING,
                           graphic.getAlignment(),
                           new float[] { 0, -graphic.getAscent() / 2, -graphic.getAscent() },
                           -graphic.getAscent() / 2,
                           graphic.getAscent() / 12,
                           graphic.getDescent() / 3,
                           graphic.getAscent() / 12,
                           0, // ss offset
                           0); // italic angle -- need api for this
}
项目:OpenJSharp    文件:CoreMetrics.java   
public final float effectiveBaselineOffset(float[] fullOffsets) {
    switch (baselineIndex) {
    case GraphicAttribute.TOP_ALIGNMENT:
        return fullOffsets[4] + ascent;
    case GraphicAttribute.BOTTOM_ALIGNMENT:
        return fullOffsets[3] - descent;
    default:
        return fullOffsets[baselineIndex];
    }
}
项目:jdk8u-jdk    文件:GraphicComponent.java   
public static CoreMetrics createCoreMetrics(GraphicAttribute graphic) {
    return new CoreMetrics(graphic.getAscent(),
                           graphic.getDescent(),
                           GRAPHIC_LEADING,
                           graphic.getAscent() + graphic.getDescent() + GRAPHIC_LEADING,
                           graphic.getAlignment(),
                           new float[] { 0, -graphic.getAscent() / 2, -graphic.getAscent() },
                           -graphic.getAscent() / 2,
                           graphic.getAscent() / 12,
                           graphic.getDescent() / 3,
                           graphic.getAscent() / 12,
                           0, // ss offset
                           0); // italic angle -- need api for this
}
项目:jdk8u-jdk    文件:CoreMetrics.java   
public final float effectiveBaselineOffset(float[] fullOffsets) {
    switch (baselineIndex) {
    case GraphicAttribute.TOP_ALIGNMENT:
        return fullOffsets[4] + ascent;
    case GraphicAttribute.BOTTOM_ALIGNMENT:
        return fullOffsets[3] - descent;
    default:
        return fullOffsets[baselineIndex];
    }
}
项目:openjdk-jdk10    文件:GraphicComponent.java   
public static CoreMetrics createCoreMetrics(GraphicAttribute graphic) {
    return new CoreMetrics(graphic.getAscent(),
                           graphic.getDescent(),
                           GRAPHIC_LEADING,
                           graphic.getAscent() + graphic.getDescent() + GRAPHIC_LEADING,
                           graphic.getAlignment(),
                           new float[] { 0, -graphic.getAscent() / 2, -graphic.getAscent() },
                           -graphic.getAscent() / 2,
                           graphic.getAscent() / 12,
                           graphic.getDescent() / 3,
                           graphic.getAscent() / 12,
                           0, // ss offset
                           0); // italic angle -- need api for this
}
项目:openjdk-jdk10    文件:CoreMetrics.java   
public float effectiveBaselineOffset(float[] fullOffsets) {
    switch (baselineIndex) {
    case GraphicAttribute.TOP_ALIGNMENT:
        return fullOffsets[4] + ascent;
    case GraphicAttribute.BOTTOM_ALIGNMENT:
        return fullOffsets[3] - descent;
    default:
        return fullOffsets[baselineIndex];
    }
}
项目:openjdk9    文件:GraphicComponent.java   
public static CoreMetrics createCoreMetrics(GraphicAttribute graphic) {
    return new CoreMetrics(graphic.getAscent(),
                           graphic.getDescent(),
                           GRAPHIC_LEADING,
                           graphic.getAscent() + graphic.getDescent() + GRAPHIC_LEADING,
                           graphic.getAlignment(),
                           new float[] { 0, -graphic.getAscent() / 2, -graphic.getAscent() },
                           -graphic.getAscent() / 2,
                           graphic.getAscent() / 12,
                           graphic.getDescent() / 3,
                           graphic.getAscent() / 12,
                           0, // ss offset
                           0); // italic angle -- need api for this
}
项目:openjdk9    文件:CoreMetrics.java   
public float effectiveBaselineOffset(float[] fullOffsets) {
    switch (baselineIndex) {
    case GraphicAttribute.TOP_ALIGNMENT:
        return fullOffsets[4] + ascent;
    case GraphicAttribute.BOTTOM_ALIGNMENT:
        return fullOffsets[3] - descent;
    default:
        return fullOffsets[baselineIndex];
    }
}
项目:jdk8u_jdk    文件:GraphicComponent.java   
public static CoreMetrics createCoreMetrics(GraphicAttribute graphic) {
    return new CoreMetrics(graphic.getAscent(),
                           graphic.getDescent(),
                           GRAPHIC_LEADING,
                           graphic.getAscent() + graphic.getDescent() + GRAPHIC_LEADING,
                           graphic.getAlignment(),
                           new float[] { 0, -graphic.getAscent() / 2, -graphic.getAscent() },
                           -graphic.getAscent() / 2,
                           graphic.getAscent() / 12,
                           graphic.getDescent() / 3,
                           graphic.getAscent() / 12,
                           0, // ss offset
                           0); // italic angle -- need api for this
}
项目:jdk8u_jdk    文件:CoreMetrics.java   
public final float effectiveBaselineOffset(float[] fullOffsets) {
    switch (baselineIndex) {
    case GraphicAttribute.TOP_ALIGNMENT:
        return fullOffsets[4] + ascent;
    case GraphicAttribute.BOTTOM_ALIGNMENT:
        return fullOffsets[3] - descent;
    default:
        return fullOffsets[baselineIndex];
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:GraphicComponent.java   
public static CoreMetrics createCoreMetrics(GraphicAttribute graphic) {
    return new CoreMetrics(graphic.getAscent(),
                           graphic.getDescent(),
                           GRAPHIC_LEADING,
                           graphic.getAscent() + graphic.getDescent() + GRAPHIC_LEADING,
                           graphic.getAlignment(),
                           new float[] { 0, -graphic.getAscent() / 2, -graphic.getAscent() },
                           -graphic.getAscent() / 2,
                           graphic.getAscent() / 12,
                           graphic.getDescent() / 3,
                           graphic.getAscent() / 12,
                           0, // ss offset
                           0); // italic angle -- need api for this
}
项目:lookaside_java-1.8.0-openjdk    文件:CoreMetrics.java   
public final float effectiveBaselineOffset(float[] fullOffsets) {
    switch (baselineIndex) {
    case GraphicAttribute.TOP_ALIGNMENT:
        return fullOffsets[4] + ascent;
    case GraphicAttribute.BOTTOM_ALIGNMENT:
        return fullOffsets[3] - descent;
    default:
        return fullOffsets[baselineIndex];
    }
}
项目:infobip-open-jdk-8    文件:GraphicComponent.java   
public static CoreMetrics createCoreMetrics(GraphicAttribute graphic) {
    return new CoreMetrics(graphic.getAscent(),
                           graphic.getDescent(),
                           GRAPHIC_LEADING,
                           graphic.getAscent() + graphic.getDescent() + GRAPHIC_LEADING,
                           graphic.getAlignment(),
                           new float[] { 0, -graphic.getAscent() / 2, -graphic.getAscent() },
                           -graphic.getAscent() / 2,
                           graphic.getAscent() / 12,
                           graphic.getDescent() / 3,
                           graphic.getAscent() / 12,
                           0, // ss offset
                           0); // italic angle -- need api for this
}
项目:infobip-open-jdk-8    文件:CoreMetrics.java   
public final float effectiveBaselineOffset(float[] fullOffsets) {
    switch (baselineIndex) {
    case GraphicAttribute.TOP_ALIGNMENT:
        return fullOffsets[4] + ascent;
    case GraphicAttribute.BOTTOM_ALIGNMENT:
        return fullOffsets[3] - descent;
    default:
        return fullOffsets[baselineIndex];
    }
}
项目:jdk8u-dev-jdk    文件:GraphicComponent.java   
public static CoreMetrics createCoreMetrics(GraphicAttribute graphic) {
    return new CoreMetrics(graphic.getAscent(),
                           graphic.getDescent(),
                           GRAPHIC_LEADING,
                           graphic.getAscent() + graphic.getDescent() + GRAPHIC_LEADING,
                           graphic.getAlignment(),
                           new float[] { 0, -graphic.getAscent() / 2, -graphic.getAscent() },
                           -graphic.getAscent() / 2,
                           graphic.getAscent() / 12,
                           graphic.getDescent() / 3,
                           graphic.getAscent() / 12,
                           0, // ss offset
                           0); // italic angle -- need api for this
}
项目:jdk8u-dev-jdk    文件:CoreMetrics.java   
public final float effectiveBaselineOffset(float[] fullOffsets) {
    switch (baselineIndex) {
    case GraphicAttribute.TOP_ALIGNMENT:
        return fullOffsets[4] + ascent;
    case GraphicAttribute.BOTTOM_ALIGNMENT:
        return fullOffsets[3] - descent;
    default:
        return fullOffsets[baselineIndex];
    }
}
项目:jdk7-jdk    文件:GraphicComponent.java   
public static CoreMetrics createCoreMetrics(GraphicAttribute graphic) {
    return new CoreMetrics(graphic.getAscent(),
                           graphic.getDescent(),
                           GRAPHIC_LEADING,
                           graphic.getAscent() + graphic.getDescent() + GRAPHIC_LEADING,
                           graphic.getAlignment(),
                           new float[] { 0, -graphic.getAscent() / 2, -graphic.getAscent() },
                           -graphic.getAscent() / 2,
                           graphic.getAscent() / 12,
                           graphic.getDescent() / 3,
                           graphic.getAscent() / 12,
                           0, // ss offset
                           0); // italic angle -- need api for this
}
项目:jdk7-jdk    文件:CoreMetrics.java   
public final float effectiveBaselineOffset(float[] fullOffsets) {
    switch (baselineIndex) {
    case GraphicAttribute.TOP_ALIGNMENT:
        return fullOffsets[4] + ascent;
    case GraphicAttribute.BOTTOM_ALIGNMENT:
        return fullOffsets[3] - descent;
    default:
        return fullOffsets[baselineIndex];
    }
}
项目:openjdk-source-code-learn    文件:GraphicComponent.java   
public static CoreMetrics createCoreMetrics(GraphicAttribute graphic) {
    return new CoreMetrics(graphic.getAscent(),
                           graphic.getDescent(),
                           GRAPHIC_LEADING,
                           graphic.getAscent() + graphic.getDescent() + GRAPHIC_LEADING,
                           graphic.getAlignment(),
                           new float[] { 0, -graphic.getAscent() / 2, -graphic.getAscent() },
                           -graphic.getAscent() / 2,
                           graphic.getAscent() / 12,
                           graphic.getDescent() / 3,
                           graphic.getAscent() / 12,
                           0, // ss offset
                           0); // italic angle -- need api for this
}
项目:openjdk-source-code-learn    文件:CoreMetrics.java   
public final float effectiveBaselineOffset(float[] fullOffsets) {
    switch (baselineIndex) {
    case GraphicAttribute.TOP_ALIGNMENT:
        return fullOffsets[4] + ascent;
    case GraphicAttribute.BOTTOM_ALIGNMENT:
        return fullOffsets[3] - descent;
    default:
        return fullOffsets[baselineIndex];
    }
}
项目:OLD-OpenJDK8    文件:GraphicComponent.java   
public static CoreMetrics createCoreMetrics(GraphicAttribute graphic) {
    return new CoreMetrics(graphic.getAscent(),
                           graphic.getDescent(),
                           GRAPHIC_LEADING,
                           graphic.getAscent() + graphic.getDescent() + GRAPHIC_LEADING,
                           graphic.getAlignment(),
                           new float[] { 0, -graphic.getAscent() / 2, -graphic.getAscent() },
                           -graphic.getAscent() / 2,
                           graphic.getAscent() / 12,
                           graphic.getDescent() / 3,
                           graphic.getAscent() / 12,
                           0, // ss offset
                           0); // italic angle -- need api for this
}
项目:OLD-OpenJDK8    文件:CoreMetrics.java   
public final float effectiveBaselineOffset(float[] fullOffsets) {
    switch (baselineIndex) {
    case GraphicAttribute.TOP_ALIGNMENT:
        return fullOffsets[4] + ascent;
    case GraphicAttribute.BOTTOM_ALIGNMENT:
        return fullOffsets[3] - descent;
    default:
        return fullOffsets[baselineIndex];
    }
}
项目:cn1    文件:TextMetricsCalculator.java   
/**
 * Returns either values cached by checkBaselines method or reasonable
 * values for the TOP and BOTTOM alignments.
 * @param baselineIndex - baseline index
 * @return baseline offset
 */
float getBaselineOffset(int baselineIndex) {
    if (baselineIndex >= 0) {
        return baselineOffsets[baselineIndex];
    } else if (baselineIndex == GraphicAttribute.BOTTOM_ALIGNMENT) {
        return descent;
    } else if (baselineIndex == GraphicAttribute.TOP_ALIGNMENT) {
        return -ascent;
    } else {
        // awt.3F=Invalid baseline index
        throw new IllegalArgumentException(Messages.getString("awt.3F")); //$NON-NLS-1$
    }
}