Name
addText( ) — add a new element to a text block
Synopsis
$tb->addText( text =>$text
, font =>$font
, size =>$size
, leading=>$leading
)
The addText( )
method will add a new text
element to the TextBlock object. A “text element” can be
thought of as a section of text that has the same characteristics
(i.e., all the characters are the same font, size, and leading). This
representation allows you to include text rendered in multiple fonts
at multiple sizes within the same text block by including them as
separate elements. Different alignment options have not been included
in this version of the TextBlock module, but would be fairly easy to
add. All text is left-aligned.
This method takes up to four attributes. If the
font
, size
, or
leading
attributes are not provided, the default
attributes for the TextBlock object are used. The attributes are:
-
text
The
text
attribute is required, though nothing bad will happen if you leave it out. This is simply the text to be rendered in the text block. Line breaks may be inserted by including a\n
newline string.-
font
The
font
attribute is a string indicating the name of the font to be used to render this element. The PostScript package uses an internal description of the font metrics of various fonts, which is contained in the PostScript::Metrics module. The PostScript::Metrics module supports the following fonts, which corresponds with the set of default Ghostscript fonts with have AFM files:CenturySchL-Bold
CenturySchL-BoldIta
CenturySchL-Ital ...
Get Programming Web Graphics with Perl and GNU Softwar now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.