| 1 | package Graphics::Primitive::Font; | ||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use MooseX::Storage; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use Moose::Util::TypeConstraints; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | with 'MooseX::Clone'; | |||||||||||||||||||||||||||
| 7 | 2 | with Storage (format => 'JSON', io => 'File'); | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 2 | enum 'Graphics::Primitive::Font::AntialiasModes' => [ | |||||||||||||||||||||||||||
| 10 | qw(default none gray subpixel) | ||||||||||||||||||||||||||||
| 11 | ]; | ||||||||||||||||||||||||||||
| 12 | 2 | enum 'Graphics::Primitive::Font::HintMetrics' => [ | |||||||||||||||||||||||||||
| 13 | 'default', 'off', 'on' | ||||||||||||||||||||||||||||
| 14 | ]; | ||||||||||||||||||||||||||||
| 15 | 2 | enum 'Graphics::Primitive::Font::HintStyles' => [ | |||||||||||||||||||||||||||
| 16 | 'default', 'none', 'slight', 'medium', 'full' | ||||||||||||||||||||||||||||
| 17 | ]; | ||||||||||||||||||||||||||||
| 18 | 2 | enum 'Graphics::Primitive::Font::Slants' => [ | |||||||||||||||||||||||||||
| 19 | 'normal', 'italic', 'oblique' | ||||||||||||||||||||||||||||
| 20 | ]; | ||||||||||||||||||||||||||||
| 21 | 2 | enum 'Graphics::Primitive::Font::SubpixelOrders' => [ | |||||||||||||||||||||||||||
| 22 | qw(default rgb bgr vrgb vbgr) | ||||||||||||||||||||||||||||
| 23 | ]; | ||||||||||||||||||||||||||||
| 24 | 2 | enum 'Graphics::Primitive::Font::Variants' => [ | |||||||||||||||||||||||||||
| 25 | 'normal', 'small-caps' | ||||||||||||||||||||||||||||
| 26 | ]; | ||||||||||||||||||||||||||||
| 27 | 2 | enum 'Graphics::Primitive::Font::Weights' => [ | |||||||||||||||||||||||||||
| 28 | 'normal', 'bold' | ||||||||||||||||||||||||||||
| 29 | ]; | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 2 | has 'antialias_mode' => ( | |||||||||||||||||||||||||||
| 32 | is => 'rw', | ||||||||||||||||||||||||||||
| 33 | isa => 'Graphics::Primitive::Font::AntialiasModes', | ||||||||||||||||||||||||||||
| 34 | default => 'default' | ||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||
| 36 | has 'family' => ( | ||||||||||||||||||||||||||||
| 37 | is => 'rw', | ||||||||||||||||||||||||||||
| 38 | isa => 'Str', | ||||||||||||||||||||||||||||
| 39 | 2 | ▶ | default => $ENV{GRAPHICS_PRIMITIVE_DEFAULT_FONT} || ($^O eq 'MSWin32'?'Arial':'Sans') | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$ENV{'GRAPHICS_PRIMITIVE_DEFAULT_FONT'} || ($^O eq 'MSWin32' ? 'Arial' : 'Sans')
MC/DC0%0/2
$ENV{'GRAPHICS_PRIMITIVE_DEFAULT_FONT'} || ($^O eq 'MSWin32' ? 'Arial' : 'Sans')
$ENV{'GRAPHICS_PRIMITIVE_DEFAULT_FONT'}
($^O eq 'MSWin32' ? 'Arial' : 'Sans')
Truth table33%1/3
A || B
A= $ENV{'GRAPHICS_PRIMITIVE_DEFAULT_FONT'}B= ($^O eq 'MSWin32' ? 'Arial' : 'Sans')
| |||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||
| 41 | 2 | has 'hint_metrics' => ( | |||||||||||||||||||||||||||
| 42 | is => 'rw', | ||||||||||||||||||||||||||||
| 43 | isa => 'Graphics::Primitive::Font::HintMetrics', | ||||||||||||||||||||||||||||
| 44 | default => 'default' | ||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||
| 46 | 2 | has 'hint_style' => ( | |||||||||||||||||||||||||||
| 47 | is => 'rw', | ||||||||||||||||||||||||||||
| 48 | isa => 'Graphics::Primitive::Font::HintStyles', | ||||||||||||||||||||||||||||
| 49 | default => 'default' | ||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||
| 51 | has 'size' => ( | ||||||||||||||||||||||||||||
| 52 | is => 'rw', | ||||||||||||||||||||||||||||
| 53 | isa => 'Num', | ||||||||||||||||||||||||||||
| 54 | 1 | ▶ | default => sub { 12 } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 55 | 2 | ); | |||||||||||||||||||||||||||
| 56 | 2 | has 'slant' => ( | |||||||||||||||||||||||||||
| 57 | is => 'rw', | ||||||||||||||||||||||||||||
| 58 | isa => 'Graphics::Primitive::Font::Slants', | ||||||||||||||||||||||||||||
| 59 | default => 'normal' | ||||||||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||||||||
| 61 | 2 | has 'subpixel_order' => ( | |||||||||||||||||||||||||||
| 62 | is => 'rw', | ||||||||||||||||||||||||||||
| 63 | isa => 'Graphics::Primitive::Font::SubpixelOrders', | ||||||||||||||||||||||||||||
| 64 | default => 'default' | ||||||||||||||||||||||||||||
| 65 | ); | ||||||||||||||||||||||||||||
| 66 | 2 | has 'variant' => ( | |||||||||||||||||||||||||||
| 67 | is => 'rw', | ||||||||||||||||||||||||||||
| 68 | isa => 'Graphics::Primitive::Font::Variants', | ||||||||||||||||||||||||||||
| 69 | default => 'normal' | ||||||||||||||||||||||||||||
| 70 | ); | ||||||||||||||||||||||||||||
| 71 | 2 | has 'weight' => ( | |||||||||||||||||||||||||||
| 72 | is => 'rw', | ||||||||||||||||||||||||||||
| 73 | isa => 'Graphics::Primitive::Font::Weights', | ||||||||||||||||||||||||||||
| 74 | default => 'normal' | ||||||||||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 2 | __PACKAGE__->meta->add_method('face' => __PACKAGE__->can('family')); | |||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 0 | ▶ | sub derive { | ||||||||||||||||||||||||||
|
Subroutine
derive: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 80 | 0 | my ($self, $args) = @_; | |||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | return unless ref($args) eq 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | 0 | my $new = $self->clone; | |||||||||||||||||||||||||||
| 84 | 0 | foreach my $key (keys %{ $args }) { | |||||||||||||||||||||||||||
| 85 | 0 | ▶ | $new->$key($args->{$key}) if($new->can($key)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | 0 | return $new; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 2 | ▶ | no Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 93 | 2 | 1; | |||||||||||||||||||||||||||
| 94 | __END__ | ||||||||||||||||||||||||||||