]> git.imager.perl.org - imager.git/blobdiff - lib/Imager/Font.pm
eliminate use vars
[imager.git] / lib / Imager / Font.pm
index c97423c9b1e76754b67ab1a4eb51c0c37b6edcdd..f6c2473f754eba97e20e99686a2ee5cd98a66025 100644 (file)
@@ -1,10 +1,9 @@
 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
@@ -45,7 +44,7 @@ my %drivers =
   );
 
 # 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;
@@ -260,7 +259,7 @@ sub bounding_box {
       $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;
@@ -405,18 +404,8 @@ Imager::Font - Font handling for Imager.
 
 =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
 
@@ -671,8 +660,12 @@ and height of the text instead.
 =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()
 
@@ -815,6 +808,8 @@ Note that the transformation is done in font co-ordinates where y
 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 >>.
 
@@ -990,7 +985,7 @@ For example:
 
  $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:
@@ -1030,10 +1025,9 @@ You can set new priorities and save the old priorities with:
 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));