catch(Exception e)
{throw new RuntimeException(e);}
int stepCount = 5;
int step = (int)(pageSize.getHeight()) / (stepCount + 1);
BlockComposer blockComposer = new BlockComposer(composer);
{
blockComposer.begin(
new Rectangle2D.Double(
30,
0,
pageSize.getWidth()-60,
step*.8
),
AlignmentXEnum.Center,
AlignmentYEnum.Middle
);
blockComposer.showText(
"Text block line space"
);
blockComposer.end();
}
// Drawing the text blocks...
int x = 30;
int y = (int)(step*1.1);
blockComposer.getLineSpace().setUnitMode(UnitModeEnum.Relative);
for(int index = 0; index < stepCount; index++)
{
float relativeLineSpace = 0.5f * index;
blockComposer.getLineSpace().setValue(relativeLineSpace);
composer.setFont(
composer.getState().getFont(),
10
);
composer.showText(
relativeLineSpace + ":",
new Point2D.Double(x,y),
AlignmentXEnum.Left,
AlignmentYEnum.Middle,
0
);
composer.setFont(
composer.getState().getFont(),
9
);
Rectangle2D frame = new Rectangle2D.Double(
150,
y-step*.4,
350,
step*.9
);
blockComposer.begin(frame,AlignmentXEnum.Left,AlignmentYEnum.Top);
blockComposer.showText(
"Demonstrating how to set the block line space. Line space can be expressed either as an absolute value (in user-space units) or as a relative one (as a floating-point ratio); in the latter case the base value is represented by the current font's line height (so that, for example, 2 means \"a line space that's double the line height\")."
);
blockComposer.end();
composer.beginLocalState();
composer.setLineWidth(0.2f);
composer.setLineDash(5,5,5);
composer.drawRectangle(frame);