java.awt.font.GraphicAttribute Java Examples

The following examples show how to use java.awt.font.GraphicAttribute. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GraphicComponent.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #2
Source File: GraphicComponent.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #3
Source File: GraphicComponent.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #4
Source File: GraphicComponent.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #5
Source File: OracleText.java    From magarena with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example #6
Source File: GraphicComponent.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #7
Source File: GraphicComponent.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #8
Source File: GraphicComponent.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #9
Source File: GraphicComponent.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #10
Source File: GraphicComponent.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #11
Source File: GraphicComponent.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #12
Source File: GraphicComponent.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #13
Source File: GraphicComponent.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #14
Source File: GraphicComponent.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #15
Source File: GraphicComponent.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #16
Source File: GraphicComponent.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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
}
 
Example #17
Source File: CoreMetrics.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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];
    }
}
 
Example #18
Source File: GraphicComponent.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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
}
 
Example #19
Source File: CoreMetrics.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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];
    }
}
 
Example #20
Source File: GraphicComponent.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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
}
 
Example #21
Source File: CoreMetrics.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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];
    }
}
 
Example #22
Source File: CoreMetrics.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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];
    }
}
 
Example #23
Source File: GraphicComponent.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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
}
 
Example #24
Source File: GraphicComponent.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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
}
 
Example #25
Source File: GraphicComponent.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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
}
 
Example #26
Source File: CoreMetrics.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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];
    }
}
 
Example #27
Source File: CoreMetrics.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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];
    }
}
 
Example #28
Source File: CoreMetrics.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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];
    }
}
 
Example #29
Source File: RichTextSpecProducer.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Map<Attribute, Object> computeImageStyle( final StyleSheet layoutContext,
    final RenderableReplacedContentBox content ) {
  final Image image = imageProducer.createImagePlaceholder( content );
  ImageGraphicAttribute iga = new ImageGraphicAttribute( image, GraphicAttribute.BOTTOM_ALIGNMENT );

  Map<Attribute, Object> attrs = computeStyle( layoutContext );
  attrs.put( TextAttribute.CHAR_REPLACEMENT, iga );
  return attrs;
}
 
Example #30
Source File: CoreMetrics.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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];
    }
}