]> git.imager.perl.org - imager.git/blobdiff - lib/Imager/Font.pm
- add dfont to the list of extensions supported by ft2
[imager.git] / lib / Imager / Font.pm
index b21ae81f806afe41672d1b81b6d5a72d04412e0b..a101d98e9bc76bfe569fb38c07bb25964080a8d9 100644 (file)
@@ -23,7 +23,7 @@ my %drivers =
    ft2=>{
          class=>'Imager::Font::FreeType2',
          module=>'Imager/Font/FreeType2.pm',
-         files=>'.*\.(pfa|pfb|otf|ttf|fon|fnt)$',
+         files=>'.*\.(pfa|pfb|otf|ttf|fon|fnt|dfont)$',
         },
    ifs=>{
          class=>'Imager::Font::Image',
@@ -366,6 +366,7 @@ this:
 This creates a font object to pass to functions that take a font argument.
 
   $font = Imager::Font->new(file  => 'denmark.ttf',
+                            index => 0,
                            color => $blue,
                            size  => 30,
                            aa    => 1);
@@ -381,13 +382,17 @@ you can tell it explicitly by using the C<type> parameter:
   $t1font = Imager::Font->new(file => 'fruitcase', type => 't1');
   $ttfont = Imager::Font->new(file => 'arglebarf', type => 'tt');
 
+The C<index> parameter is used to select a single face from a font
+file containing more than one face, for example, from a Macintosh font
+suitcase or a .dfont file.
+
 If any of the C<color>, C<size> or C<aa> parameters are omitted when
 calling C<Imager::Font->new()> the they take the following values:
 
-
   color => Imager::Color->new(255, 0, 0, 0);  # this default should be changed
   size  => 15
   aa    => 0
+  index => 0
 
 To use Win32 fonts supply the facename of the font:
 
@@ -700,7 +705,7 @@ Imager::Font->new(file=>"arial.ttf", color=>$blue, aa=>1)
 Returns the internal name of the face.  Not all font types support
 this method yet.
 
-=item glyph_names(string=>$string [, utf8=>$utf8 ] );
+=item glyph_names(string=>$string [, utf8=>$utf8 ][, reliable_only=>0 ] );
 
 Returns a list of glyph names for each of the characters in the
 string.  If the character has no name then C<undef> is returned for
@@ -710,6 +715,13 @@ Some font files do not include glyph names, in this case Freetype 2
 will not return any names.  Freetype 1 can return standard names even
 if there are no glyph names in the font.
 
+Freetype 2 has an API function that returns true only if the font has
+"reliable glyph names", unfortunately this always returns false for
+TTF fonts.  This can avoid the check of this API by supplying
+C<reliable_only> as 0.  The consequences of using this on an unknown
+font may be unpredictable, since the Freetype documentation doesn't
+say how those name tables are unreliable, or how FT2 handles them.
+
 Both Freetype 1.x and 2.x allow support for glyph names to not be
 included.
 
@@ -809,8 +821,7 @@ You need to modify this class to add new font types.
 Imager(3), Imager::Font::FreeType2(3), Imager::Font::Type1(3),
 Imager::Font::Win32(3), Imager::Font::Truetype(3), Imager::Font::BBox(3)
 
-
-http://www.eecs.umich.edu/~addi/perl/Imager/
+ http://imager.perl.org/
 
 =cut