PDF::API2::TTF::ttopen - Opentype superclass for standard Opentype lookup based tables (GSUB and GPOS)
Handles all the script, lang, feature, lookup stuff for a PDF::API2::TTF::Gsub/PDF::API2::TTF::Gpos table leaving the class specifics to the subclass
The instance variables of an opentype table form a complex sub-module hierarchy.
Version | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This contains the version of the table as a floating point number | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SCRIPTS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The scripts list is a hash of script tags. Each script tag (of the form $t->{'SCRIPTS'}{$tag}) has information below it.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FEATURES | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The features section of instance variables corresponds to the feature table in the opentype table.
The rest of the FEATURES variable is itself a hash based on the feature tag for each feature. Each feature has the following structure:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LOOKUP | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This variable is an array of lookups in order and is indexed via the features of a language of a script. Each lookup contains subtables and other information:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CLASS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
For those lookups which use class categories rather than glyph ids for matching this is the offset to the class definition used to categories glyphs in the match string. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
PRE_CLASS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This is the offset to the class definition for the before match glyphs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
POST_CLASS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This is the offset to the class definition for the after match glyphs. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ACTION_TYPE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This string holds the type of information held in the ACTION variable of a RULE. It is subclass specific. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MATCH_TYPE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This holds the type of information in the MATCH array of a RULE. This is subclass specific. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ADJUST | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This corresponds to a single action for all items in a coverage table. The meaning is subclass specific. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CACHE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This key starts with a space A hash of other tables (such as coverage tables, classes, anchors, device tables) based on the offset given in the subtable to that other information. Note that the documentation is particularly unhelpful here in that such tables are given as offsets relative to the beginning of the subtable not the whole GSUB table. This includes those items which are stored relative to another base within the subtable. |
Reads the table passing control to the subclass to handle the subtable specifics
This stub is to allow subclasses to read subtables of lookups in a table specific manner. A reference to the lookup is passed in along with the subtable index. The file is located at the start of the subtable to be read
Returns the lookup number for the extension table that allows access to 32-bit offsets.
Writes this Opentype table to the output calling $t->out_sub for each sub table at the appropriate point in the output. The assumption is that on entry the number of scripts, languages, features, lookups, etc. are all resolved and the relationships fixed. This includes a script's LANG_TAGS list and that all scripts and languages in their respective dictionaries either have a REFTAG or contain real data.
Asks the subclass to count the number of subtables for a particular lookup and to return that value. Used in out().
This stub is to allow subclasses to output subtables of lookups in a table specific manner. A reference to the lookup is passed in along with the subtable index. The file is located at the start of the subtable to be output
Most of these methods are used by subclasses for handling such things as coverage tables.
Internal function to copy the top level of a dictionary to create a new dictionary. Only the top level is copied.
Reads a coverage table and stores the results in $lookup->{' CACHE'}, that is, if it hasn't been read already.
Internal function to keep track of the local positioning of subobjects such as coverage and class definition tables, and their offsets. What happens is that the cache is a hash of sub objects indexed by the reference (using a string mashing of the reference name which is valid for the duration of the reference) and holds a list of locations in the output string which should be filled in with the offset to the sub object when the final string is output in out_final.
Uses tricks for Tie::Refhash
Internal function to actually output everything to the file handle given that now we know the offset to the first sub object to be output and which sub objects are to be output and what locations need to be updated, we can now generate everything. $cache_list is an array of two element arrays. The first element is a cache object, the second is an offset to be subtracted from each reference to that object made in the cache.
If $state is 1, then the output is not sent to the filehandle and the return value is the string to be output. If $state is absent or 0 then output is not limited by storing in a string first and the return value is "";
Internal method to read context (simple and chaining context) lookup subtables for the GSUB and GPOS table types. The assumed values for $type correspond to those for GSUB, so GPOS should adjust the values upon calling.
Provides shared behaviour between GSUB and GPOS tables during output for context (chained and simple) rules. In addition, support is provided here for type 4 GSUB tables, which are not used in GPOS. The value for $type corresponds to the type in a GSUB table so calling from GPOS should adjust the value accordingly.
* | |
No way to share cachable items (coverage tables, classes, anchors, device tables) across different lookups. The items are always output after the lookup and repeated if necessary. Within lookup sharing is possible. |
Martin Hosken Martin_Hosken@sil.org. See PDF::API2::TTF::Font for copyright and licensing.