NAME
SVG::Rasterize::State::Text
- state of a text/text content node
VERSION
Version 0.003006
DESCRIPTION
Text and text content nodes need special functionality. The hardest part belongs to the character data nodes, which contain the actual text. Their characters might have specific position settings, which may be inherited from upstream tspan
, text
, or textPath
nodes.
This class implements a process_node_extra method overloading the empty one of SVG::Rasterize::State. This method splits character data into atoms where an atom (this term is coined by me while chunk and block are taken from the SVG
specification) is a sequence of characters that can be handed to the rasterization engine in one go. Note that the atoms defined here might be split up further directly before rasterization due to bidirectional text.
INTERFACE
Constructors
new/init
Inherited from SVG::Rasterize::State.
Public Attributes
text_atoms
Readonly attribute. Holds the reference to an array of HASH references. The array is filled during initialization. Each hash has the following entries:
x: explicit x value if given
y: explicit y value if given
dx: explicit dx value if given
dy: explicit dy value if given
rotate: explicit rotate value if given
chunkID: number of the text chunk this atom belongs to
new_chunk
only present for first atom of each chunk, leftover of processing, should not be used
blockID
number of the independent text block this atom belongs to
new_block
only present for first atom of each block, leftover of processing, should not be used
atomID
number of the atom, equal to the length of text before this atom thereby allowing further splitting without renumbering
cdata: the actual characters of this atom
state: weak reference to this object.
x_buffer
ARRAY reference, list of explicit x positions that this element still has to offer.
y_buffer
Same for y.
dx_buffer
Same for dx.
dy_buffer
Same for dy.
rotate_buffer
Same for rotate.
Methods for Users
None.
Methods for Developers
process_node_extra
Overloads the empty method of SVG::Rasterize::State.
Has two modes of operation. For elements, it saves the position attributes if present into buffer copies from which they can be shifted by character data child nodes.
For character data nodes, it splits the string into atoms assigning position values (if provided by ancestors) to the characters.
add_text_atoms
Called by process_node_extra. Takes a list of atom HASH references and pushes them to the text_atoms list. Calls itself on the ancestor text
or textPath
element. At this call, it sets chunkID, blockID, and atomID.
DIAGNOSTICS
Exceptions
Not documented, yet. Sorry.
Warnings
Not documented, yet. Sorry.
INTERNALS
Internal Methods
These methods are just documented for myself. You can read on to satisfy your voyeuristic desires, but be aware of that they might change or vanish without notice in a future version.
make_ro_accessor
This piece of documentation is mainly here to make the
POD
coverage test happy.SVG::Rasterize::State::Text
overloadsmake_ro_accessor
to make the readonly accessors throw an exception object (of classSVG::Rasterize::Exception::Attribute
) instead of just croaking.
AUTHOR
Lutz Gehlen, <perl at lutzgehlen.de>
LICENSE AND COPYRIGHT
Copyright 2011 Lutz Gehlen.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.