3 # language/font setting script for Window Maker
5 # by MANOME Tomonori <manome@itlb.te.noda.sut.ac.jp>
6 # (rewriten slightly by judas@hell on Jan 27 2001
7 # -argument --nodef tries to change only font coding (limited!)
8 # -much easier to add new font codings
9 # -much harder to read code...
10 # -argument --auto gets locale by itself, but does not override if some
11 # coding is also given
12 # -argument --locale=?? takes locale code (ja, sk, ...)
16 # Korean fontset info from:
17 # Byeong-Chan, Kim <redhands@linux.sarang.net>
18 # Chae-yong Chong <cychong@metro.telecom.samsung.co.kr>
19 # Latin2 fontset info from:
20 # Piotr Dembinski <pdemb@aurora.put.poznan.pl>
21 # Toni Bilic <root@toni.hr.tel.hr>
22 # Greek fontset info from:
23 # Nikolaos Papagrigoriou <papanikos@usa.net>
24 # Quote bug fix info from:
25 # Luke Kendall <luke@research.canon.com.au>
26 # Bug fix info for Korean font section from:
27 # CHOI Junho <junker@jazz.snu.ac.kr>
29 VERSION
="Version 0.5 1998/12/07"
37 "$PROGRAM - font/language setting utility for Window Maker\n"\
40 " $PROGRAM [--nodef] [--auto] <font_family>" >/dev
/stderr
41 cat >/dev
/stderr
<<EOF
42 -----------------------------------------------------------------------
43 [font_fam] [Fontset] [Font Information]
45 latin1 helvetica(iso8859-1)
46 latin2 helvetica(iso8859-2) See *Note1.
47 greek helvetica(iso8859-7) See *Note1.
48 japanese helvetica/-*-fixed(jisx02XX) Included in X11R6/XFree86("fnon" pkg)
49 korean helvetica/-*-kodig(ksc5601) See *Note1.
50 korean2 helvetica/daewoo(ksc5601) Included in X11R6/XFree86("fnon" pkg)
51 russian helvetica(koi8-r) Included in X11R6/XFree86("fcyr" pkg)
52 turkish unknown See *Note2.
53 -----------------------------------------------------------------------
54 Latin1 Languages: Danish/Dutch/English/Finnish/French/Galician/German/
55 Italian/Norwegian/Portuguese/Spanish/Swedish/...
56 Latin2 Languages: Croatian/Czech/Polish/Romanian/Slovenian/...
58 *Note1: Not included in X11R6/XFree86. You can download them from ...
59 Latin2 X fonts packages: http://sizif.mf.uni-lj.si/linux/cee/iso8859-2.html
60 Greek X fonts packages: ftp://argeas.argos.hol.gr/pub/unix/linux/GREEK/fonts/
61 ftp://ftp.ntua.gr/pub/fonts/X11/
62 Korean X fonts packages: ftp://linux.sarang.net (Linux RPM)
63 ftp://ftp.kaist.ac.kr/pub/hangul/fonts
64 *Note2: please let me know appropriate font setting for WMGLOBAL/WindowMaker,
65 and the fonts' URL to download. mail-to: manome@itlb.te.noda.sut.ac.jp
80 if echo $i |
grep "^--locale=" &>/dev
/null
; then
81 new_locale
=$
(echo $i |
sed -e "s|--locale=||" -)
82 elif [ -z $family ]; then
89 if [ -z "$family" ] && [ -z "$new_locale" ] && [ -z "$auto" ]; then
93 ################################################################################
94 # You should make changes only in this area
95 # (or it is not what I wanted it to be...)
99 # For --auto and --locale= switch...
101 all_codings
="latin1 latin2 greek japanese korean2 russian"
102 latin1
="ca da de gl nl fi fr de is it no pt es sv se"
103 latin2
="hr cz cs hu pl ro sk sl"
110 # These are lists of all domains and keys we're gonna change...
112 DomainNames
="WMGLOBAL WindowMaker"
113 DomainWMGLOBAL
="SystemFont BoldSystemFont MultiByteText"
114 DomainWindowMaker
="WindowTitleFont MenuTitleFont MenuTextFont IconTitleFont ClipTitleFont DisplayFont"
116 for i
in $DomainNames; do
118 AllKeys
="$AllKeys ${!tmp}"
122 # Items that don't need to have coding string appended ( = not fonts).
124 NotFont
="MultiByteText"
127 # Elements of $NodefUnable will always have fonts set to defaults, while those
128 # of $NonedefAble will have changed only coding part of font name (if --nodef
129 # command line argument is used).
131 NodefAble
="default latin1 latin2 greek russian"
132 NodefUnable
="japanese korean korean2"
133 Supported
="$NodefAble $NodefUnable"
136 latin1Coding
="iso8859-1"
137 latin2Coding
="iso8859-2"
138 greekCoding
="iso8859-7"
139 russianCoding
="koi8-r"
141 defaultMultiByteText
="AUTO"
142 latin1MultiByteText
="NO"
143 latin2MultiByteText
="YES"
144 greekMultiByteText
="YES"
145 russianMultiByteText
="YES"
148 # Default WindowMaker fonts for NodefAble font families (part telling us
149 # the font coding will be added automaticly from *Coding).
151 DefaultSystemFont
="-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-"
152 DefaultBoldSystemFont
="-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-"
153 DefaultWindowTitleFont
="-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-"
154 DefaultMenuTitleFont
="-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-"
155 DefaultMenuTextFont
="-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-"
156 DefaultIconTitleFont
="-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-"
157 DefaultClipTitleFont
="-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-"
158 DefaultDisplayFont
="-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-"
159 DefaultMultiByteText
="AUTO"
162 # NodefUnable have to give full font descriptions...
164 japaneseSystemFont
=\"-*-helvetica-medium-r-normal-*-%d-
*-*-*-*-*-*-*,-*-*-medium-r-normal-*-%d-
*,-*-*-medium-r-normal-*-*-*\"
165 japaneseBoldSystemFont
=\"-*-helvetica-bold-r-normal-*-%d-
*-*-*-*-*-*-*,-*-*-medium-r-normal-*-%d-
*,-*-*-medium-r-normal-*-*-*\"
166 japaneseWindowTitleFont
=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-14-*,-*-*-medium-r-normal-*-*-*\"
167 japaneseMenuTitleFont
=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-14-*,-*-*-medium-r-normal-*-*-*\"
168 japaneseMenuTextFont
=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-14-*,-*-*-medium-r-normal-*-*-*\"
169 japaneseIconTitleFont
=\"-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-*-*\"
170 japaneseClipTitleFont
=\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-*-*\"
171 japaneseDisplayFont
=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-14-*,-*-*-medium-r-normal-*-*-*\"
172 japaneseMultiByteText
="YES"
174 koreanSystemFont
=\"-*-helvetica-medium-r-normal-*-%d-
*-*-*-*-*-*-*,-*-kodig-medium-r-normal--%d-
*-*-*-*-*-*-*,*-*-medium-r-normal-*-%d-
*-*-*-*-*-*-*,*-*-*-*-*--%d-
*-*-*-*-*-*-*,*\"
175 koreanBoldSystemFont
=\"-*-helvetica-bold-r-normal-*-%d-
*-*-*-*-*-*-*,-*-kodig-bold-r-normal--%d-
*-*-*-*-*-*-*,-*-kodig-medium-r-normal--%d-
*-*-*-*-*-*-*,*-*-bold-r-normal-*-%d-
*-*-*-*-*-*-*,*-*-*-*-*--%d-
*-*-*-*-*-*-*,*\"
176 koreanWindowTitleFont
=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--12-*-*-*-*-*-*-*,-*-*-medium-r-normal--12-*-*-*-*-*-*-*,-*-*-medium-r-normal--*-*-*-*-*-*-*-*,-*-*-*-r-normal--*-*-*-*-*-*-*-*,-*-*-*-*-*--*-*-*-*-*-*-*-*,*\"
177 koreanMenuTitleFont
=\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--14-*-*-*-*-*-*-*,-*-*-medium-r-normal--12-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*\"
178 koreanMenuTextFont
=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--14-*-*-*-*-*-*-*,*-*-medium-r-normal--12-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*\"
179 koreanIconTitleFont
=\"-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--10-*-*-*-*-*-*-*,*-*-medium-r-normal--10-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*\"
180 koreanClipTitleFont
=\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--10-*-*-*-*-*-*-*,*-*-medium-r-normal--10-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*\"
181 koreanDisplayFont
=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--12-*-*-*-*-*-*-*,*-*-medium-r-normal--12-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*\"
182 koreanMultiByteText
="YES"
184 korean2SystemFont
=\"-*-helvetica-medium-r-normal-*-%d-
*-*-*-*-*-*-*,-*-medium-r-normal-*-%d-
*,-*-medium-r-normal-*\"
185 korean2BoldSystemFont
=\"-*-helvetica-bold-r-normal-*-%d-
*-*-*-*-*-*-*,-*-medium-r-normal-*-%d-
*,-*-medium-r-normal-*\"
186 korean2WindowTitleFont
=\"7x14
,-*-gothic-medium-r-normal-*-16-*-*-*-*-*-ksc5601.1987
-*\"
187 korean2MenuTitleFont
=\"7x14
,-*-gothic-medium-r-normal-*-16-*-*-*-*-*-ksc5601.1987
-*\"
188 korean2MenuTextFont
=\"7x14
,-*-gothic-medium-r-normal-*-16-*-*-*-*-*-ksc5601.1987
-*\"
189 korean2IconTitleFont
=\"-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*,-*-gothic-medium-r-normal-*-12-*-*-*-*-*-ksc5601.1987
-*\"
190 korean2ClipTitleFont
=\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*,-*-gothic-medium-r-normal-*-12-*-*-*-*-*-ksc5601.1987
-*\"
191 korean2DisplayFont
=\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-gothic-medium-r-normal-*-16-*-*-*-*-*-ksc5601.1987
-*\"
192 korean2MultiByteText
="YES"
195 # End of area meant to hold everything you could need to modify...
196 ################################################################################
199 # Get current locale automaticaly (--auto).
201 if [ -z "$family" ]; then
202 if [ -n "$new_locale" ]; then
206 if [ -z "$locale" ]; then
211 if [ -z "$locale" ]; then
214 for i
in $all_codings; do
216 if [ "$j" == "${locale%_*}" ]; then
226 # Do we recognize passed coding?
229 for i
in $Supported; do
230 if test "$family" == "$i"; then
235 if test -z "$is_supported"; then # unknown coding
237 "Sorry, font coding $family or locale $locale not recognized.\n"\
238 "Type $PROGRAM with no arguments for list of supported font codings...\n"\
244 # Nodef is supported only for elements of $NodefAble.
247 for i
in $NodefUnable; do
248 if test "$family" == "$i"; then
249 if test -n "$nodef"; then # --nodef with one from $NodefUnable
251 "Sorry, --nodef argument is not allowed for these font codings:\n"\
253 "Run $PROGRAM without --nodef argument to set default fonts for your\n"\
258 is_nodef_unable
="YES"
267 if test -z "$nodef"; then
268 for i
in $AllKeys; do
269 if test -n "$is_nodef_unable"; then # japanese,... defaults
272 else # rest, load defaults
274 for j
in $NotFont; do
275 if test "$i" == "$j"; then
280 if test -n "$not_font"; then # don't append coding (not default!)
285 tmp1
="${family}Coding"
286 eval $i="${!tmp}${!tmp1}"
292 "You used --nodef command line argument. You should note, that this\n"\
293 "works with these font codings only:\n"\
295 "You should not use it to change fonts from other font codings than\n"\
296 "those listed above. If your WindowMaker does not appear to find fonts,\n"\
297 "you should run $PROGRAM once again without --nodef argument." >/dev
/stderr
301 # Ok, in the following, `i' will be the domain file name,
302 # `j' is the actual key in that file we try to change...
304 for i
in $DomainNames; do
306 echo "Setting up $i domain file..."
309 if test -n "$nodef"; then # --nodef, change coding only
311 for k
in $NotFont; do
312 if test "$k" == "$j"; then
317 if test -n "$not_font"; then # don't append coding
321 #TODO:make this funny sed script a lot smarter to let us make changes in font
322 # lists, etc... (then we can enable --nodef for NodefUnable codings)
323 #TODO:better (or at least any) check, whether wmaker is installed...
324 tmp1
="${family}Coding"
325 eval $j=$
($WDREAD $i $j |
sed -e "s/\(^-.*-\).*-.*$/\1${!tmp1}/g")
326 if test -z "${!j}"; then # failed, load default
332 tmp1
="$j=\"${!j}\"" # cosmetic length workaround
333 if (( ${#tmp1} > 80 )); then
334 tmp1
=$
(echo "${tmp1:0:76}...\"")
337 $WDWRITE $i $j \"${!j}\"