|
NAMEPDF::API3::Compat::API2::Basic::TTF::Glyph - Holds a single glyph's informationDESCRIPTIONThis 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.INSTANCE VARIABLESIn addition to the named variables in a glyph header ("xMin" etc.), there are also all capital instance variables for holding working information, mostly from the location table.The standard attributes each glyph has are: numberOfContours xMin yMin xMax yMax There are also other, derived, instance variables for each glyph which are read when the whole glyph is read (via "read_dat"):
In addition there are other attribute like instance variables for simple glyphs: For each contour there is:
There are also a number of arrays indexed by point number
For composite glyphs there are other variables
The private instance variables are:
EditingIf you want to edit a glyph in some way, then you should read_dat the glyph, then make your changes and then update the glyph or set the $g->{' isdirty'} variable. It is the application's duty to ensure that the following instance variables are correct, from which update will calculate the rest, including the bounding box information.numPoints numberOfContours endPoints x, y, flags (only flags bit 0) instLen hints For components, the numPoints, x, y, endPoints & flags are not required but the following information is required for each component. flag (bits 2, 10, 11, 12) glyph args scale metric (glyph instance variable) METHODSPDF::API3::Compat::API2::Basic::TTF::Glyph->new(%parms)Creates a new glyph setting various instance variables$g->readReads the header component of the glyph (bounding box, etc.) and also the glyph content, but into a data field rather than breaking it down into its constituent structures. Use read_dat for this.$g->read_datReads the contents of the glyph (components and curves, etc.) from the memory store "DAT" into structures within the object. Then, to indicate where the master form of the data is, it deletes the "DAT" instance variable.$g->out($fh)Writes the glyph data to outfile$g->out_xml($context, $depth)Outputs an XML description of the glyph$g->updateGenerates a "$self-"{'DAT'}> from the internal structures, if the data has been read into structures in the first place. If you are building a glyph from scratch you will need to set the instance variable ' read' to 2 (or something > 1) for the update to work.$g->update_bboxUpdates the bounding box for this glyph according to the points in the glyph$g->maxInfoReturns lots of information about a glyph so that the "maxp" table can update itself.$g->emptyEmpties the glyph of all information to the level of not having been read. Useful for saving memory in apps with many glyphs being read$g->get_pointsThis method creates point information for a compound glyph. The information is stored in the same place as if the glyph was not a compound, but since numberOfContours is negative, the glyph is still marked as being a compound$g->get_refsReturns an array of all the glyph ids that are used to make up this glyph. That is all the compounds and their references and so on. If this glyph is not a compound, then returns an empty arrayBUGS
AUTHORMartin Hosken Martin_Hosken@sil.org. See PDF::API3::Compat::API2::Basic::TTF::Font for copyright and licensing.
Visit the GSP FreeBSD Man Page Interface. |