PDF Clown
0.1.2

org.pdfclown.documents.contents.composition
Class BlockComposer

java.lang.Object
  extended by org.pdfclown.documents.contents.composition.BlockComposer

public final class BlockComposer
extends Object

Content block composer.

It provides content positioning functionalities for page typesetting.

Since:
0.0.3
Version:
0.1.2, 01/20/12
Author:
Stefano Chizzolini (http://www.stefanochizzolini.it), Manuel Guilbault (manuel.guilbault@gmail.com)

Constructor Summary
BlockComposer(PrimitiveComposer baseComposer)
           
 
Method Summary
 void begin(Rectangle2D frame, XAlignmentEnum xAlignment, YAlignmentEnum yAlignment)
          Begins a content block.
 void end()
          Ends the content block.
 PrimitiveComposer getBaseComposer()
          Gets the base composer.
 Rectangle2D getBoundBox()
          Gets the area occupied by the already-placed block contents.
 Rectangle2D getFrame()
          Gets the area where to place the block contents.
 char getHyphenationCharacter()
          Gets the character shown at the end of the line before a hyphenation break.
 LineAlignmentEnum getLineAlignment()
          Gets the default line alignment.
 Length getLineSpace()
          Gets the text interline spacing.
 ContentScanner getScanner()
          Gets the content scanner.
 XAlignmentEnum getXAlignment()
          Gets the horizontal alignment applied to the current content block.
 YAlignmentEnum getYAlignment()
          Gets the vertical alignment applied to the current content block.
 boolean isHyphenation()
          Gets whether the hyphenation algorithm has to be applied.
 void setHyphenation(boolean value)
           
 void setHyphenationCharacter(char value)
           
 void setLineAlignment(LineAlignmentEnum value)
           
 void setLineSpace(Length value)
           
 void showBreak()
          Ends current paragraph.
 void showBreak(Dimension2D offset)
          Ends current paragraph, specifying the offset of the next one.
 void showBreak(Dimension2D offset, XAlignmentEnum xAlignment)
          Ends current paragraph, specifying the offset and alignment of the next one.
 void showBreak(XAlignmentEnum xAlignment)
          Ends current paragraph, specifying the alignment of the next one.
 int showText(String text)
          Shows text.
 int showText(String text, Object lineAlignment)
          Shows text.
 boolean showXObject(XObject xObject, Dimension2D size)
          Shows the specified external object.
 boolean showXObject(XObject xObject, Dimension2D size, Object lineAlignment)
          Shows the specified external object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockComposer

public BlockComposer(PrimitiveComposer baseComposer)
Method Detail

begin

public void begin(Rectangle2D frame,
                  XAlignmentEnum xAlignment,
                  YAlignmentEnum yAlignment)
Begins a content block.

Parameters:
frame - Block boundaries.
xAlignment - Horizontal alignment.
yAlignment - Vertical alignment.

end

public void end()
Ends the content block.


getBaseComposer

public PrimitiveComposer getBaseComposer()
Gets the base composer.


getBoundBox

public Rectangle2D getBoundBox()
Gets the area occupied by the already-placed block contents.


getFrame

public Rectangle2D getFrame()
Gets the area where to place the block contents.


getHyphenationCharacter

public char getHyphenationCharacter()
Gets the character shown at the end of the line before a hyphenation break. Initial value: hyphen symbol (U+002D, i.e. '-').


getLineAlignment

public LineAlignmentEnum getLineAlignment()
Gets the default line alignment. Initial value: LineAlignmentEnum.BaseLine.


getLineSpace

public Length getLineSpace()
Gets the text interline spacing. Initial value: 0.


getScanner

public ContentScanner getScanner()
Gets the content scanner.


getXAlignment

public XAlignmentEnum getXAlignment()
Gets the horizontal alignment applied to the current content block.


getYAlignment

public YAlignmentEnum getYAlignment()
Gets the vertical alignment applied to the current content block.


isHyphenation

public boolean isHyphenation()
Gets whether the hyphenation algorithm has to be applied. Initial value: false.


setHyphenation

public void setHyphenation(boolean value)
See Also:
isHyphenation()

setHyphenationCharacter

public void setHyphenationCharacter(char value)

setLineAlignment

public void setLineAlignment(LineAlignmentEnum value)
See Also:
getLineAlignment()

setLineSpace

public void setLineSpace(Length value)
See Also:
getLineSpace()

showBreak

public void showBreak()
Ends current paragraph.


showBreak

public void showBreak(Dimension2D offset)
Ends current paragraph, specifying the offset of the next one.

This functionality allows higher-level features such as paragraph indentation and margin.

Parameters:
offset - Relative location of the next paragraph.

showBreak

public void showBreak(XAlignmentEnum xAlignment)
Ends current paragraph, specifying the alignment of the next one.

This functionality allows higher-level features such as paragraph indentation and margin.

Parameters:
xAlignment - Horizontal alignment.

showBreak

public void showBreak(Dimension2D offset,
                      XAlignmentEnum xAlignment)
Ends current paragraph, specifying the offset and alignment of the next one.

This functionality allows higher-level features such as paragraph indentation and margin.

Parameters:
offset - Relative location of the next paragraph.
xAlignment - Horizontal alignment.

showText

public int showText(String text)
Shows text.

Default line alignment is applied.

Parameters:
text - Text to show.
Returns:
Last shown character index.

showText

public int showText(String text,
                    Object lineAlignment)
Shows text.

Parameters:
text - Text to show.
lineAlignment - Line alignment. It can be:
  • LineAlignmentEnum
  • Length: arbitrary super-/sub-script, depending on whether the value is positive or not.
  • Returns:
    Last shown character index.

    showXObject

    public boolean showXObject(XObject xObject,
                               Dimension2D size)
    Shows the specified external object.

    Default line alignment is applied.

    Parameters:
    xObject - External object.
    size - Size of the external object.
    Returns:
    Whether the external object was successfully shown.

    showXObject

    public boolean showXObject(XObject xObject,
                               Dimension2D size,
                               Object lineAlignment)
    Shows the specified external object.

    Parameters:
    xObject - External object.
    size - Size of the external object.
    lineAlignment - Line alignment. It can be:
  • LineAlignmentEnum
  • Length: arbitrary super-/sub-script, depending on whether the value is positive or not.
  • Returns:
    Whether the external object was successfully shown.

    PDF Clown
    0.1.2

    Project home page

    Copyright © 2006-2013 Stefano Chizzolini. Some Rights Reserved.
    This documentation is available under the terms of the GNU Free Documentation License.