Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 96 lines (67 sloc) 1.783 kb
718b8c9 move win32 font support in a new directory, and use Imager::Probe
Tony Cook authored
1 package Imager::Font::W32;
2 use strict;
3 use Imager;
4 use vars qw($VERSION @ISA);
5 @ISA = qw(Imager::Font);
6
7 BEGIN {
a591936 @tonycoz [rt #75560] don't fallback to using DynaLoader when XSLoader fails
authored
8 $VERSION = "0.84";
718b8c9 move win32 font support in a new directory, and use Imager::Probe
Tony Cook authored
9
a591936 @tonycoz [rt #75560] don't fallback to using DynaLoader when XSLoader fails
authored
10 require XSLoader;
11 XSLoader::load('Imager::Font::W32', $VERSION);
718b8c9 move win32 font support in a new directory, and use Imager::Probe
Tony Cook authored
12 }
13
14 # called by Imager::Font::new()
15 # since Win32's HFONTs include the size information this
16 # is just a stub
17 sub new {
61e5a61 @tonycoz [rt #71469] make default text color non-transparent
authored
18 my $class = shift;
19 my %opts =
20 (
21 color => Imager::Color->new(255, 0, 0),
22 size => 15,
23 @_,
24 );
718b8c9 move win32 font support in a new directory, and use Imager::Probe
Tony Cook authored
25
26 return bless \%opts, $class;
27 }
28
29 sub _bounding_box {
30 my ($self, %opts) = @_;
31
32 my @bbox = i_wf_bbox($self->{face}, $opts{size}, $opts{string}, $opts{utf8});
33 }
34
35 sub _draw {
36 my $self = shift;
37
38 my %input = @_;
39 if (exists $input{channel}) {
40 i_wf_cp($self->{face}, $input{image}{IMG}, $input{x}, $input{'y'},
41 $input{channel}, $input{size},
42 $input{string}, $input{align}, $input{aa}, $input{utf8});
43 }
44 else {
45 i_wf_text($self->{face}, $input{image}{IMG}, $input{x},
46 $input{'y'}, $input{color}, $input{size},
47 $input{string}, $input{align}, $input{aa}, $input{utf8});
48 }
8d14daa @tonycoz switch to using size_t and i_img_dim strictly
authored
49
50 return 1;
718b8c9 move win32 font support in a new directory, and use Imager::Probe
Tony Cook authored
51 }
52
53
54 sub utf8 {
55 return 1;
56 }
57
58 1;
59
60 __END__
61
62 =head1 NAME
63
64 Imager::Font::W32 - font support using C<GDI> on Win32
65
66 =head1 SYNOPSIS
67
68 use Imager;
69
70 my $img = Imager->new;
71 my $font = Imager::Font->new(face => "Arial", type => "w32");
72
73 $img->string(... font => $font);
74
75 =head1 DESCRIPTION
76
77 This provides font support on Win32.
78
79 =head1 CAVEATS
80
81 Unfortunately, older versions of Imager would install
82 Imager::Font::Win32 even if Win32 wasn't available, and if no font was
83 created would succeed in loading the module. This means that an
84 existing Win32.pm could cause a probe success for Win32 fonts, so I've
85 renamed it.
86
87 =head1 AUTHOR
88
5b480b1 @tonycoz replace (imager|tony)@imager.perl.org with tonyc@cpan.org
authored
89 Tony Cook <tonyc@cpan.org>
718b8c9 move win32 font support in a new directory, and use Imager::Probe
Tony Cook authored
90
91 =head1 SEE ALSO
92
93 Imager, Imager::Font.
94
95 =cut
Something went wrong with that request. Please try again.