From f4e7daf7b77358431b82f97ebb14910ff9988751 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 21 Sep 2016 20:51:13 +0200 Subject: use new CSS syntax for font (mga#19430) thus fixing gtk+-3.22 regression --- perl-install/install/NEWS | 2 ++ perl-install/install/gtk.pm | 2 +- perl-install/lang.pm | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 5997fe750..94d23c4cc 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,3 +1,5 @@ +- use new CSS syntax for font (mga#19430) + Version 17.56 - 19 September 2016 - detect ovirt too (mga#19308) diff --git a/perl-install/install/gtk.pm b/perl-install/install/gtk.pm index 686e31e2f..17e81999d 100644 --- a/perl-install/install/gtk.pm +++ b/perl-install/install/gtk.pm @@ -80,7 +80,7 @@ sub load_font { my $font = lang::l2pango_font($o->{locale}{lang}); my $s = qq(gtk-font-name = $font); my $pl = Gtk3::CssProvider->new; - $pl->load_from_data("GtkWindow { font: $font }"); + $pl->load_from_data(sprintf("GtkWindow { %s }", lang::l2css_font($o->{locale}{lang}))); Gtk3::StyleContext::add_provider_for_screen(Gtk3::Gdk::Screen::get_default(), $pl, Gtk3::STYLE_PROVIDER_PRIORITY_APPLICATION); # FIXME: this should be done in /mnt too for forked app such as gurpmi{,.addmedia} (mga#67): output("/.config/gtk-3.0/settings.ini", qq([Settings] diff --git a/perl-install/lang.pm b/perl-install/lang.pm index d6f096a57..9e2127d35 100644 --- a/perl-install/lang.pm +++ b/perl-install/lang.pm @@ -1239,6 +1239,20 @@ sub charset2pango_font { $charset2pango_font{$charset} || $charset2pango_font{default}; } +=item charset2css_font ($charset) + +Returns the font to use with $charset or the default one if non is set + +=cut + +sub charset2css_font { + my ($charset) = @_; + + my $font = $charset2pango_font{$charset} || $charset2pango_font{default}; + my ($familly, $size) = $font =~ /(.*) (\d+)$/; + return "font-family: $familly; font-size: ${size}pt;"; +} + sub l2pango_font { my ($lang) = @_; @@ -1249,6 +1263,16 @@ sub l2pango_font { return $font; } +sub l2css_font { + my ($lang) = @_; + + my $charset = l2charset($lang) or log::l("no charset found for lang $lang!"), return; + my $font = charset2css_font($charset); + log::l("lang:$lang charset:$charset font:$font consolefont:$charsets{$charset}[0]"); + + return $font; +} + =back =head1 Other functions -- cgit v1.2.1