Java Code Examples for java.awt.font.ShapeGraphicAttribute

The following are top voted examples for showing how to use java.awt.font.ShapeGraphicAttribute. 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: ShapeGraphicAttributeTest.java   View source code 6 votes vote down vote up
public final void testGetJustificationInfo() {
    sga = new ShapeGraphicAttribute(shape, alignment, stroke);
    float advance = sga.getAdvance();
    GlyphJustificationInfo gji = new GlyphJustificationInfo(
            advance,
            false,
            GlyphJustificationInfo.PRIORITY_INTERCHAR,
            advance / 3,
            advance / 3,
            false,
            GlyphJustificationInfo.PRIORITY_WHITESPACE,
            0,
            0);
    equalsGlyphJustificationInfo(gji, sga.getJustificationInfo());

}
 
Example 2
Project: freeVM   File: ShapeGraphicAttributeTest.java   View source code 6 votes vote down vote up
public final void testGetJustificationInfo() {
    sga = new ShapeGraphicAttribute(shape, alignment, stroke);
    float advance = sga.getAdvance();
    GlyphJustificationInfo gji = new GlyphJustificationInfo(
            advance,
            false,
            GlyphJustificationInfo.PRIORITY_INTERCHAR,
            advance / 3,
            advance / 3,
            false,
            GlyphJustificationInfo.PRIORITY_WHITESPACE,
            0,
            0);
    equalsGlyphJustificationInfo(gji, sga.getJustificationInfo());

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

}
 
Example 4
Project: jftgl   File: FTGlyph.java   View source code 6 votes vote down vote up
/**
 * Constructor
 * @param glyph The Shape to put in the FTGlyph.
 */
public FTGlyph(Shape glyph)
{
	if(glyph != null)
	{
		this.bBox = new FTBBox(glyph);
		this.glyph = glyph;
		//several options:
		/** due to {@link ShapeGraphicAttribute#getAdvance()} description */
		this.advance = Math.abs(this.bBox.upperX - this.bBox.lowerX);
		/** due to {@link ShapeGraphicAttribute} */
		float shapeadvance = new ShapeGraphicAttribute(glyph, ShapeGraphicAttribute.CENTER_BASELINE, ShapeGraphicAttribute.STROKE).getAdvance();
		/** or create a {@link java.awt.font.TextLayout} and get the advance for the letter, the shape represents */
		//System.out.println("[Boxed] " + this.advance + " [ShapeAttribute] " + shapeadvance);
		this.advance = shapeadvance;
	}
}
 
Example 5
Project: cn1   File: ShapeGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testGetBounds() {
    sga = new ShapeGraphicAttribute(shape, alignment, ShapeGraphicAttribute.FILL);
    Rectangle2D.Float bounds = (Rectangle2D.Float)shape.getBounds2D();
    assertEquals(bounds, sga.getBounds());

}
 
Example 6
Project: cn1   File: ShapeGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testEqualsShapeGraphicAttribute() {
    sga = new ShapeGraphicAttribute(shape, alignment, stroke);
    ShapeGraphicAttribute sga1 = new ShapeGraphicAttribute(shape, alignment, stroke);
    assertTrue(sga.equals(sga1));
}
 
Example 7
Project: cn1   File: ShapeGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testEqualsObject() {
    sga = new ShapeGraphicAttribute(shape, alignment, stroke);
    ShapeGraphicAttribute sga1 = new ShapeGraphicAttribute(shape, alignment, stroke);
    assertTrue(sga.equals((Object)sga1));
}
 
Example 8
Project: cn1   File: ShapeGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testGetAlignment() {
    sga = new ShapeGraphicAttribute(shape, alignment, stroke);
    assertEquals(alignment, sga.getAlignment());
}
 
Example 9
Project: freeVM   File: ShapeGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testGetBounds() {
    sga = new ShapeGraphicAttribute(shape, alignment, ShapeGraphicAttribute.FILL);
    Rectangle2D.Float bounds = (Rectangle2D.Float)shape.getBounds2D();
    assertEquals(bounds, sga.getBounds());

}
 
Example 10
Project: freeVM   File: ShapeGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testEqualsShapeGraphicAttribute() {
    sga = new ShapeGraphicAttribute(shape, alignment, stroke);
    ShapeGraphicAttribute sga1 = new ShapeGraphicAttribute(shape, alignment, stroke);
    assertTrue(sga.equals(sga1));
}
 
Example 11
Project: freeVM   File: ShapeGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testEqualsObject() {
    sga = new ShapeGraphicAttribute(shape, alignment, stroke);
    ShapeGraphicAttribute sga1 = new ShapeGraphicAttribute(shape, alignment, stroke);
    assertTrue(sga.equals((Object)sga1));
}
 
Example 12
Project: freeVM   File: ShapeGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testGetAlignment() {
    sga = new ShapeGraphicAttribute(shape, alignment, stroke);
    assertEquals(alignment, sga.getAlignment());
}
 
Example 13
Project: freeVM   File: ShapeGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testGetBounds() {
    sga = new ShapeGraphicAttribute(shape, alignment, ShapeGraphicAttribute.FILL);
    Rectangle2D.Float bounds = (Rectangle2D.Float)shape.getBounds2D();
    assertEquals(bounds, sga.getBounds());

}
 
Example 14
Project: freeVM   File: ShapeGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testEqualsShapeGraphicAttribute() {
    sga = new ShapeGraphicAttribute(shape, alignment, stroke);
    ShapeGraphicAttribute sga1 = new ShapeGraphicAttribute(shape, alignment, stroke);
    assertTrue(sga.equals(sga1));
}
 
Example 15
Project: freeVM   File: ShapeGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testEqualsObject() {
    sga = new ShapeGraphicAttribute(shape, alignment, stroke);
    ShapeGraphicAttribute sga1 = new ShapeGraphicAttribute(shape, alignment, stroke);
    assertTrue(sga.equals((Object)sga1));
}
 
Example 16
Project: freeVM   File: ShapeGraphicAttributeTest.java   View source code 4 votes vote down vote up
public final void testGetAlignment() {
    sga = new ShapeGraphicAttribute(shape, alignment, stroke);
    assertEquals(alignment, sga.getAlignment());
}