0.78 release
[imager.git] / W32 / W32.pm
CommitLineData
718b8c97
TC
1package Imager::Font::W32;
2use strict;
3use Imager;
4use vars qw($VERSION @ISA);
5@ISA = qw(Imager::Font);
6
7BEGIN {
893474f1 8 $VERSION = "0.78";
718b8c97
TC
9
10 eval {
11 require XSLoader;
12 XSLoader::load('Imager::Font::W32', $VERSION);
13 1;
14 } or do {
15 require DynaLoader;
16 push @ISA, 'DynaLoader';
17 bootstrap Imager::Font::W32 $VERSION;
18 };
19}
20
21# called by Imager::Font::new()
22# since Win32's HFONTs include the size information this
23# is just a stub
24sub new {
25 my ($class, %opts) = @_;
26
27 return bless \%opts, $class;
28}
29
30sub _bounding_box {
31 my ($self, %opts) = @_;
32
33 my @bbox = i_wf_bbox($self->{face}, $opts{size}, $opts{string}, $opts{utf8});
34}
35
36sub _draw {
37 my $self = shift;
38
39 my %input = @_;
40 if (exists $input{channel}) {
41 i_wf_cp($self->{face}, $input{image}{IMG}, $input{x}, $input{'y'},
42 $input{channel}, $input{size},
43 $input{string}, $input{align}, $input{aa}, $input{utf8});
44 }
45 else {
46 i_wf_text($self->{face}, $input{image}{IMG}, $input{x},
47 $input{'y'}, $input{color}, $input{size},
48 $input{string}, $input{align}, $input{aa}, $input{utf8});
49 }
50}
51
52
53sub utf8 {
54 return 1;
55}
56
571;
58
59__END__
60
61=head1 NAME
62
63Imager::Font::W32 - font support using C<GDI> on Win32
64
65=head1 SYNOPSIS
66
67 use Imager;
68
69 my $img = Imager->new;
70 my $font = Imager::Font->new(face => "Arial", type => "w32");
71
72 $img->string(... font => $font);
73
74=head1 DESCRIPTION
75
76This provides font support on Win32.
77
78=head1 CAVEATS
79
80Unfortunately, older versions of Imager would install
81Imager::Font::Win32 even if Win32 wasn't available, and if no font was
82created would succeed in loading the module. This means that an
83existing Win32.pm could cause a probe success for Win32 fonts, so I've
84renamed it.
85
86=head1 AUTHOR
87
88Tony Cook <tony@imager.perl.org>
89
90=head1 SEE ALSO
91
92Imager, Imager::Font.
93
94=cut