X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/e316fc14bef26f958937aec0e6854b61f71a3b34..09dded3d8606e8e4406fffcf477ceb4a1c97fee2:/librarian/font-optimizer/ext/Font-TTF/lib/Font/TTF/Prep.pm diff --git a/librarian/font-optimizer/ext/Font-TTF/lib/Font/TTF/Prep.pm b/librarian/font-optimizer/ext/Font-TTF/lib/Font/TTF/Prep.pm new file mode 100644 index 0000000..453cf5a --- /dev/null +++ b/librarian/font-optimizer/ext/Font-TTF/lib/Font/TTF/Prep.pm @@ -0,0 +1,89 @@ +package Font::TTF::Prep; + +=head1 NAME + +Font::TTF::Prep - Preparation hinting program. Called when ppem changes + +=head1 DESCRIPTION + +This is a minimal class adding nothing beyond a table, but is a repository +for prep type information for those processes brave enough to address hinting. + +=cut + +use strict; +use vars qw(@ISA $VERSION); +use Font::TTF::Utils; + +@ISA = qw(Font::TTF::Table); + +$VERSION = 0.0001; + + +=head2 $t->read + +Reads the data using C. + +=cut + +sub read +{ + $_[0]->read_dat; + $_[0]->{' read'} = 1; +} + + +=head2 $t->out_xml($context, $depth) + +Outputs Prep program as XML + +=cut + +sub out_xml +{ + my ($self, $context, $depth) = @_; + my ($fh) = $context->{'fh'}; + my ($dat); + + $self->read; + $dat = Font::TTF::Utils::XML_binhint($self->{' dat'}); + $dat =~ s/\n(?!$)/\n$depth$context->{'indent'}/omg; + $fh->print("$depth\n"); + $fh->print("$depth$context->{'indent'}$dat"); + $fh->print("$depth\n"); + $self; +} + + +=head2 $t->XML_end($context, $tag, %attrs) + +Parse all that hinting code + +=cut + +sub XML_end +{ + my ($self) = shift; + my ($context, $tag, %attrs) = @_; + + if ($tag eq 'code') + { + $self->{' dat'} = Font::TTF::Utils::XML_hintbin($context->{'text'}); + return $context; + } else + { return $self->SUPER::XML_end(@_); } +} + +1; + +=head1 BUGS + +None known + +=head1 AUTHOR + +Martin Hosken Martin_Hosken@sil.org. See L for copyright and +licensing. + +=cut +