package Imager::Font;
-
+use 5.006;
use Imager::Color;
use strict;
-use vars qw($VERSION);
-$VERSION = "1.036";
+our $VERSION = "1.039";
# the aim here is that we can:
# - add file based types in one place: here
);
# this currently should only contain file based types, don't add w32
-my @priority = qw(t1 tt ft2 ifs);
+my @priority = qw(ft2 ifs);
sub new {
my $class = shift;
$box[0]+=$input{'x'};
$box[2]+=$input{'x'};
} elsif (@box && $input{'canon'}) {
- $box[3]-=$box[1]; # make it cannoical (ie (0,0) - (width, height))
+ $box[3]-=$box[1]; # make it canonical (ie (0,0) - (width, height))
$box[2]-=$box[0];
}
return @box;
=for stopwords TrueType FreeType
-This module handles creating Font objects used by Imager. The module
-also handles querying fonts for sizes and such. If both T1lib and
-FreeType were available at the time of compilation then Imager should
-be able to work with both TrueType fonts and t1 Postscript fonts. To
-check if Imager is t1 or TrueType capable you can use something like
-this:
-
- use Imager;
- print "Has truetype" if $Imager::formats{tt};
- print "Has t1 postscript" if $Imager::formats{t1};
- print "Has Win32 fonts" if $Imager::formats{w32};
- print "Has Freetype2" if $Imager::formats{ft2};
+This module manages, the font object returned by Imager::Font->new
+will typically be of a class derived from Imager::Font.
=over 4
=back
On success returns either the list of bounds, or a bounding box object
-object in scalar context. Returns an empty list or C<undef> on
-failure and sets an error message readable with C<< Imager->errstr >>.
+in scalar context. Returns an empty list or C<undef> on failure and
+sets an error message readable with C<< Imager->errstr >>.
+
+The transformation matrix set by L</transform()> has no effect on the
+result of this method - the bounds of the untransformed text is
+returned.
=item string()
increases as you move up, not image co-ordinates where y decreases as
you move up.
+C<transform()> has no effect on the results of L</bounding_box()>.
+
Returns true on success. Returns false on failure with the cause
readable from C<< Imager->errstr >>.
$x = pack("C*", 0xE2, 0x80, 0x90); # character code 0x2010 HYPHEN
-You need to be be careful with versions of perl that have UTF-8
+You need to be careful with versions of perl that have UTF-8
support, since your string may end up doubly UTF-8 encoded.
For example:
If you supply driver names that are not currently supported, they will
be ignored.
-Imager supports both T1Lib and FreeType 2 for working with Type 1
-fonts, but currently only T1Lib does any caching, so by default T1Lib
-is given a higher priority. Since Imager's FreeType 2 support can also
-do font transformations, you may want to give that a higher priority:
+Note that by default the priority list no longer includes C<tt> and
+C<t1>, so typically you will need to have L<Imager::Font::FT2>
+installed to create fonts with Imager.
my @old = Imager::Font->priorities(qw(tt ft2 t1));