0.87 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 {
f0f6c630 8 $VERSION = "0.83";
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 {
61e5a61a
TC
25 my $class = shift;
26 my %opts =
27 (
28 color => Imager::Color->new(255, 0, 0),
29 size => 15,
30 @_,
31 );
718b8c97
TC
32
33 return bless \%opts, $class;
34}
35
36sub _bounding_box {
37 my ($self, %opts) = @_;
38
39 my @bbox = i_wf_bbox($self->{face}, $opts{size}, $opts{string}, $opts{utf8});
40}
41
42sub _draw {
43 my $self = shift;
44
45 my %input = @_;
46 if (exists $input{channel}) {
47 i_wf_cp($self->{face}, $input{image}{IMG}, $input{x}, $input{'y'},
48 $input{channel}, $input{size},
49 $input{string}, $input{align}, $input{aa}, $input{utf8});
50 }
51 else {
52 i_wf_text($self->{face}, $input{image}{IMG}, $input{x},
53 $input{'y'}, $input{color}, $input{size},
54 $input{string}, $input{align}, $input{aa}, $input{utf8});
55 }
8d14daab
TC
56
57 return 1;
718b8c97
TC
58}
59
60
61sub utf8 {
62 return 1;
63}
64
651;
66
67__END__
68
69=head1 NAME
70
71Imager::Font::W32 - font support using C<GDI> on Win32
72
73=head1 SYNOPSIS
74
75 use Imager;
76
77 my $img = Imager->new;
78 my $font = Imager::Font->new(face => "Arial", type => "w32");
79
80 $img->string(... font => $font);
81
82=head1 DESCRIPTION
83
84This provides font support on Win32.
85
86=head1 CAVEATS
87
88Unfortunately, older versions of Imager would install
89Imager::Font::Win32 even if Win32 wasn't available, and if no font was
90created would succeed in loading the module. This means that an
91existing Win32.pm could cause a probe success for Win32 fonts, so I've
92renamed it.
93
94=head1 AUTHOR
95
5b480b14 96Tony Cook <tonyc@cpan.org>
718b8c97
TC
97
98=head1 SEE ALSO
99
100Imager, Imager::Font.
101
102=cut