From b21481137d54fb5a37c023985c109d5126f53124 Mon Sep 17 00:00:00 2001 From: Pablo Saratxaga Date: Thu, 5 Dec 2002 16:07:46 +0000 Subject: made some functions to retrieve pango font namese from lang/charset --- perl-install/install_gtk.pm | 9 +++++++-- perl-install/lang.pm | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) (limited to 'perl-install') diff --git a/perl-install/install_gtk.pm b/perl-install/install_gtk.pm index 8fcbb1b1f..30378fcf6 100644 --- a/perl-install/install_gtk.pm +++ b/perl-install/install_gtk.pm @@ -45,18 +45,23 @@ sub install_theme { load_rc($_) foreach "themes-$o->{theme}", "install", "themes"; + my $pango_font_name = ""; + if (my $pango_font = lang::lang2pango_font($o->{lang})) { + $pango_font_name_10 = "font_name = \"$pango_font 10\"" + $pango_font_name_12 = "font_name = \"$pango_font 12\"" + } if (my ($font, $font2) = lang::get_x_fontset($o->{lang}, $::rootwidth < 800 ? 10 : 12)) { $font2 ||= $font; Gtk2::Rc->parse_string(qq( style "default-font" { fontset = "$font,*" - font_name = "Nimbus Sans L 12" + $pango_font_name_12 } style "small-font" { fontset = "$font2,*" - font_name = "Nimbus Sans L 10" + $pango_font_name_10 } widget "*" style "default-font" widget "*Steps*" style "small-font" diff --git a/perl-install/lang.pm b/perl-install/lang.pm index 81780a663..7fa15b377 100644 --- a/perl-install/lang.pm +++ b/perl-install/lang.pm @@ -543,6 +543,45 @@ sub charset2kde_font { "$r,5,$kdecharset,0,0"; } +# this define pango name fonts (like "NimbusSans L") depending +# on the "charset" defined by language array. This allows to selecting +# an appropriate font for each language. +# the [0] field tells the font filename, +# if field [1] is empty, that means the X11 fontset mechanism has ot be used. +my %charset2pango_font = ( + 'jisx0208' => ["k14.pcf"], [ "" ], + 'ksc5601' => ["baekmuk_gulim_h_14.pcf"], [ "" ], + 'gb2312' => ["gb16fs.pcf"], [ "" ], + 'Big5' => ["taipei16.pcf"], [ "" ], + 'tis620' => ["norasi_n.ttf"], [ "Norasi" ], + 'tscii' => ["tscava.ttf"], [ "TSC_Avarangal" ], + 'utf_vi' => ["cu12.pcf"], [ "ClearlyU", ], + 'utf_hy' => ["artsnk_m.ttf"], [ "Artsounk" ], + 'utf_ka' => ["cu12.pcf"], [ "ClearlyU" ], + 'iso-8859-7' => ["k.pfb"], [ "Kerkis" ], + 'iso-8859-8' => ["cu12.pcf"], [ "ClearlyU" ], + 'iso-8859-6' => ["cu12.pcf"], [ "ClearlyU" ], + #- Nimbus Sans L is missing some chars used by some cyrillic languages, + #- but tose haven't yet DrakX translations; it also misses vietnamese + #- latin chars; all other latin and cyrillic are covered. + 'default' => ["NimbusSansL-Regu.pfb"], [ "Nimbus Sans L" ], +); + +sub charset2pango_font { + my ($charset, $type) = @_; + + my $font = $charset2pango_font{$charset}->[1] || $charset2pango_font{default}->[1]; + "$font"; +} + +sub lang2pango_font { + my ($lang) = @_; + + my $charset = lang2charset($lang) or return; + my $font = $charset2pango_font($charset); + "$font"; +} + sub set { my ($lang, $translate_for_console) = @_; -- cgit v1.2.1