Font-TTF

 view release on metacpan or  search on metacpan

lib/Font/TTF/Glyph.pm  view on Meta::CPAN

=head1 NAME

Font::TTF::Glyph - Holds a information for a single glyph

=head1 DESCRIPTION

This is a single glyph description as held in a TT font. On creation only its
header is read. Thus you can get the bounding box of each glyph without having
to read all the other information.

=head1 INSTANCE VARIABLES

In addition to the named variables in a glyph header (C<xMin> etc.), there are
also all capital instance variables for holding working information, mostly
from the location table.

=head2 Variables for all glyphs:

The standard attributes each glyph has are:

=over 4

=item numberOfContours

For simple glyphs this will be the count of contours. For compound glyphs this will be -1.

=item xMin

=item yMin

=item xMax

=item yMax

These identify the bounding box of the glyph.

=back

There are also other, derived, instance variables for each glyph which are read
when the whole glyph is read (via C<read_dat>):

=over 4

=item instLen

Number of bytes in the hinting instructions (Warning this variable is deprecated,
use C<length($g->{'hints'})> instead).

=item hints

The string containing the hinting code for the glyph

=back

=head2 Variables for simple glyphs (numberOfContours E<gt>= 0):

=over 4

=item endPoints

An array of endpoints for each contour in the glyph. There are
C<numberOfContours> contours in a glyph. The number of points in a glyph is
equal to the highest endpoint of a contour.

=item numPoints

This is a generated value which contains the total number of points for this simple glyph.

=back

There are also a number of arrays indexed by point number:

=over 4

=item flags

The flags associated with reading this point. The flags for a point are
recalculated for a point when it is C<update>d. Thus the flags are not very
useful. The only important bit is bit 0 which indicates whether the point is
an 'on' curve point, or an 'off' curve point.

=item x

The absolute x co-ordinate of the point.

=item y

The absolute y co-ordinate of the point

=back

=head2 Variables for compound glyphs (numberOfContours == -1):

=over 4

=item metric

This holds the component number (not its glyph number) of the component from
which the metrics for this glyph should be taken.

=item comps

This is an array of hashes for each component. Each hash has a number of
elements:

=over 4

=item glyph

The glyph number of the glyph which comprises this component of the composite.
NOTE: In some badly generated fonts, C<glyph> may contain a numerical value
but that glyph might not actually exist in the font file.  This could
occur in any glyph, but is particularly likely for glyphs that have
no strokes, such as SPACE, U+00A0 NO-BREAK SPACE, or 
U+200B ZERO WIDTH SPACE.

=item args

An array of two arguments which may be an x, y co-ordinate or two attachment
points (one on the base glyph the other on the component). See flags for details.

=item flag



( run in 2.030 seconds using v1.01-cache-2.11-cpan-97f6503c9c8 )