Font::TTF::OpenTypeLigatures - Transforms OpenType glyphs based on GSUB tables
Version 0.01
use Font::TTF::OpenTypeLigatures; my $foo = Font::TTF::OpenTypeLigatures->new($fontfile, %options); @glyph_ids = $foo->substitute(@glyph_ids); ...
This module is a building block for fine typography systems implemented in Perl. It reads the GSUB table of OpenType fonts to transform glyphs based on selected OpenType features. The most common use of this is to implement ligatures, but OpenType supports a variety of features such as alternates, old-style numbers, non-Roman contextual substitutions and so on.
The constructor takes a font file path and a set of options. The options will determine which substitutions are performed. The default options will substitute ligatures in Latin-script texts. You may supply:
Four-letter code for the script in which your text is written. (See http://www.microsoft.com/typography/developers/opentype/scripttags.aspx for a list of these.)
Three-letter language tag. If this is not given, or there are no special features for this language, the default language for the script is used.
This is a regular expression matching the features you want to support. The default is liga.
liga
If there are any problems, the constructor will die with an error message.
This performs contextual substitution on a list of numeric glyph IDs, returning a substituted list.
my $substitutor = $self->stream( \&output ); for (@glyphids) { $substitutor->($_) }
This creates a stateful closure subroutine which acts as a glyph-by-glyph substitution stream. Once a substitution is processed, or no substitution is needed for the glyph ID stream, the closure calls the provided output subroutine.
This allows you to interpose the stream in between an input and output mechanism, and not worry about maintaining ligature substitution state yourself.
Passing -1 to the substitutor drains the stream.
Simon Cozens, <simon at cpan.org>
<simon at cpan.org>
Please report any bugs or feature requests to bug-font-ttf-opentypeligatures at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Font-TTF-OpenTypeLigatures. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-font-ttf-opentypeligatures at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Font::TTF::OpenTypeLigatures
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Font-TTF-OpenTypeLigatures
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Font-TTF-OpenTypeLigatures
CPAN Ratings
http://cpanratings.perl.org/d/Font-TTF-OpenTypeLigatures
Search CPAN
http://search.cpan.org/dist/Font-TTF-OpenTypeLigatures/
Copyright 2011 Simon Cozens.
This program is released under the following license: Perl
To install Font::TTF::OpenTypeLigatures, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Font::TTF::OpenTypeLigatures
CPAN shell
perl -MCPAN -e shell install Font::TTF::OpenTypeLigatures
For more information on module installation, please visit the detailed CPAN module installation guide.