1Font::TTF::XMLparse(3)User Contributed Perl DocumentationFont::TTF::XMLparse(3)
2
3
4

NAME

6       Font::TTF::XMLparse - provides support for XML parsing. Requires Expat
7       module XML::Parser::Expat
8

SYNOPSIS

10           use Font::TTF::Font;
11           use Font::TTF::XMLparse;
12
13           $f = Font::TTF::Font->new;
14           read_xml($f, $ARGV[0]);
15           $f->out($ARGV[1]);
16

DESCRIPTION

18       This module contains the support routines for parsing XML and generat‐
19       ing the Truetype font structures as a result. The module has been sepa‐
20       rated from the rest of the package in order to reduce the dependency
21       that this would bring, of the whole package on XML::Parser. This way,
22       people without the XML::Parser can still use the rest of the package.
23
24       The package interacts with another package through the use of a context
25       containing and element 'receiver' which is an object which can possibly
26       receive one of the following messages:
27
28       XML_start
29           This message is called when an open tag occurs. It is called with
30           the context, tag name and the attributes. The return value has no
31           meaning.
32
33       XML_end
34           This messages is called when a close tag occurs. It is called with
35           the context, tag name and attributes (held over from when the tag
36           was opened). There are 3 possible return values from such a mes‐
37           sage:
38
39           undef   This is the default return value indicating that default
40                   processing should occur in which either the current element
41                   on the tree, or the text of this element should be stored
42                   in the parent object.
43
44           $context
45                   This magic value marks that the element should be deleted
46                   from the parent.  Nothing is stored in the parent. (This
47                   rather than '' is used to allow 0 returns.)
48
49           anything
50                   Anything else is taken as the element content to be stored
51                   in the parent.
52
53       In addition, the context hash passed to these messages contains the
54       following keys:
55
56       xml This is the expat xml object. The context is also available as
57           $context->{'xml'}{' mycontext'}. But that is a long winded way of
58           not saying much!
59
60       font
61           This is the base object that was passed in for XML parsing.
62
63       receiver
64           This holds the current receiver of parsing events. It may be set in
65           associated application to adjust which objects should receive mes‐
66           sages when. It is also stored in the parsing stack to ensure that
67           where an object changes it during XML_start, that that same object
68           that received XML_start will receive the corresponding XML_end
69
70       stack
71           This is the parsing stack, used internally to hold the current
72           receiver and attributes for each element open, as a complete hier‐
73           archy back to the root element.
74
75       tree
76           This element contains the storage tree corresponding to the parent
77           of each element in the stack. The default action is to push undef
78           onto this stack during XML_start and then to resolve this, either
79           in the associated application (by changing $context->{'tree'}[-1])
80           or during XML_end of a child element, by which time we know whether
81           we are dealing with an array or a hash or what.
82
83       text
84           Character processing is to insert all the characters into the text
85           element of the context for available use later.
86

METHODS

88perl v5.8.8                       2005-06-14            Font::TTF::XMLparse(3)
Impressum