Lutz Gehlen
and 2 contributors


SVG::Rasterize::State::Text - state of a text/text content node


Version 0.003008


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.




Inherited from SVG::Rasterize::State.

Public Attributes


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.


ARRAY reference, list of explicit x positions that this element still has to offer.


Same for y.


Same for dx.


Same for dy.


Same for rotate.

Methods for Users


Methods for Developers


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.


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.



Not documented, yet. Sorry.


Not documented, yet. Sorry.


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 overloads make_ro_accessor to make the readonly accessors throw an exception object (of class SVG::Rasterize::Exception::Attribute) instead of just croaking.


Lutz Gehlen, <perl at>


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 for more information.