0.84_01 development 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 {
fa61d195 8 $VERSION = "0.80";
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 }
8d14daab
TC
50
51 return 1;
718b8c97
TC
52}
53
54
55sub utf8 {
56 return 1;
57}
58
591;
60
61__END__
62
63=head1 NAME
64
65Imager::Font::W32 - font support using C<GDI> on Win32
66
67=head1 SYNOPSIS
68
69 use Imager;
70
71 my $img = Imager->new;
72 my $font = Imager::Font->new(face => "Arial", type => "w32");
73
74 $img->string(... font => $font);
75
76=head1 DESCRIPTION
77
78This provides font support on Win32.
79
80=head1 CAVEATS
81
82Unfortunately, older versions of Imager would install
83Imager::Font::Win32 even if Win32 wasn't available, and if no font was
84created would succeed in loading the module. This means that an
85existing Win32.pm could cause a probe success for Win32 fonts, so I've
86renamed it.
87
88=head1 AUTHOR
89
5b480b14 90Tony Cook <tonyc@cpan.org>
718b8c97
TC
91
92=head1 SEE ALSO
93
94Imager, Imager::Font.
95
96=cut