Java Code Examples for java.awt.font.ImageGraphicAttribute

The following are top voted examples for showing how to use java.awt.font.ImageGraphicAttribute. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: cn1   File: ImageGraphicAttributeTest.java   View source code 6 votes vote down vote up
public final void testGetJustificationInfo() {
    iga = new ImageGraphicAttribute(img, alignment);
    float advance = iga.getAdvance();
    GlyphJustificationInfo gji = new GlyphJustificationInfo(
            advance,
            false,
            GlyphJustificationInfo.PRIORITY_INTERCHAR,
            advance / 3,
            advance / 3,
            false,
            GlyphJustificationInfo.PRIORITY_WHITESPACE,
            0,
            0);
    equalsGlyphJustificationInfo(gji, iga.getJustificationInfo());

}
 
Example 2
Project: magarena   File: OracleText.java   View source code 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 3
Project: freeVM   File: ImageGraphicAttributeTest.java   View source code 6 votes vote down vote up
public final void testGetJustificationInfo() {
    iga = new ImageGraphicAttribute(img, alignment);
    float advance = iga.getAdvance();
    GlyphJustificationInfo gji = new GlyphJustificationInfo(
            advance,
            false,
            GlyphJustificationInfo.PRIORITY_INTERCHAR,
            advance / 3,
            advance / 3,
            false,
            GlyphJustificationInfo.PRIORITY_WHITESPACE,
            0,
            0);
    equalsGlyphJustificationInfo(gji, iga.getJustificationInfo());

}
 
Example 4
Project: freeVM   File: ImageGraphicAttributeTest.java   View source code 6 votes vote down vote up
public final void testGetJustificationInfo() {
    iga = new ImageGraphicAttribute(img, alignment);
    float advance = iga.getAdvance();
    GlyphJustificationInfo gji = new GlyphJustificationInfo(
            advance,
            false,
            GlyphJustificationInfo.PRIORITY_INTERCHAR,
            advance / 3,
            advance / 3,
            false,
            GlyphJustificationInfo.PRIORITY_WHITESPACE,
            0,
            0);
    equalsGlyphJustificationInfo(gji, iga.getJustificationInfo());

}
 
Example 5
Project: cn1   File: ImageGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testEqualsImageGraphicAttribute() {
    iga = new ImageGraphicAttribute(img, alignment);
    ImageGraphicAttribute iga1 = new ImageGraphicAttribute(img, alignment);
    assertEquals(iga, iga1);
}
 
Example 6
Project: cn1   File: ImageGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testEqualsObject() {
    iga = new ImageGraphicAttribute(img, alignment);
    ImageGraphicAttribute iga1 = new ImageGraphicAttribute(img, alignment);
    assertEquals(iga, iga1);
}
 
Example 7
Project: cn1   File: ImageGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testGetAlignment() {
    iga = new ImageGraphicAttribute(img, alignment);
    assertEquals(alignment, iga.getAlignment());
}
 
Example 8
Project: freeVM   File: ImageGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testEqualsImageGraphicAttribute() {
    iga = new ImageGraphicAttribute(img, alignment);
    ImageGraphicAttribute iga1 = new ImageGraphicAttribute(img, alignment);
    assertEquals(iga, iga1);
}
 
Example 9
Project: freeVM   File: ImageGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testEqualsObject() {
    iga = new ImageGraphicAttribute(img, alignment);
    ImageGraphicAttribute iga1 = new ImageGraphicAttribute(img, alignment);
    assertEquals(iga, iga1);
}
 
Example 10
Project: freeVM   File: ImageGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testGetAlignment() {
    iga = new ImageGraphicAttribute(img, alignment);
    assertEquals(alignment, iga.getAlignment());
}
 
Example 11
Project: freeVM   File: ImageGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testEqualsImageGraphicAttribute() {
    iga = new ImageGraphicAttribute(img, alignment);
    ImageGraphicAttribute iga1 = new ImageGraphicAttribute(img, alignment);
    assertEquals(iga, iga1);
}
 
Example 12
Project: freeVM   File: ImageGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testEqualsObject() {
    iga = new ImageGraphicAttribute(img, alignment);
    ImageGraphicAttribute iga1 = new ImageGraphicAttribute(img, alignment);
    assertEquals(iga, iga1);
}
 
Example 13
Project: freeVM   File: ImageGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testGetAlignment() {
    iga = new ImageGraphicAttribute(img, alignment);
    assertEquals(alignment, iga.getAlignment());
}