/usr/bin/fontconfig-voodoo is in language-selector-common 0.79.4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | #!/usr/bin/python
import sys
from optparse import OptionParser
from LanguageSelector import FontConfig
from gettext import gettext as _
def main():
def abort(msg=None):
" helper for a clean abort "
if not options.silent:
if msg:
print msg
print _("Aborting")
sys.exit(1)
usage = "usage: %prog [options]"
# init the option parser
parser = OptionParser(usage)
parser.add_option("-f", "--force", dest="force",
action="store_true",
help=_("Force even when a configuration exists"))
parser.add_option("-s", "--set", dest="lang",
help=_("Set fontconfig voodoo for the selected "
"language"))
parser.add_option("-a", "--auto", dest="auto",
action="store_true",
help=_("Guess a configuration based on the "
"LANGUAGE environment. Sets the config to "
"'none' if nothing suitable was found"))
parser.add_option("-l", "--list", dest="list",
action="store_true",
help=_("List the available fontconfig-voodoo configs"))
parser.add_option("-c", "--current", dest="show_current",
action="store_true",
help=_("Show the current fontconfig-voodoo config"))
parser.add_option("-r", "--remove-current", dest="remove_current",
action="store_true",
help=_("Remove the current fontconfig-voodoo config"))
parser.add_option("-q", "--quiet",
action="store_true", dest="silent", default=False)
# check if we have arguments at all
if len(sys.argv[1:]) == 0:
parser.print_help()
sys.exit(0)
# parse them
(options, args) = parser.parse_args()
# do the work
fc = FontConfig.FontConfigHack()
if options.show_current:
try:
if options.silent:
print fc.getCurrentConfig()
else:
print "Current config: %s" % fc.getCurrentConfig()
except FontConfig.ExceptionUnconfigured:
print _("Unconfigured")
sys.exit(0)
if options.list:
print "\n".join(fc.getAvailableConfigs())
sys.exit(0)
if options.remove_current:
fc.removeConfig()
sys.exit(0)
if not options.force:
try:
fc.getCurrentConfig()
# if this does not raise a "Unconfigured" exception, we
# abort here
abort(_("A configuration exists already. Use '--force' to "
"overwrite it. "))
except FontConfig.ExceptionUnconfigured:
pass
if options.auto:
try:
fc.setConfigBasedOnLocale()
except FontConfig.ExceptionNoConfigForLocale:
abort(_("No fontconfig-voodoo configuration found for the "
"current LANGUAGE"))
if options.lang:
try:
fc.setConfig(options.lang)
except FontConfig.ExceptionNoConfigForLocale:
abort(_("No fontconfig-voodoo configuration found for the "
"selected locale"))
if __name__ == "__main__":
main()
|