Set font size of a label using Pango attributes



Hello,

I am trying to set the font size of a label using Pango attributes:


use strict;
use warnings;
use Gtk3 -init;
my $window = Gtk3::Window->new( 'toplevel' );
$window->signal_connect( destroy  => sub { Gtk3->main_quit() } );
my $label = Gtk3::Label->new('Hello world!');
my $attrlist = Pango::AttrList->new();
my $attr = Pango::AttrSize->new(1000);
Pango::AttrList::insert($attrlist, $attr);
Gtk3::Label::set_attributes($label, $attrlist);
$window->add( $label );
$window->set_default_size( 200, 200 );
$window->set_position('center_always');
$window->show_all();
Gtk3->main();
    

But unfortunately this does not compile. I get the following error:

Can't locate object method "new" via package "Pango::AttrSize" 

I have checked out the .xs file .../Pango-1.227/xs/PangoAttributes.xs 
but could not find any clue here where I went wrong.

I am using Ubuntu 17.04,
Perl version 5.26,
Pango Perl version 1.227,
Gtk3 Perl version 0.033.

Best regards,
Håkon Hægland



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