org.apache.batik.extension.svg

Class FlowExtGlyphLayout

public class FlowExtGlyphLayout extends GlyphLayout

A GlyphLayout class for SVG 1.2 flowing text.
Constructor Summary
FlowExtGlyphLayout(AttributedCharacterIterator aci, int[] charMap, Point2D offset, FontRenderContext frc)
Method Summary
static voidlayoutChunk(GVTGlyphVector gv, Point2D origin, int justification, List lineInfos)
static voidtextWrapTextChunk(AttributedCharacterIterator[] acis, List chunkLayouts, List flowRects)
This will wrap the text associated with aci and layouts.
static voidupdateVerticalAlignOffset(Float verticalAlignOffset, RegionInfo region, float maxDescent)
Updates the specified verticalAlignmentOffset using the current alignment rule and the heights of the flow rect and the maximum descent of the text.

Constructor Detail

FlowExtGlyphLayout

public FlowExtGlyphLayout(AttributedCharacterIterator aci, int[] charMap, Point2D offset, FontRenderContext frc)

Method Detail

layoutChunk

public static void layoutChunk(GVTGlyphVector gv, Point2D origin, int justification, List lineInfos)

textWrapTextChunk

public static void textWrapTextChunk(AttributedCharacterIterator[] acis, List chunkLayouts, List flowRects)
This will wrap the text associated with aci and layouts.

Parameters: acis An array of Attributed Charater Iterators containing the text to wrap. There is one aci per text chunk (which maps to flowPara elements. Used to access font, paragraph, and line break info. chunkLayouts A List of List of GlyphLayout objects. There is a List of GlyphLayout objects for each flowPara element. There is a GlyphLayout for approximately each sub element in the flowPara element. flowRects A List of Rectangle2D representing the regions to flow text into.

updateVerticalAlignOffset

public static void updateVerticalAlignOffset(Float verticalAlignOffset, RegionInfo region, float maxDescent)
Updates the specified verticalAlignmentOffset using the current alignment rule and the heights of the flow rect and the maximum descent of the text. This method gets for called every line, but only the value that is calculated for the last line of the flow rect is used by the glyph rendering. This is achieved by creating a new verticalAlignOffset object everytime a new flow rect is encountered, thus a single verticalAlignmentOffset is shared for all LineInfo objects created for a given flow rect. The value is calculated by determining the left over space in the flow rect and scaling that value by 1.0 to align to the bottom, 0.5 for middle and 0.0 for top.

Parameters: verticalAlignOffset the java.awt.geom.Point2D.Float object that is storing the alignment offset. region the RegionInfo object that we are rendering into. maxDescent the very lowest point this line reaches.

Copyright B) 2008 Apache Software Foundation. All Rights Reserved.