|
|
|
@@ -129,6 +129,15 @@ with the xtt module and with recent versions of the freetype module.
|
|
|
|
|
|
|
|
|
|
Generate (or don't generate) font setup for Java.
|
|
|
|
|
|
|
|
|
|
=item B<-u>, B<--user>
|
|
|
|
|
|
|
|
|
|
run fontconfig setup for user. it reads ~/.config/fontconfig/fonts-config,
|
|
|
|
|
which is user analogy of /etc/sysconfig/fonts-config.
|
|
|
|
|
|
|
|
|
|
=item B<-U>, B<--remove-user-setting>
|
|
|
|
|
|
|
|
|
|
remove user setting created by by B<--user>.
|
|
|
|
|
|
|
|
|
|
=item B<-f>, B<--force>
|
|
|
|
|
|
|
|
|
|
Force the update of all generated files even if it appears to be
|
|
|
|
@@ -316,16 +325,20 @@ Mike FABIAN, 2003, Petr Gajdos <I<pgajdos@suse.com>>, 2014.
|
|
|
|
|
use utf8;
|
|
|
|
|
use English;
|
|
|
|
|
use Getopt::Long;
|
|
|
|
|
use File::Basename;
|
|
|
|
|
use File::Path qw(mkpath);
|
|
|
|
|
use Env;
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
|
|
my $script_start_time = time();
|
|
|
|
|
my $version = 20141207;
|
|
|
|
|
my $version = 20150424;
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# OPTIONS
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
my $OPT_USER = 0;
|
|
|
|
|
my $OPT_REMOVE_USER_SETTING = 0;
|
|
|
|
|
my $OPT_FORCE = 0;
|
|
|
|
|
my $OPT_QUIET = 0;
|
|
|
|
|
my $OPT_VERBOSE = 0;
|
|
|
|
@@ -375,26 +388,36 @@ my %sysconfig_options = (
|
|
|
|
|
"GENERATE_JAVA_FONT_SETUP" , "OPT_JAVA",
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
my %in_files = (
|
|
|
|
|
"sysconfig file", "/etc/sysconfig/fonts-config",
|
|
|
|
|
"rendering config template", "/usr/share/fonts-config/10-rendering-options.conf.template",
|
|
|
|
|
"metric compatibility config", "/usr/share/fontconfig/conf.avail/30-metric-aliases.conf",
|
|
|
|
|
"metric compatibility bw config", "/usr/share/fonts-config/conf.avail/31-metric-aliases-bw.conf",
|
|
|
|
|
my $xdg_prefix = "$HOME/.config/";
|
|
|
|
|
my %files = (
|
|
|
|
|
"sysconfig file", "/etc/sysconfig/fonts-config",
|
|
|
|
|
"user sysconfig file", "fontconfig/fonts-config",
|
|
|
|
|
"rendering config template", "/usr/share/fonts-config/10-rendering-options.conf.template",
|
|
|
|
|
"rendering config", "/etc/fonts/conf.d/10-rendering-options.conf",
|
|
|
|
|
"user rendering config", "fontconfig/rendering-options.conf",
|
|
|
|
|
"metric compatibility symlink", "/etc/fonts/conf.d/30-metric-aliases.conf",
|
|
|
|
|
"metric compatibility config", "/etc/fonts/conf.d/30-metric-aliases.conf",
|
|
|
|
|
"metric compatibility avail", "/usr/share/fontconfig/conf.avail/30-metric-aliases.conf",
|
|
|
|
|
"metric compatibility bw symlink", "/etc/fonts/conf.d/31-metric-aliases-bw.conf",
|
|
|
|
|
"local family list", "/etc/fonts/conf.d/58-family-prefer-local.conf",
|
|
|
|
|
"user family list", "fontconfig/family-prefer.conf",
|
|
|
|
|
"java fontconfig properties template", "/usr/share/fonts-config/fontconfig.SuSE.properties.template",
|
|
|
|
|
);
|
|
|
|
|
my %out_files = (
|
|
|
|
|
"rendering config", "/etc/fonts/conf.d/10-rendering-options.conf",
|
|
|
|
|
"local family list", "/etc/fonts/conf.d/58-family-prefer-local.conf",
|
|
|
|
|
"metric compatibility symlink", "/etc/fonts/conf.d/30-metric-aliases.conf",
|
|
|
|
|
"metric compatibility bw symlink", "/etc/fonts/conf.d/31-metric-aliases-bw.conf",
|
|
|
|
|
"java fontconfig properties", "/usr/lib*/jvm/jre/lib/fontconfig.SuSE.properties",
|
|
|
|
|
);
|
|
|
|
|
"java fontconfig properties", "/usr/lib*/jvm/jre/lib/fontconfig.SuSE.properties",
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
get_option_defaults_from_sysconfig($in_files{"sysconfig file"});
|
|
|
|
|
|
|
|
|
|
# read sysconfig and userconfig if --user was given
|
|
|
|
|
get_option_defaults_from_sysconfig($files{'sysconfig file'});
|
|
|
|
|
if (grep(/^--user$/, @ARGV)) {
|
|
|
|
|
# read variables on the top on the system ones
|
|
|
|
|
get_option_defaults_from_sysconfig($xdg_prefix.$files{'user sysconfig file'});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# process command line options
|
|
|
|
|
my %opt;
|
|
|
|
|
unless (GetOptions(\%opt,
|
|
|
|
|
'user|u', \$OPT_USER,
|
|
|
|
|
'remove-user-setting|r', \$OPT_REMOVE_USER_SETTING,
|
|
|
|
|
'force|f', \$OPT_FORCE,
|
|
|
|
|
'quiet|q', \$OPT_QUIET,
|
|
|
|
|
'verbose|v', \$OPT_VERBOSE,
|
|
|
|
@@ -447,13 +470,9 @@ if ($OPT_HELP) {
|
|
|
|
|
if ($OPT_INFO) {
|
|
|
|
|
# this is read by yast-fonts, so may be that
|
|
|
|
|
# change should be reflected in this yast module
|
|
|
|
|
print "Input Files\n";
|
|
|
|
|
for my $f (keys %in_files) {
|
|
|
|
|
print " $f: $in_files{$f}\n"
|
|
|
|
|
}
|
|
|
|
|
print "Output Files\n";
|
|
|
|
|
for my $f (keys %out_files) {
|
|
|
|
|
print " $f: $out_files{$f}\n"
|
|
|
|
|
print "Involved Files\n";
|
|
|
|
|
for my $f (keys %files) {
|
|
|
|
|
print " $f: $files{$f}\n"
|
|
|
|
|
}
|
|
|
|
|
exit 0;
|
|
|
|
|
}
|
|
|
|
@@ -472,6 +491,21 @@ elsif ($OPT_VERBOSE) {
|
|
|
|
|
$VERBOSITY = $VERBOSITY_VERBOSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# REMOVE USER SETTING
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
if ($OPT_REMOVE_USER_SETTING) {
|
|
|
|
|
my_remove_file($xdg_prefix.$files{'user sysconfig file'});
|
|
|
|
|
my_remove_file($xdg_prefix.$files{'user rendering config'});
|
|
|
|
|
my_remove_file($xdg_prefix.$files{'user family list'});
|
|
|
|
|
exit 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print $OPT_USER ? "USER mode ($USER)\n" : "SYSTEM mode\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# SYSCONFIG VARS -- debug output
|
|
|
|
|
#
|
|
|
|
@@ -479,7 +513,9 @@ elsif ($OPT_VERBOSE) {
|
|
|
|
|
no strict "vars";
|
|
|
|
|
no warnings;
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "--- sysconfig options (read from $in_files{'sysconfig file'}):\n";
|
|
|
|
|
print "--- sysconfig options (read from $files{'sysconfig file'}".
|
|
|
|
|
($OPT_USER ? ", $xdg_prefix$files{'user sysconfig file'}" : "").
|
|
|
|
|
"):\n";
|
|
|
|
|
for my $i (keys %sysconfig_options) {
|
|
|
|
|
if (defined eval ("\$$i")) {
|
|
|
|
|
printf "$i=%s\n", eval("\$$i");
|
|
|
|
@@ -494,8 +530,8 @@ use strict;
|
|
|
|
|
# UID 0 CHECK
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
if ($UID != 0 && $ENV{USER} !~ /root/) {
|
|
|
|
|
print "*** error: you must be root to start $0\n";
|
|
|
|
|
if (!$OPT_USER && $UID != 0 && $ENV{USER} !~ /root/) {
|
|
|
|
|
print "*** error: no root permissions; rerun with --user for user fontconfig setting\n";
|
|
|
|
|
exit 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -503,7 +539,9 @@ if ($UID != 0 && $ENV{USER} !~ /root/) {
|
|
|
|
|
# MKFONTSCALE, MKFONTSDIR
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
mkfont_scale_dir();
|
|
|
|
|
if (!$OPT_USER) {
|
|
|
|
|
mkfont_scale_dir();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# The following two calls may change files in /etc/fonts, therefore
|
|
|
|
|
# they have to be called *before* fc-cache. If anything is
|
|
|
|
@@ -514,31 +552,37 @@ mkfont_scale_dir();
|
|
|
|
|
# FONTCONFIG RENDERING SETUP
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
rendering_options();
|
|
|
|
|
family_preference_config();
|
|
|
|
|
rendering_options($OPT_USER);
|
|
|
|
|
family_preference_config($OPT_USER);
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# FONTCONFIG CACHE
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
run_fccache ("");
|
|
|
|
|
run_fccache ("32");
|
|
|
|
|
run_fccache ("64");
|
|
|
|
|
if (!$OPT_USER) {
|
|
|
|
|
run_fccache ("");
|
|
|
|
|
run_fccache ("32");
|
|
|
|
|
run_fccache ("64");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# FONT DATABASE
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
run_fp_rehash ();
|
|
|
|
|
if (!$OPT_USER) {
|
|
|
|
|
run_fp_rehash ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# generate_java_font_setup uses fontconfig,
|
|
|
|
|
# therefore it has to be called *after* fc-cache
|
|
|
|
|
|
|
|
|
|
if ($OPT_JAVA) {
|
|
|
|
|
if (!$OPT_USER && $OPT_JAVA) {
|
|
|
|
|
generate_java_font_setup ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reload_xfs_config ();
|
|
|
|
|
if (!$OPT_USER) {
|
|
|
|
|
reload_xfs_config ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exit 0;
|
|
|
|
|
|
|
|
|
@@ -549,6 +593,7 @@ exit 0;
|
|
|
|
|
|
|
|
|
|
sub usage {
|
|
|
|
|
print "Usage: fonts-config [option] ...\n";
|
|
|
|
|
print "-u, --user Run fontconfig setup for user.\n";
|
|
|
|
|
print "-f, --force Force the update of all generated files even\n";
|
|
|
|
|
print " if it appears unnecessary according to the time stamps\n";
|
|
|
|
|
print "-q, --quiet Work silently, unless an error occurs.\n";
|
|
|
|
@@ -616,11 +661,10 @@ sub get_option_defaults_from_sysconfig {
|
|
|
|
|
eval("\$$sysconfig_options{$i}=0");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return (0);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
print "--- NOTE: $sysconfig_file doesn't exist, using builtin defaults.\n";
|
|
|
|
|
return (1);
|
|
|
|
|
# VERBOSITY still not defined!
|
|
|
|
|
print "NOTE: $sysconfig_file doesn't exist, using builtin defaults.\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -950,7 +994,6 @@ sub make_fonts_scale_and_fonts_dir {
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "mkfontscale is not available or it failed ";
|
|
|
|
|
print "-> creating an empty fonts.scale file.\n";
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
$try_again = 1;
|
|
|
|
|
my_system ("echo 0 > $dir/fonts.scale");
|
|
|
|
@@ -1074,13 +1117,22 @@ sub create_symbolic_links {
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
sub rendering_options {
|
|
|
|
|
my $suse_rendering_file = $out_files{"rendering config"};
|
|
|
|
|
my $suse_rendering_template_file = $in_files{"rendering config template"};
|
|
|
|
|
my ($user) = @_;
|
|
|
|
|
my $suse_rendering_file;
|
|
|
|
|
my $suse_rendering_template_file = $files{'rendering config template'};
|
|
|
|
|
my $suse_rendering = "";
|
|
|
|
|
my $suse_rendering_template = "";
|
|
|
|
|
|
|
|
|
|
if (!$user) {
|
|
|
|
|
$suse_rendering_file = $files{'rendering config'};
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$suse_rendering_file = $xdg_prefix . $files{'user rendering config'};
|
|
|
|
|
my_make_path(dirname($suse_rendering_file));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
printf "--- Generating $suse_rendering_file ---\n";
|
|
|
|
|
printf "--- generating $suse_rendering_file ---\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (-f "$suse_rendering_template_file") {
|
|
|
|
@@ -1169,6 +1221,27 @@ sub rendering_options {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
elsif ($ARG =~ /_SYSCONFIG_FILE_PLACEHOLDER_/) {
|
|
|
|
|
my $arg = ($user ? " -\\-user" : "");
|
|
|
|
|
$ARG =~ s/_SYSCONFIG_FILE_PLACEHOLDER_/$files{'sysconfig file'}/;
|
|
|
|
|
$ARG =~ s/_FONTSCONFIG_RUN_PLACEHOLDER_/$0$arg/;
|
|
|
|
|
$suse_rendering_template .= $ARG;
|
|
|
|
|
}
|
|
|
|
|
elsif ($ARG =~ /_METRIC_ALIASES_PLACEHOLDER_/) {
|
|
|
|
|
if ($OPT_SEARCH_METRIC_COMPATIBLE) {
|
|
|
|
|
$ARG =~ s/_METRIC_ALIASES_PLACEHOLDER_/true/;
|
|
|
|
|
} else {
|
|
|
|
|
$ARG =~ s/_METRIC_ALIASES_PLACEHOLDER_/false/;
|
|
|
|
|
}
|
|
|
|
|
$suse_rendering_template .= $ARG;
|
|
|
|
|
}
|
|
|
|
|
elsif ($ARG =~ /_INCLUDE_USER_RENDERING_PLACEHOLDER_/) {
|
|
|
|
|
if (!$user) {
|
|
|
|
|
# let user have a possibility to override system settings
|
|
|
|
|
$ARG =~ s@_INCLUDE_USER_RENDERING_PLACEHOLDER_@<include ignore_missing="yes" prefix="xdg">$files{'user rendering config'}</include>@;
|
|
|
|
|
$suse_rendering_template .= $ARG;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$suse_rendering_template .= $ARG;
|
|
|
|
|
}
|
|
|
|
@@ -1213,7 +1286,7 @@ sub rendering_options {
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
sub family_preference_list {
|
|
|
|
|
my ($family, $prefered_families) = @_;
|
|
|
|
|
my ($family, $prefered_families, $user) = @_;
|
|
|
|
|
my $cfg;
|
|
|
|
|
|
|
|
|
|
my @families = split(/:/, $prefered_families);
|
|
|
|
@@ -1233,9 +1306,12 @@ sub family_preference_list {
|
|
|
|
|
$family =~ s/&/&/g;
|
|
|
|
|
|
|
|
|
|
if (! $OPT_FORCE_FPL) {
|
|
|
|
|
$cfg .= " <alias>\n";
|
|
|
|
|
$cfg .= " <family>$family</family>\n";
|
|
|
|
|
$cfg .= " <prefer>\n";
|
|
|
|
|
$cfg .= "\t<alias>\n";
|
|
|
|
|
if (!$user) {
|
|
|
|
|
$cfg .= "\t\t<test name=\"user_preference_list\"><bool>false</bool></test>\n"
|
|
|
|
|
}
|
|
|
|
|
$cfg .= "\t\t<family>$family</family>\n";
|
|
|
|
|
$cfg .= "\t\t<prefer>\n";
|
|
|
|
|
for my $f (@families) {
|
|
|
|
|
$f =~ s/&/&/g;
|
|
|
|
|
$cfg .= " <family>$f</family>\n";
|
|
|
|
@@ -1243,12 +1319,12 @@ sub family_preference_list {
|
|
|
|
|
print "[$f] ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$cfg .= " </prefer>\n";
|
|
|
|
|
$cfg .= " </alias>\n";
|
|
|
|
|
$cfg .= "\t\t</prefer>\n";
|
|
|
|
|
$cfg .= "\t</alias>\n";
|
|
|
|
|
} else {
|
|
|
|
|
$cfg .= " <match>\n";
|
|
|
|
|
$cfg .= " <test name=\"family\"><string>$family</string></test>\n";
|
|
|
|
|
$cfg .= " <edit name=\"family\" mode=\"prepend_first\" binding=\"strong\">\n";
|
|
|
|
|
$cfg .= "\t<match>\n";
|
|
|
|
|
$cfg .= "\t\t<test name=\"family\"><string>$family</string></test>\n";
|
|
|
|
|
$cfg .= "\t\t<edit name=\"family\" mode=\"prepend_first\" binding=\"strong\">\n";
|
|
|
|
|
for my $f (@families) {
|
|
|
|
|
$f =~ s/&/&/g;
|
|
|
|
|
$cfg .= " <string>$f</string>\n";
|
|
|
|
@@ -1256,8 +1332,8 @@ sub family_preference_list {
|
|
|
|
|
print "[$f] ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$cfg .= " </edit>\n";
|
|
|
|
|
$cfg .= " </match>\n";
|
|
|
|
|
$cfg .= "\t\t</edit>\n";
|
|
|
|
|
$cfg .= "\t</match>\n";
|
|
|
|
|
}
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "\n";
|
|
|
|
@@ -1266,37 +1342,112 @@ sub family_preference_list {
|
|
|
|
|
return $cfg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub family_metric_compatibility {
|
|
|
|
|
my ($fontconfig_metric_conf, $user) = @_;
|
|
|
|
|
my $suse_metric = "";
|
|
|
|
|
|
|
|
|
|
if (-f "$fontconfig_metric_conf") {
|
|
|
|
|
open (CONF, "$fontconfig_metric_conf") || die "can't open file $fontconfig_metric_conf: $!";
|
|
|
|
|
binmode CONF, ":utf8";
|
|
|
|
|
while (<CONF>) {
|
|
|
|
|
$suse_metric .= $ARG;
|
|
|
|
|
if ($ARG =~ /<alias.*>/) {
|
|
|
|
|
$suse_metric .= "\t <test name=\"search_metric_aliases\"><bool>true</bool></test>\n"
|
|
|
|
|
} elsif ($ARG =~ /<!DOCTYPE.*>/) {
|
|
|
|
|
$suse_metric .= "\n";
|
|
|
|
|
$suse_metric .= "<!-- DO NOT EDIT; this is a generated file -->\n";
|
|
|
|
|
$suse_metric .= "<!-- modify $files{($user ? 'user syconfig file' : 'sysconfig file')} && run $0 instead -->\n";
|
|
|
|
|
$suse_metric .= "\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
close (CONF);
|
|
|
|
|
} else {
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "--- WARNING: $fontconfig_metric_conf doesn't exist!\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $suse_metric;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub family_preference_config {
|
|
|
|
|
my $suse_pref_file = $out_files{"local family list"};
|
|
|
|
|
my $metric_file = $in_files{"metric compatibility config"};
|
|
|
|
|
my $bw_metric_file = $in_files{"metric compatibility bw config"};
|
|
|
|
|
my $metric_symlink = $out_files{"metric compatibility symlink"};
|
|
|
|
|
my $bw_metric_symlink = $out_files{"metric compatibility bw symlink"};
|
|
|
|
|
my ($user) = @_;
|
|
|
|
|
my $suse_pref_file = $files{'local family list'};
|
|
|
|
|
my $suse_metric_file = $files{'metric compatibility config'};
|
|
|
|
|
my $metric_symlink = $files{'metric compatibility symlink'};
|
|
|
|
|
my $metric_avail = $files{'metric compatibility avail'};
|
|
|
|
|
my $suse_metric = "";
|
|
|
|
|
my $suse_pref = "";
|
|
|
|
|
my $edit_options;
|
|
|
|
|
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
printf "--- Generating $suse_pref_file ---\n";
|
|
|
|
|
if (!$user) {
|
|
|
|
|
$suse_pref_file = $files{'local family list'};
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$suse_pref_file = $xdg_prefix . $files{'user family list'};
|
|
|
|
|
my_make_path(dirname($suse_pref_file));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($OPT_SEARCH_METRIC_COMPATIBLE) {
|
|
|
|
|
my_symlink($metric_file, $metric_symlink);
|
|
|
|
|
my_symlink($bw_metric_file, $bw_metric_symlink);
|
|
|
|
|
} else {
|
|
|
|
|
my_remove_symlink($metric_symlink);
|
|
|
|
|
my_remove_symlink($bw_metric_symlink);
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
printf "--- generating $suse_pref_file ---\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!$user)
|
|
|
|
|
{
|
|
|
|
|
if (-e $metric_avail) {
|
|
|
|
|
# replace fontconfig's /etc/fonts/conf.d/30-metric-aliases.conf
|
|
|
|
|
# by fonts-config's one
|
|
|
|
|
|
|
|
|
|
if (-l $metric_symlink) {
|
|
|
|
|
my_remove_symlink($metric_symlink);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$suse_metric .= family_metric_compatibility($metric_avail, $user);
|
|
|
|
|
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "--- writing $suse_metric_file ---\n";
|
|
|
|
|
print "---\n";
|
|
|
|
|
}
|
|
|
|
|
# same name as symlink from fontconfig
|
|
|
|
|
open (CONF, ">$suse_metric_file") || die "can't open file $suse_metric_file: $!";
|
|
|
|
|
print CONF $suse_metric;
|
|
|
|
|
close (CONF);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "--- WARNING: $metric_avail not found, not writing $suse_metric_file ---\n";
|
|
|
|
|
print "---\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$suse_pref .= "<?xml version=\"1.0\"?>\n";
|
|
|
|
|
$suse_pref .= "<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">\n";
|
|
|
|
|
$suse_pref .= "\n";
|
|
|
|
|
$suse_pref .= "<!-- DO NOT EDIT; this is a generated file -->\n";
|
|
|
|
|
$suse_pref .= "<!-- modify /etc/sysconfig/fonts-config && run fonts-config instead -->\n";
|
|
|
|
|
$suse_pref .= "<!-- modify $files{($user ? 'user sysconfig file' : 'sysconfig file')} && run $0" . ($user ? " -\\-user" : "") . " instead -->\n";
|
|
|
|
|
$suse_pref .= "\n";
|
|
|
|
|
$suse_pref .= "<fontconfig>\n";
|
|
|
|
|
$suse_pref .= family_preference_list("sans-serif", $OPT_SANS_FAMILIES);
|
|
|
|
|
$suse_pref .= family_preference_list("serif", $OPT_SERIF_FAMILIES);
|
|
|
|
|
$suse_pref .= family_preference_list("monospace", $OPT_MONO_FAMILIES);
|
|
|
|
|
if (!$user) {
|
|
|
|
|
$suse_pref .= "\t<!-- Let user override here defined system setting. -->\n";
|
|
|
|
|
$suse_pref .= "\t<match target=\"pattern\">\n";
|
|
|
|
|
$suse_pref .= "\t\t<edit name=\"user_preference_list\" mode=\"assign\">\n";
|
|
|
|
|
$suse_pref .= "\t\t\t<bool>false</bool>\n";
|
|
|
|
|
$suse_pref .= "\t\t</edit>\n";
|
|
|
|
|
$suse_pref .= "\t</match>\n";
|
|
|
|
|
$suse_pref .= "\t<include ignore_missing=\"yes\" prefix=\"xdg\">fontconfig/family-prefer.conf</include>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$suse_pref .= "\t<match target=\"pattern\">\n";
|
|
|
|
|
$suse_pref .= "\t\t<edit name=\"user_preference_list\" mode=\"assign\">\n";
|
|
|
|
|
$suse_pref .= "\t\t\t<bool>true</bool>\n";
|
|
|
|
|
$suse_pref .= "\t\t</edit>\n";
|
|
|
|
|
$suse_pref .= "\t</match>\n";
|
|
|
|
|
}
|
|
|
|
|
$suse_pref .= "\n";
|
|
|
|
|
$suse_pref .= family_preference_list("sans-serif", $OPT_SANS_FAMILIES, $user);
|
|
|
|
|
$suse_pref .= family_preference_list("serif", $OPT_SERIF_FAMILIES, $user);
|
|
|
|
|
$suse_pref .= family_preference_list("monospace", $OPT_MONO_FAMILIES, $user);
|
|
|
|
|
$suse_pref .= "</fontconfig>\n";
|
|
|
|
|
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
@@ -1399,8 +1550,8 @@ sub run_fp_rehash {
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
sub generate_java_font_setup {
|
|
|
|
|
my @fontconfig_SuSE_properties_globs = $out_files{"java fontconfig properties"};
|
|
|
|
|
my $fontconfig_SuSE_properties_template_file = $in_files{"java fontconfig properties template"};
|
|
|
|
|
my @fontconfig_SuSE_properties_globs = $files{'java fontconfig properties'};
|
|
|
|
|
my $fontconfig_SuSE_properties_template_file = $files{'java fontconfig properties template'};
|
|
|
|
|
my $fontconfig_SuSE_properties_template = "";
|
|
|
|
|
my @sans_japanese_priority = ("MS Gothic",
|
|
|
|
|
"HGGothicB",
|
|
|
|
@@ -1494,10 +1645,10 @@ sub generate_java_font_setup {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($VERBOSITY == $VERBOSITY_VERBOSE) {
|
|
|
|
|
printf "Generating java font setup ...\n";
|
|
|
|
|
printf "generating java font setup ...\n";
|
|
|
|
|
}
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
printf "--- Generating java font setup\n";
|
|
|
|
|
printf "--- generating java font setup\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
my ($font, $file);
|
|
|
|
@@ -1704,7 +1855,16 @@ sub select_java_font {
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
sub reload_xfs_config {
|
|
|
|
|
my $pids = `ps -C xfs -o pid= | sed 's:[ \t]::g'`;
|
|
|
|
|
my $pids;
|
|
|
|
|
|
|
|
|
|
if (! -x '/usr/bin/ps') {
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_VERBOSE) {
|
|
|
|
|
print "--- WARNING: ps command is missing, couldn't search for X Font Server pids\n";
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$pids = `/usr/bin/ps -C xfs -o pid= | sed 's:[ \t]::g'`;
|
|
|
|
|
$pids =~ s/\n//;
|
|
|
|
|
|
|
|
|
|
if ($pids) {
|
|
|
|
@@ -1765,8 +1925,8 @@ sub my_symlink {
|
|
|
|
|
|
|
|
|
|
sub my_remove_symlink {
|
|
|
|
|
my ($link) = @_;
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "--- remove symlink: $link .. ";
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "--- removing symlink: $link .. ";
|
|
|
|
|
}
|
|
|
|
|
if (! -l $link) {
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
@@ -1787,6 +1947,30 @@ sub my_remove_symlink {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub my_make_path {
|
|
|
|
|
my ($dir) = @_;
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "--- creating directory: $dir .. ";
|
|
|
|
|
}
|
|
|
|
|
if (-d $dir) {
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "exists\n";
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
mkpath($dir);
|
|
|
|
|
if (! -d $dir) {
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "can not create\n";
|
|
|
|
|
}
|
|
|
|
|
exit 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "created\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub search_executable {
|
|
|
|
|
for my $file (@_) {
|
|
|
|
|
if (-x $file) {
|
|
|
|
@@ -1796,9 +1980,28 @@ sub search_executable {
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "--- WARNING: no executable from ";
|
|
|
|
|
print join(", ", @_);
|
|
|
|
|
print "found\n";
|
|
|
|
|
print " found\n";
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub my_remove_file {
|
|
|
|
|
my ($file) = @_;
|
|
|
|
|
if (-e $file) {
|
|
|
|
|
if(unlink $file) {
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "--- $file deleted ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "--- WARNING: can not delete $file ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if ($VERBOSITY >= $VERBOSITY_DEBUG) {
|
|
|
|
|
print "--- WARNING: $file does not exist, can not delete";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|