| 1 | package Image::WMF::Font; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Image::WMF::Colour; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Image::WMF::Constants; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 8 | 1 | my ($class,$height,$width,$esc,$ori,$weight,$italic,$underline, | |||||||||
| 9 | $strikeout,$charset,$outprecision,$clipprecision,$quality, | ||||||||||
| 10 | $pitchandfamily,$facename) = @_; | ||||||||||
| 11 | 1 | my $obj = bless { | |||||||||
| 12 | _height => -12, | ||||||||||
| 13 | _width => 0, | ||||||||||
| 14 | _esc => 0, | ||||||||||
| 15 | _ori => 0, | ||||||||||
| 16 | _weigth => 0, | ||||||||||
| 17 | _italic => 0, | ||||||||||
| 18 | _underline => 0, | ||||||||||
| 19 | _strikeout => 0, | ||||||||||
| 20 | _charset => 0, | ||||||||||
| 21 | _outprecision => 0, | ||||||||||
| 22 | _clipprecision => 0, | ||||||||||
| 23 | _quality => 0, | ||||||||||
| 24 | _pitchandfamily => 0, | ||||||||||
| 25 | _facename => "Arial", | ||||||||||
| 26 | _font => undef, # packed font structure | ||||||||||
| 27 | }, $class; | ||||||||||
| 28 | 1 | $obj->_initialise($height,$width,$esc,$ori,$weight,$italic,$underline, | |||||||||
| 29 | $strikeout,$charset,$outprecision,$clipprecision,$quality, | ||||||||||
| 30 | $pitchandfamily,$facename); | ||||||||||
| 31 | 1 | return $obj; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 1 | ▶ | sub setFont { | ||||||||
|
Subroutine
setFont: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 35 | 1 | my ($self,$height,$width,$esc,$ori,$weight,$italic,$underline, | |||||||||
| 36 | $strikeout,$charset,$outprecision,$clipprecision,$quality, | ||||||||||
| 37 | $pitchandfamily,$facename) = @_; | ||||||||||
| 38 | 1 | $self->{'_height'} = $height; | |||||||||
| 39 | 1 | $self->{'_width'} = $width; | |||||||||
| 40 | 1 | $self->{'_esc'} = $esc; | |||||||||
| 41 | 1 | $self->{'_ori'} = $ori; | |||||||||
| 42 | 1 | $self->{'_weight'} = $weight; | |||||||||
| 43 | 1 | $self->{'_italic'} = $italic; | |||||||||
| 44 | 1 | $self->{'_underline'} = $underline; | |||||||||
| 45 | 1 | $self->{'_strikeout'} = $strikeout; | |||||||||
| 46 | 1 | $self->{'_charset'} = $charset; #byte | |||||||||
| 47 | 1 | $self->{'_outprecision'} = $outprecision; #byte | |||||||||
| 48 | 1 | $self->{'_clipprecision'} = $clipprecision; #byte | |||||||||
| 49 | 1 | $self->{'_quality'} = $quality; #byte | |||||||||
| 50 | 1 | $self->{'_pitchandfamily'} = $pitchandfamily; #byte | |||||||||
| 51 | 1 | $self->{'_facename'} = $facename; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 0 | ▶ | sub isItalic { | ||||||||
|
Subroutine
isItalic: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 55 | 0 | my ($self) = @_; | |||||||||
| 56 | 0 | return($self->{'_italic'}); | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | 0 | ▶ | sub isBold { | ||||||||
|
Subroutine
isBold: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 60 | 0 | my ($self) = @_; | |||||||||
| 61 | 0 | ▶ | if ($self->{'_weight'} >=700){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | 0 | return(1); | |||||||||
| 63 | } else { | ||||||||||
| 64 | 0 | return(0) | |||||||||
| 65 | } | ||||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | 0 | ▶ | sub getFace { | ||||||||
|
Subroutine
getFace: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 69 | 0 | my ($self) = @_; | |||||||||
| 70 | 0 | return($self->{'_facename'}); | |||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | 0 | ▶ | sub getSize { | ||||||||
|
Subroutine
getSize: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 74 | 0 | my ($self) = @_; | |||||||||
| 75 | 0 | return($self->{'_height'}); | |||||||||
| 76 | } | ||||||||||
| 77 | |||||||||||
| 78 | 0 | ▶ | sub height { | ||||||||
|
Subroutine
height: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 79 | 0 | my ($self) = @_; | |||||||||
| 80 | 0 | return($self->getSize()); | |||||||||
| 81 | } | ||||||||||
| 82 | |||||||||||
| 83 | 0 | ▶ | sub width { | ||||||||
|
Subroutine
width: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 84 | 0 | my ($self) = @_; | |||||||||
| 85 | 0 | return($self->{'_width'}); | |||||||||
| 86 | } | ||||||||||
| 87 | |||||||||||
| 88 | 0 | ▶ | sub getWeight { | ||||||||
|
Subroutine
getWeight: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 89 | 0 | my ($self) = @_; | |||||||||
| 90 | 0 | return($self->{'_weight'}); | |||||||||
| 91 | } | ||||||||||
| 92 | |||||||||||
| 93 | 0 | ▶ | sub toByte { | ||||||||
|
Subroutine
toByte: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 94 | 0 | my ($self, $byte) = @_; | |||||||||
| 95 | 0 | $b = unpack("C*", $byte); | |||||||||
| 96 | 0 | return($byte); | |||||||||
| 97 | } | ||||||||||
| 98 | |||||||||||
| 99 | 1 | ▶ | sub _initialise { | ||||||||
|
Subroutine
_initialise: called CC=2 SCAR=7.6
| |||||||||||
| 100 | 1 | my ($self) = shift; | |||||||||
| 101 | 1 | ▶ | if (scalar(@_) != 14){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 102 | 0 | die("Error: parameter mismatch while creating font!\n"); | |||||||||
| 103 | } | ||||||||||
| 104 | 1 | $self->setFont(@_); | |||||||||
| 105 | } | ||||||||||
| 106 | |||||||||||
| 107 | 1 | 1; | |||||||||