#!/bin/sh
#
# language/font setting script for Window Maker
#
# by MANOME Tomonori <manome@itlb.te.noda.sut.ac.jp>
#
# [Special Thanks To]
# Korean fontset info from: 
#     Byeong-Chan, Kim <redhands@linux.sarang.net> 
#     Chae-yong Chong <cychong@metro.telecom.samsung.co.kr>
# Latin2 fontset info from: 
#     Piotr Dembinski <pdemb@aurora.put.poznan.pl>
#     Toni Bilic <root@toni.hr.tel.hr>
# Greek fontset info from: 
#     Nikolaos Papagrigoriou <papanikos@usa.net>
# Quote bug fix info from:
#     Luke Kendall <luke@research.canon.com.au>
# Bug fix info for Korean font section from:
#     CHOI Junho <junker@jazz.snu.ac.kr>
# LargeDisplayFont and Belarusian, Bulgarian, Macedonian, Serbian and
# Ukrainian fontset info from:
#     Anton Zinoviev <zinoviev@debian.org>

VERSION="Version 0.6  2000/11/14"

WDWRITE="wdwrite"
PROGRAM=`basename $0`

if test $# != 1; then
    echo
    echo "$PROGRAM - font/language setting utility for Window Maker"
    echo 
    echo "Usage:                              $VERSION"
    echo "        $PROGRAM <option> "
    cat <<EOF
-----------------------------------------------------------------------
[Option]    [Fontset]                    [Font Information]
 default     helvetica                    
 latin1      helvetica(iso8859-1)
 latin2      helvetica(iso8859-2)         See *Note1.
 belarusian  helvetica(cp1251)            See *Note1
 bulgarian   helvetica(cp1251)            See *Note1
 greek       helvetica(iso8859-7)         See *Note1.
 japanese    helvetica/-*-fixed(jisx02XX) Included in X11R6/XFree86("fnon" pkg)
 korean      helvetica/-*-kodig(ksc5601)  See *Note1.
 korean2     helvetica/daewoo(ksc5601)    Included in X11R6/XFree86("fnon" pkg)
 macedonian  helvetica(iso8859-5)         See *Note1
 russian     helvetica(koi8-r)            Included in X11R6/XFree86("fcyr" pkg)
 serbian     helvetica(iso8859-5)         See *Note1
 ukrainian   helvetica(koi8-u)            See *Note1
 turkish     unknown                      See *Note2.
-----------------------------------------------------------------------
Latin1 Languages: Danish/Dutch/English/Finnish/French/Galician/German/
                  Italian/Norwegian/Portuguese/Spanish/Swedish/...
Latin2 Languages: Croatian/Czech/Polish/Romanian/Slovenian/...

*Note1: Not included in X11R6/XFree86. You can download them from ...
 Latin2 X fonts packages: http://sizif.mf.uni-lj.si/linux/cee/iso8859-2.html
 Greek X fonts packages:  ftp://argeas.argos.hol.gr/pub/unix/linux/GREEK/fonts/
                          ftp://ftp.ntua.gr/pub/fonts/X11/
 Korean X fonts packages: ftp://linux.sarang.net  (Linux RPM)
                          ftp://ftp.kaist.ac.kr/pub/hangul/fonts
 Cyrillic X fonts packages for all encodings:
                          ftp://ftp.inp.nsk.su/pub/BINP/X11/fonts/cyr-rfx/
*Note2: please let me know appropriate font setting for WMGLOBAL/WindowMaker,
        and the fonts' URL to download. mail-to: manome@itlb.te.noda.sut.ac.jp
EOF
    exit
fi

case $1 in
   default)
	SystemFont=\"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*\"
	BoldSystemFont=\"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*\"
	WindowTitleFont=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*\"
	MenuTitleFont=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*\"
	MenuTextFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*\"
	IconTitleFont=\"-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*\"
	ClipTitleFont=\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*\"
	DisplayFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*\"
        LargeDisplayFont=\"-*-lucida-bold-r-*-*-24-*-*-*-*-*-*-*\"
	;;
   latin1)
	SystemFont=\"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-iso8859-1\"
	BoldSystemFont=\"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-iso8859-1\"
	WindowTitleFont=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-iso8859-1\"
	MenuTitleFont=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-iso8859-1\"
	MenuTextFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-1\"
	IconTitleFont=\"-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-iso8859-1\"
	ClipTitleFont=\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-iso8859-1\"
	DisplayFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-1\"
        LargeDisplayFont=\"-*-lucida-bold-r-*-*-24-*-*-*-*-*-iso8859-1\"
	;;
   latin2)
	SystemFont=\"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-iso8859-2\"
	BoldSystemFont=\"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-iso8859-2\"
	WindowTitleFont=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-iso8859-2\"
	MenuTitleFont=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-iso8859-2\"
	MenuTextFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-2\"
	IconTitleFont=\"-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-iso8859-2\"
	ClipTitleFont=\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-iso8859-2\"
	DisplayFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-2\"
        LargeDisplayFont=\"-*-lucida-bold-r-*-*-24-*-*-*-*-*-iso8859-2\"
	;;
   greek)
	SystemFont=\"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-iso8859-7\"
	BoldSystemFont=\"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-iso8859-7\"
	WindowTitleFont=\"-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-7\"
	MenuTitleFont=\"-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-iso8859-7\"
	MenuTextFont=\"-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-iso8859-7\"
	IconTitleFont=\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-iso8859-7\"
	ClipTitleFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-7\"
	DisplayFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-7\"
        LargeDisplayFont=\"-*-*-bold-r-*-*-24-*-*-*-*-*-iso8859-7\"
	;;
   russian)
	SystemFont=\"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-koi8-r\"
	BoldSystemFont=\"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-koi8-r\"
	WindowTitleFont=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-koi8-r\"
	MenuTitleFont=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-koi8-r\"
	MenuTextFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-koi8-r\"
	IconTitleFont=\"-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-koi8-r\"
	ClipTitleFont=\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-koi8-r\"
	DisplayFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-koi8-r\"
        LargeDisplayFont=\"-*-serene-bold-r-*-*-24-*-*-*-*-*-koi8-r\"
	;;
   ukrainian)
	SystemFont=\"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-koi8-u\"
	BoldSystemFont=\"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-koi8-u\"
	WindowTitleFont=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-koi8-u\"
	MenuTitleFont=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-koi8-u\"
	MenuTextFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-koi8-u\"
	IconTitleFont=\"-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-koi8-u\"
	ClipTitleFont=\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-koi8-u\"
	DisplayFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-koi8-u\"
        LargeDisplayFont=\"-*-serene-bold-r-*-*-24-*-*-*-*-*-koi8-u\"
	;;
   bulgarian|belarusian)
        SystemFont=\"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-microsoft-cp1251\"
        BoldSystemFont=\"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-microsoft-cp1251\"
        WindowTitleFont=\"-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-microsoft-cp1251\"
        MenuTitleFont=\"-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-microsoft-cp1251\"
        MenuTextFont=\"-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-microsoft-cp1251\"
        IconTitleFont=\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-microsoft-cp1251\"
        ClipTitleFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-microsoft-cp1251\"
        DisplayFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-microsoft-cp1251\"
        LargeDisplayFont=\"-*-serene-bold-r-*-*-24-*-*-*-*-*-microsoft-cp1251\"
        ;;
   serbian|macedonian)
        SystemFont=\"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-iso8859-5\"
        BoldSystemFont=\"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-iso8859-5\"
        WindowTitleFont=\"-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-5\"
        MenuTitleFont=\"-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-iso8859-5\"
        MenuTextFont=\"-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-iso8859-5\"
        IconTitleFont=\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-iso8859-5\"
        ClipTitleFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-5\"
        DisplayFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-5\"
        LargeDisplayFont=\"-*-serene-bold-r-*-*-24-*-*-*-*-*-iso8859-5\"
        ;;
   japanese)
        SystemFont=\"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-%d-*,-*-*-medium-r-normal-*-*-*\"
	BoldSystemFont=\"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-%d-*,-*-*-medium-r-normal-*-*-*\"
	WindowTitleFont=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-14-*,-*-*-medium-r-normal-*-*-*\"
	MenuTitleFont=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-14-*,-*-*-medium-r-normal-*-*-*\"
	MenuTextFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-14-*,-*-*-medium-r-normal-*-*-*\"
	IconTitleFont=\"-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-*-*\"
	ClipTitleFont=\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-*-*\"
	DisplayFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-14-*,-*-*-medium-r-normal-*-*-*\"
	LargeDisplayFont=\"-*-helvetica-bold-r-normal-*-24-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-24-*,-*-*-medium-r-normal-*-*-*\"
	;;
   korean)
	SystemFont=\"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--%d-*-*-*-*-*-*-*,*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*,*-*-*-*-*--%d-*-*-*-*-*-*-*,*\"
	BoldSystemFont=\"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-kodig-bold-r-normal--%d-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--%d-*-*-*-*-*-*-*,*-*-bold-r-normal-*-%d-*-*-*-*-*-*-*,*-*-*-*-*--%d-*-*-*-*-*-*-*,*\"
	WindowTitleFont=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--12-*-*-*-*-*-*-*,-*-*-medium-r-normal--12-*-*-*-*-*-*-*,-*-*-medium-r-normal--*-*-*-*-*-*-*-*,-*-*-*-r-normal--*-*-*-*-*-*-*-*,-*-*-*-*-*--*-*-*-*-*-*-*-*,*\"
	MenuTitleFont=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--14-*-*-*-*-*-*-*,-*-*-medium-r-normal--12-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*\"
	MenuTextFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--14-*-*-*-*-*-*-*,*-*-medium-r-normal--12-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*\"
	IconTitleFont=\"-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--10-*-*-*-*-*-*-*,*-*-medium-r-normal--10-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*\"
	ClipTitleFont=\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--10-*-*-*-*-*-*-*,*-*-medium-r-normal--10-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*\"
	DisplayFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--12-*-*-*-*-*-*-*,*-*-medium-r-normal--12-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*\"
	LargeDisplayFont=\"-*-helvetica-bold-r-normal-*-24-*-*-*-*-*-*-*,-*-kodig-bold-r-normal--24-*-*-*-*-*-*-*,-*-*-medium-r-normal--24-*-*-*-*-*-*-*,*-*-bold-r-normal-*-24-*-*-*-*-*-*-*,*-*-*-*-*--24-*-*-*-*-*-*-*,*\"
	;;
   korean2)
	SystemFont=\"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-medium-r-normal-*-%d-*,-*-medium-r-normal-*\"
	BoldSystemFont=\"-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-medium-r-normal-*-%d-*,-*-medium-r-normal-*\"
	WindowTitleFont=\"7x14,-*-gothic-medium-r-normal-*-16-*-*-*-*-*-ksc5601.1987-*\"
	MenuTitleFont=\"7x14,-*-gothic-medium-r-normal-*-16-*-*-*-*-*-ksc5601.1987-*\"
	MenuTextFont=\"7x14,-*-gothic-medium-r-normal-*-16-*-*-*-*-*-ksc5601.1987-*\"
	IconTitleFont=\"-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*,-*-gothic-medium-r-normal-*-12-*-*-*-*-*-ksc5601.1987-*\"
	ClipTitleFont=\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*,-*-gothic-medium-r-normal-*-12-*-*-*-*-*-ksc5601.1987-*\"
	DisplayFont=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-gothic-medium-r-normal-*-16-*-*-*-*-*-ksc5601.1987-*\"
	LargeDisplayFont=\"-*-helvetica-bold-r-normal-*-24-*-*-*-*-*-*-*,-*-medium-r-normal-*-24-*,-*-medium-r-normal-*\"
	;;
   *)
	echo "NOTICE:"
	echo "Sorry I don't know appropriate font configuration for \"$1\""
	echo "please let me know your settings for SystemFont,BoldSystemFont,"
	echo "WindowTitleFont,MenuTitleFont,IconTitleFont,ClipTitleFont,and"
	echo "DisplayFont thanks"
        echo "and please let me know also the URL of the fonts to download"
        echo "if your language need some special fonts not included in    "
        echo "X11R6/XFree."
	echo "mail-to: manome@itlb.te.noda.sut.ac.jp"
	exit
	;;
esac


#
# setting fonts
#

echo "Setting up ~/GNUstep/Defaults/WMGLOBAL..."

$WDWRITE WMGLOBAL SystemFont "$SystemFont"
$WDWRITE WMGLOBAL BoldSystemFont "$BoldSystemFont"

echo
echo "    SystemFont=$SystemFont"
echo "    BoldSystemFont=$BoldSystemFont"
echo
echo "Setting up  ~/GNUstep/Defaults/WindowMaker..."

$WDWRITE WindowMaker WindowTitleFont "$WindowTitleFont"
$WDWRITE WindowMaker MenuTitleFont "$MenuTitleFont"
$WDWRITE WindowMaker MenuTextFont "$MenuTextFont"
$WDWRITE WindowMaker IconTitleFont "$IconTitleFont"
$WDWRITE WindowMaker ClipTitleFont "$ClipTitleFont"
$WDWRITE WindowMaker DisplayFont "$DisplayFont"
$WDWRITE WindowMaker LargeDisplayFont "$LargeDisplayFont"

echo
echo "WindowTitleFont=$WindowTitleFont"
echo "MenuTitleFont=$MenuTitleFont"
echo "MenuTextFont=$MenuTextFont"
echo "IconTitleFont=$IconTitleFont"
echo "ClipTitleFont=$ClipTitleFont"
echo "DisplayFont=$DisplayFont"
echo "LargeDisplayFont=$LargeDisplayFont"
echo
echo "Done."
