Games::Go::Dg2Ps - Perl extension to convert Games::Go::Diagrams
to PostScript.
use Games::Go::Dg2Ps
my $dg2ps = B<Games::Go::Dg2Ps-E<gt>new> (options);
$dg2ps->convertDiagram($diagram);
Games::Go::Dg2Ps converts a Games::Go::Diagram into
PostScript.
- my $dg2ps =
Games::Go::Dg2Ps->new (?options?)
- A new Games::Go::Dg2Ps takes the following options:
- pageSize =>
'page size'
- May be one of:
- 'A0' - 'A9'
- 'B0' - 'B10'
- 'Executive'
- 'Folio'
- 'Half-Letter'
- 'Letter'
- 'US-Letter'
- 'Legal
- 'US-Legal'
- 'Tabloid'
- 'SuperB'
- 'Ledger'
- 'Comm #10 Envelope'
- 'Envelope-Monarch'
- 'Envelope-DL'
- 'Envelope-C5'
- 'EuroPostcard'
- topMargin
=> points
- bottomMargin
=> points
- leftMargin
=> points
- rightMargin
=> points
- Margins are set in PostScript 'user space units' which are approximately
equivilent to points (1/72 of an inch).
Default for all margins: 72 * .70 (7/10s of an inch)
- text_fontName
=> 'font' Default: 'Times-Roman',
- stone_fontName
=> 'font' Default: 'Courier-Bold'
- Text and stone fonts names may be one of these (case sensitive):
- text_fontSize
=> points
- The point size for the comment text. Diagram titles use this size plus 4,
and the game title uses this size plus 6.
Default: 11
- stone_fontSize
=> points
- The stone_fontSize determines the size of the stones and diagrams. Stone
size is chosen to allow up to three digits on a stone . The default
stone_fontSize allows for three diagrams (with -coords) per 'letter' page
if comments don't take up extra space below diagrams.
If doubleDigits is specified, the stones and board are
slightly smaller (stone 100 may look a bit cramped).
Default: 5
- stone_width
=> points
- stone_height
=> points
- The stone_width and stone_height determine the size of the
stones and diagrams.
If stone_width is not explicitly set, it is calculated
from the stone_fontSize to allow up to three digits on a stone .
The default stone_fontSize allows for three diagrams (with
-coords) per 'letter' page if comments don't take up extra space below
diagrams. If doubleDigits is specified, the stones and board are
slightly smaller (stone 100 may look a bit cramped).
If stone_height is not explicitly set, it will be 1.05
* stone_width, creating a slightly rectangular diagram.
Default: undef - determined from stone_fontSize
- ps_debug
=#<gt> number from 0 to 2
- When non-zero, code and subroutines are added to the PostScript output to
help debug the PostScript file. This is very slightly documented in
PostScript::File, but you'll probably need to read through the PostScript
output to make any use of it.
Default: 0
- $dg2ps->configure (option => value, ?...?)
- Change Dg2Ps options from values passed at new time.
- $dg2ps->print ($text ? , ... ?)
- prints raw PostScript code to file as defined at new
time.
- $dg2ps->printComment ($text ? , ... ?)
- Adds $text to the diagram comments.
- $dg2ps->comment ($comment ? , ... ?)
- Inserts the PostScript comment character ('%') in front of each line of
each comment and prints it to file.
Note that this is not the same as the
printComment method.
- my $canvas =
$dg2ps->convertDiagram ($diagram)
- Converts a Games::Go::Diagram into PostScript.
- my $converted_text =
$dg2ps->convertText ($text)
- Converts $text into text for display (handles
PostScript escape sequences).
Returns the converted text.
- $title = $dg2ps->convertProperties (\%sgfHash)
- convertProperties takes a reference to a hash of properties as
extracted from an SGF file. Each hash key is a property ID and the hash
value is a reference to an array of property values:
$hash->{propertyId}->[values]. The following
SGF properties are recognized:
Both long and short property names are recognized, and all
unrecognized properties are ignored with no warnings. Note that these
properties are all intended as game-level notations.
- $dg2ps->close
- prints final PostScript code to the output file and closes the
file.
Reid Augustin, <reid@hellosix.com>
Copyright (C) 2005 by Reid Augustin
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself, either Perl version 5.8.5 or,
at your option, any later version of Perl 5 you may have available.