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()); }
/** * 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; } }
public final void testGetBounds() { sga = new ShapeGraphicAttribute(shape, alignment, ShapeGraphicAttribute.FILL); Rectangle2D.Float bounds = (Rectangle2D.Float)shape.getBounds2D(); assertEquals(bounds, sga.getBounds()); }
public final void testEqualsShapeGraphicAttribute() { sga = new ShapeGraphicAttribute(shape, alignment, stroke); ShapeGraphicAttribute sga1 = new ShapeGraphicAttribute(shape, alignment, stroke); assertTrue(sga.equals(sga1)); }
public final void testEqualsObject() { sga = new ShapeGraphicAttribute(shape, alignment, stroke); ShapeGraphicAttribute sga1 = new ShapeGraphicAttribute(shape, alignment, stroke); assertTrue(sga.equals((Object)sga1)); }
public final void testGetAlignment() { sga = new ShapeGraphicAttribute(shape, alignment, stroke); assertEquals(alignment, sga.getAlignment()); }