| 1 | package Font::TTF::Features::Size; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Font::TTF::Features::Size - Class for Size Feature Parameters | ||
| 6 | |||
| 7 | =head1 DESCRIPTION | ||
| 8 | |||
| 9 | Handles the Feature Parameters valus for Size features | ||
| 10 | |||
| 11 | =head1 INSTANCE VARIABLES | ||
| 12 | |||
| 13 | =over 4 | ||
| 14 | |||
| 15 | =item INFILE | ||
| 16 | |||
| 17 | The read file handle | ||
| 18 | |||
| 19 | =item OFFSET | ||
| 20 | |||
| 21 | Location of the file in the input file | ||
| 22 | |||
| 23 | =item DesignSize | ||
| 24 | |||
| 25 | Design Size in decipoints | ||
| 26 | |||
| 27 | =item SubFID | ||
| 28 | |||
| 29 | Identifier for the fonts in a subfamily | ||
| 30 | |||
| 31 | =item SubFNameID | ||
| 32 | |||
| 33 | The 'name' table name ID for the subfamily name | ||
| 34 | |||
| 35 | =item MinSize | ||
| 36 | |||
| 37 | Bottom end of recomended usage size range | ||
| 38 | |||
| 39 | =item MaxSize | ||
| 40 | |||
| 41 | Top end of recomended usage size range | ||
| 42 | |||
| 43 | |||
| 44 | =back | ||
| 45 | |||
| 46 | =head1 METHODS | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | use Font::TTF::Utils; | ||
| 51 | use strict; | ||
| 52 | |||
| 53 | =head2 $t->read | ||
| 54 | |||
| 55 | Reads the Feature Params | ||
| 56 | |||
| 57 | =cut | ||
| 58 | |||
| 59 | sub read | ||
| 60 | { | ||
| 61 | my ($self) = @_; | ||
| 62 | my ($fh) = $self->{' INFILE'}; | ||
| 63 | my ($off) = $self->{' OFFSET'}; | ||
| 64 | my $dat; | ||
| 65 | $fh->seek($off, 0); | ||
| 66 | $fh->read($dat, 10); | ||
| 67 | |||
| 68 | ( $self->{'DesignSize'} | ||
| 69 | ,$self->{'SubFID'} | ||
| 70 | ,$self->{'SubFNameID'} | ||
| 71 | ,$self->{'MinSize'} | ||
| 72 | ,$self->{'MaxSize'} ) = TTF_Unpack("S*", $dat); | ||
| 73 | |||
| 74 | return $self; | ||
| 75 | } | ||
| 76 | |||
| 77 | =head2 $t->out($fh) | ||
| 78 | |||
| 79 | Writes the FeatureParams table to the output | ||
| 80 | |||
| 81 | =cut | ||
| 82 | |||
| 83 | sub out | ||
| 84 | { | ||
| 85 | my ($self, $fh) = @_; | ||
| 86 | |||
| 87 | $fh->print(TTF_Pack("S*" | ||
| 88 | ,$self->{'DesignSize'} | ||
| 89 | ,$self->{'SubFID'} | ||
| 90 | ,$self->{'SubFNameID'} | ||
| 91 | ,$self->{'MinSize'} | ||
| 92 | ,$self->{'MaxSize'} )); | ||
| 93 | $self; | ||
| 94 | } | ||
| 95 | |||
| 96 | =head2 Font::TTF::Features::Sset->new() | ||
| 97 | |||
| 98 | Creates a new FeatureParams object. Table instance variables are passed in | ||
| 99 | at this point as an associative array. | ||
| 100 | |||
| 101 | =cut | ||
| 102 | |||
| 103 | sub new | ||
| 104 | { | ||
| 105 | my ($class,%parms) = @_; | ||
| 106 | my ($self) = {}; | ||
| 107 | my ($p); | ||
| 108 | foreach $p (keys %parms) | ||
| 109 | { $self->{" $p"} = $parms{$p}; } | ||
| 110 | bless $self, $class; | ||
| 111 | } | ||
| 112 | |||
| 113 | sub out_xml | ||
| 114 | { | ||
| 115 | } | ||
| 116 | |||
| 117 | 1; | ||
| 118 | |||
| 119 | =head1 AUTHOR | ||
| 120 | |||
| 121 | David Raymond L<http://scripts.sil.org/FontUtils>. | ||
| 122 | |||
| 123 | =head1 LICENSING | ||
| 124 | |||
| 125 | Copyright (c) 1998-2016, SIL International (http://www.sil.org) | ||
| 126 | |||
| 127 | This module is released under the terms of the Artistic License 2.0. | ||
| 128 | For details, see the full text of the license in the file LICENSE. | ||
| 129 | |||
| 130 | =cut | ||
| 131 |