| 1 | package Font::TTF::Prep; | ||||||||||
| 2 | |||||||||||
| 3 | =head1 NAME | ||||||||||
| 4 | |||||||||||
| 5 | Font::TTF::Prep - Preparation hinting program. Called when ppem changes | ||||||||||
| 6 | |||||||||||
| 7 | =head1 DESCRIPTION | ||||||||||
| 8 | |||||||||||
| 9 | This is a minimal class adding nothing beyond a table, but is a repository | ||||||||||
| 10 | for prep type information for those processes brave enough to address hinting. | ||||||||||
| 11 | |||||||||||
| 12 | =cut | ||||||||||
| 13 | |||||||||||
| 14 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 1 | ▶ | use vars qw(@ISA $VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 1 | ▶ | use Font::TTF::Utils; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | 1 | @ISA = qw(Font::TTF::Table); | |||||||||
| 19 | |||||||||||
| 20 | 1 | $VERSION = 0.0001; | |||||||||
| 21 | |||||||||||
| 22 | |||||||||||
| 23 | =head2 $t->read | ||||||||||
| 24 | |||||||||||
| 25 | Reads the data using C<read_dat>. | ||||||||||
| 26 | |||||||||||
| 27 | =cut | ||||||||||
| 28 | |||||||||||
| 29 | sub read | ||||||||||
| 30 | 2 | ▶ | { | ||||||||
|
Subroutine
read: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 31 | 2 | $_[0]->read_dat; | |||||||||
| 32 | 2 | $_[0]->{' read'} = 1; | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | |||||||||||
| 36 | =head2 $t->out_xml($context, $depth) | ||||||||||
| 37 | |||||||||||
| 38 | Outputs Prep program as XML | ||||||||||
| 39 | |||||||||||
| 40 | =cut | ||||||||||
| 41 | |||||||||||
| 42 | sub out_xml | ||||||||||
| 43 | 0 | ▶ | { | ||||||||
|
Subroutine
out_xml: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 44 | 0 | my ($self, $context, $depth) = @_; | |||||||||
| 45 | 0 | my ($fh) = $context->{'fh'}; | |||||||||
| 46 | 0 | my ($dat); | |||||||||
| 47 | |||||||||||
| 48 | 0 | $self->read; | |||||||||
| 49 | 0 | $dat = Font::TTF::Utils::XML_binhint($self->{' dat'}); | |||||||||
| 50 | 0 | $dat =~ s/\n(?!$)/\n$depth$context->{'indent'}/omg; | |||||||||
| 51 | 0 | $fh->print("$depth<code>\n"); | |||||||||
| 52 | 0 | $fh->print("$depth$context->{'indent'}$dat"); | |||||||||
| 53 | 0 | $fh->print("$depth</code>\n"); | |||||||||
| 54 | 0 | $self; | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | |||||||||||
| 58 | =head2 $t->XML_end($context, $tag, %attrs) | ||||||||||
| 59 | |||||||||||
| 60 | Parse all that hinting code | ||||||||||
| 61 | |||||||||||
| 62 | =cut | ||||||||||
| 63 | |||||||||||
| 64 | sub XML_end | ||||||||||
| 65 | 0 | ▶ | { | ||||||||
|
Subroutine
XML_end: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 66 | 0 | my ($self) = shift; | |||||||||
| 67 | 0 | my ($context, $tag, %attrs) = @_; | |||||||||
| 68 | |||||||||||
| 69 | 0 | ▶ | if ($tag eq 'code') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | { | ||||||||||
| 71 | 0 | $self->{' dat'} = Font::TTF::Utils::XML_hintbin($context->{'text'}); | |||||||||
| 72 | 0 | return $context; | |||||||||
| 73 | } else | ||||||||||
| 74 | 0 | { return $self->SUPER::XML_end(@_); } | |||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | 1 | 1; | |||||||||
| 78 | |||||||||||
| 79 | =head1 BUGS | ||||||||||
| 80 | |||||||||||
| 81 | None known | ||||||||||
| 82 | |||||||||||
| 83 | =head1 AUTHOR | ||||||||||
| 84 | |||||||||||
| 85 | Martin Hosken L<http://scripts.sil.org/FontUtils>. | ||||||||||
| 86 | |||||||||||
| 87 | |||||||||||
| 88 | =head1 LICENSING | ||||||||||
| 89 | |||||||||||
| 90 | Copyright (c) 1998-2016, SIL International (http://www.sil.org) | ||||||||||
| 91 | |||||||||||
| 92 | This module is released under the terms of the Artistic License 2.0. | ||||||||||
| 93 | For details, see the full text of the license in the file LICENSE. | ||||||||||
| 94 | |||||||||||
| 95 | |||||||||||
| 96 | |||||||||||
| 97 | =cut | ||||||||||
| 98 | |||||||||||
| 99 | |||||||||||