/usr/share/perl5/Graphics/Primitive/Font.pm is in libgraphics-primitive-perl 0.61-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | package Graphics::Primitive::Font;
use Moose;
use MooseX::Storage;
use Moose::Util::TypeConstraints;
with 'MooseX::Clone';
with Storage (format => 'JSON', io => 'File');
enum 'Graphics::Primitive::Font::AntialiasModes' => (
qw(default none gray subpixel)
);
enum 'Graphics::Primitive::Font::HintMetrics' => (
'default', 'off', 'on'
);
enum 'Graphics::Primitive::Font::HintStyles' => (
'default', 'none', 'slight', 'medium', 'full'
);
enum 'Graphics::Primitive::Font::Slants' => (
'normal', 'italic', 'oblique'
);
enum 'Graphics::Primitive::Font::SubpixelOrders' => (
qw(default rgb bgr vrgb vbgr)
);
enum 'Graphics::Primitive::Font::Variants' => (
'normal', 'small-caps'
);
enum 'Graphics::Primitive::Font::Weights' => (
'normal', 'bold'
);
has 'antialias_mode' => (
is => 'rw',
isa => 'Graphics::Primitive::Font::AntialiasModes',
default => 'default'
);
has 'family' => (
is => 'rw',
isa => 'Str',
default => 'Sans'
);
has 'hint_metrics' => (
is => 'rw',
isa => 'Graphics::Primitive::Font::HintMetrics',
default => 'default'
);
has 'hint_style' => (
is => 'rw',
isa => 'Graphics::Primitive::Font::HintStyles',
default => 'default'
);
has 'size' => (
is => 'rw',
isa => 'Num',
default => sub { 12 }
);
has 'slant' => (
is => 'rw',
isa => 'Graphics::Primitive::Font::Slants',
default => 'normal'
);
has 'subpixel_order' => (
is => 'rw',
isa => 'Graphics::Primitive::Font::SubpixelOrders',
default => 'default'
);
has 'variant' => (
is => 'rw',
isa => 'Graphics::Primitive::Font::Variants',
default => 'normal'
);
has 'weight' => (
is => 'rw',
isa => 'Graphics::Primitive::Font::Weights',
default => 'normal'
);
__PACKAGE__->meta->add_method('face' => __PACKAGE__->can('family'));
sub derive {
my ($self, $args) = @_;
return unless ref($args) eq 'HASH';
my $new = $self->clone;
foreach my $key (keys %{ $args }) {
$new->$key($args->{$key}) if($new->can($key));
}
return $new;
}
__PACKAGE__->meta->make_immutable;
no Moose;
1;
__END__
=head1 NAME
Graphics::Primitive::Font - Text styling
=head1 DESCRIPTION
Graphics::Primitive::Font represents the various options that are available
when rendering text. The options here may or may not have an effect on your
rendering. They represent a cross-section of the features provided by
various drivers. Setting them should B<not> break anything, but may not
have an effect if the driver doesn't understand the option.
=head1 SYNOPSIS
use Graphics::Primitive::Font;
my $font = Graphics::Primitive::Font->new({
family => 'Arial',
size => 12,
slant => 'normal'
});
=head1 METHODS
=head2 Constructor
=over 4
=back
=head1 Attributes
=head2 antialias_modes
Set the antialiasing mode for this font. Possible values are default, none,
gray and subpixel.
=head2 family
Set this font's family.
=head2 hint_metrics
Controls whether to hint font metrics. Hinting means quantizing them so that
they are integer values in device space. This improves the consistency of
letter and line spacing, however it also means that text will be laid out
differently at different zoom factors. May not be supported by all drivers.
=head2 hint_style
Set the the type of hinting to do on font outlines. Hinting is the process of
fitting outlines to the pixel grid in order to improve the appearance of the
result. Since hinting outlines involves distorting them, it also reduces the
faithfulness to the original outline shapes. Not all of the outline hinting
styles are supported by all drivers. Options are default, none, slight,
medium and full.
=head2 size
Set/Get the size of this font.
=head2 slant
Set/Get the slant of this font. Valid values are normal, italic and oblique.
=head2 subpixel_order
Set the order of color elements within each pixel on the display device when
rendering with subpixel antialiasing. Value values are default, rgb, bgr,
vrgb and vbgr.
=head2 variant
Set/Get the variant of this font. Valid values are normal or small-caps.
=head2 weight
Set/Get the weight of this font. Value valies are normal and bold.
=head1 METHODS
=head2 new
Creates a new Graphics::Primitive::Font.
=head2 derive
Clone this font but change one or more of it's attributes by passing in a
hashref of options:
my $new = $font->derive({ attr => $newvalue });
The returned font will be identical to the cloned one, save the attributes
specified.
=head1 AUTHOR
Cory Watson, C<< <gphat@cpan.org> >>
=head1 COPYRIGHT & LICENSE
Copyright 2008-2010 by Cory G Watson.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
|