List Cairo Fonts

View: New views
8 Messages — Rating Filter:   Alert me  

List Cairo Fonts

by Jeffrey Ratcliffe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There are some OCR libraries that give box output, indicating the position and size of the recognised text - but no font information.

gscan2pdf embeds the OCR output behind the scanned image to allow the PDFs to be searched and the OCR output highlighted and copied through the scan.

However, it is tricky to pick the correct size/font combination to match the box information that the OCR library returns.

To aid this, is there a way of retrieving the font/size combinations available?

Regards

Jeff
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: List Cairo Fonts

by Torsten Schoenfeld :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10.08.2009 14:52, jeffrey.ratcliffe@... 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";
    }
  }
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: List Cairo Fonts

by Torsten Schoenfeld :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10.08.2009 19:29, Torsten Schoenfeld wrote:
> • call get_face_name() and list_sizes() on each of the faces.

But notice that list_sizes() "is only applicable to bitmap fonts"[1].
For scalable fonts (the vast majority these days), it returns an empty
list since scalable fonts are available at any size.

[1]
<http://library.gnome.org/devel/pango/stable/pango-Fonts.html#pango-font-face-list-sizes>
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Gtk2 build error (was Re: Re: List Cairo Fonts)

by Jeffrey Ratcliffe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Aug 10, 2009 7:29pm, Torsten Schoenfeld <kaffeetisch@...> wrote:
>  use Pango;

Had to compile Pango, and therefore the latest Glib. Pango also wanted the latest Gtk2 for tests, but:

xs/GtkToolShell.c: In function `XS_Gtk2__ToolShell_get_icon_size':
xs/GtkToolShell.c:39: error: `GtkToolShell' undeclared (first use in this function)
xs/GtkToolShell.c:39: error: (Each undeclared identifier is reported only once
xs/GtkToolShell.c:39: error: for each function it appears in.)
xs/GtkToolShell.c:39: error: `shell' undeclared (first use in this function)
xs/GtkToolShell.c: In function `XS_Gtk2__ToolShell_get_orientation':
xs/GtkToolShell.c:63: error: `GtkToolShell' undeclared (first use in this function)
xs/GtkToolShell.c:63: error: `shell' undeclared (first use in this function)
xs/GtkToolShell.c: In function `XS_Gtk2__ToolShell_get_relief_style':
xs/GtkToolShell.c:87: error: `GtkToolShell' undeclared (first use in this function)
xs/GtkToolShell.c:87: error: `shell' undeclared (first use in this function)
xs/GtkToolShell.c: In function `XS_Gtk2__ToolShell_get_style':
xs/GtkToolShell.c:111: error: `GtkToolShell' undeclared (first use in this function)
xs/GtkToolShell.c:111: error: `shell' undeclared (first use in this function)
xs/GtkToolShell.c: In function `XS_Gtk2__ToolShell_rebuild_menu':
xs/GtkToolShell.c:134: error: `GtkToolShell' undeclared (first use in this function)
xs/GtkToolShell.c:134: error: `shell' undeclared (first use in this function)
make: *** [xs/GtkToolShell.o] Error 1

I assume that Gtk2 needs a newer version of GTK+, and therefore the dependencies are wrong. I'll investigate further later...

Regards

Jeff
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: Re: List Cairo Fonts

by Jeffrey Ratcliffe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Aug 10, 2009 7:29pm, Torsten Schoenfeld <kaffeetisch@...> wrote:
> 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.

Excellent. Thanks.

Jeff
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: Gtk2 build error

by Torsten Schoenfeld :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 11.08.2009 08:39, jeffrey.ratcliffe@... wrote:
> Had to compile Pango, and therefore the latest Glib. Pango also wanted
> the latest Gtk2 for tests, but:
>
> xs/GtkToolShell.c: In function `XS_Gtk2__ToolShell_get_icon_size':
> xs/GtkToolShell.c:39: error: `GtkToolShell' undeclared (first use in
> this function)

This seems to suggest that your pkg-config thinks you have gtk+ >= 2.14
whereas your compiler sees gtk+ < 2.14.
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: Re: Gtk2 build error

by Jeffrey Ratcliffe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Aug 11, 2009 9:06pm, Torsten Schoenfeld <kaffeetisch@...> wrote:
> This seems to suggest that your pkg-config thinks you have gtk+ >= 2.14
> whereas your compiler sees gtk+

Not sure what is going on there - so compiling gtk+ 2.16.5 and then Gtk2 1.221. All tests pass, but:

t/00.Gtk2..........................ok 1/44# Testing Gtk2 1.221
# Running against gtk+ 2.16.5
# Compiled against gtk+ 2.16.5
# and pango 1.22.4
t/00.Gtk2..........................ok
t/01.GtkWindow.....................ok 59/114Gdk-CRITICAL **: gdk_x11_atom_to_xatom_for_display: assertion `atom != GDK_NONE' failed at t/01.GtkWindow.t line 243.
Gdk-CRITICAL **: gdk_x11_atom_to_xatom_for_display: assertion `atom != GDK_NONE' failed at t/01.GtkWindow.t line 246.
Gdk-CRITICAL **: gdk_x11_atom_to_xatom_for_display: assertion `atom != GDK_NONE' failed at t/01.GtkWindow.t line 273.
Gdk-CRITICAL **: gdk_x11_atom_to_xatom_for_display: assertion `atom != GDK_NONE' failed at t/01.GtkWindow.t line 274.
Gdk-CRITICAL **: gdk_x11_atom_to_xatom_for_display: assertion `atom != GDK_NONE' failed at t/01.GtkWindow.t line 284.
Gdk-CRITICAL **: gdk_x11_atom_to_xatom_for_display: assertion `atom != GDK_NONE' failed at t/01.GtkWindow.t line 284.
Gdk-CRITICAL **: gdk_x11_atom_to_xatom_for_display: assertion `atom != GDK_NONE' failed at t/01.GtkWindow.t line 285.
Gdk-CRITICAL **: gdk_x11_atom_to_xatom_for_display: assertion `atom != GDK_NONE' failed at t/01.GtkWindow.t line 285.

(I get this in a couple of other places, too)

[...]

t/GdkPixmap........................Gdk-WARNING **: XID collision, trouble ahead at t/GdkPixmap.t line 16.
t/GdkPixmap........................ok 1/6Gdk-WARNING **: XID collision, trouble ahead at t/GdkPixmap.t line 25.
Gdk-WARNING **: XID collision, trouble ahead at t/GdkPixmap.t line 40.

I can't see any problems otherwise.

Regards

Jeff
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: Gtk2 build error

by Kevin Ryde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

jeffrey.ratcliffe@... writes:
>
> Gdk-CRITICAL **: gdk_x11_atom_to_xatom_for_display: assertion `atom !=
> GDK_NONE' failed at t/01.GtkWindow.t line 246.

That bit might be merely temporary dodginess in gtk.  The same has been
coming out of mozilla for a while too.
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list