Re: List Cairo Fonts



On 10.08.2009 14:52, jeffrey ratcliffe gmail com wrote:
To aid this, is there a way of retrieving the font/size combinations
available?

I think this is best done with Pango:

• fetch the system's font map with Pango::Cairo::FontMap->get_default;
• call list_families() on the result;
• call list_faces() on each of the families;
• call get_face_name() and list_sizes() on each of the faces.

Example:

  use Pango;
  my $map = Pango::Cairo::FontMap->get_default();
  foreach my $family ($map->list_families()) {
    print $family->get_name(), "\n";
    foreach my $face ($family->list_faces()) {
      print '  ', $face->get_face_name();
      my @sizes = $face->list_sizes();
      if (@sizes) {
        print ': ', join ', ', map { Pango::units_to_double($_) } @sizes;
      }
      print "\n";
    }
  }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]