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"
36 cat >/dev
/stderr
<<EOF
37 $PROGRAM - font/language setting utility for Window Maker
40 $PROGRAM [--nodef] [--auto] <font_family>
41 -----------------------------------------------------------------------
42 [font_fam] [Fontset] [Font Information]
44 latin1 helvetica(iso8859-1)
45 latin2 helvetica(iso8859-2) See *Note1.
46 greek helvetica(iso8859-7) See *Note1.
47 japanese helvetica/-*-fixed(jisx02XX) Included in X11R6/XFree86("fnon" pkg)
48 korean helvetica/-*-kodig(ksc5601) See *Note1.
49 korean2 helvetica/daewoo(ksc5601) Included in X11R6/XFree86("fnon" pkg)
50 russian helvetica(koi8-r) Included in X11R6/XFree86("fcyr" pkg)
51 turkish unknown See *Note2.
52 -----------------------------------------------------------------------
53 Latin1 Languages: Danish/Dutch/English/Finnish/French/Galician/German/
54 Italian/Norwegian/Portuguese/Spanish/Swedish/...
55 Latin2 Languages: Croatian/Czech/Polish/Romanian/Slovenian/...
57 *Note1: Not included in X11R6/XFree86. You can download them from ...
58 Latin2 X fonts packages: http://sizif.mf.uni-lj.si/linux/cee/iso8859-2.html
59 Greek X fonts packages: ftp://argeas.argos.hol.gr/pub/unix/linux/GREEK/fonts/
60 ftp://ftp.ntua.gr/pub/fonts/X11/
61 Korean X fonts packages: ftp://linux.sarang.net (Linux RPM)
62 ftp://ftp.kaist.ac.kr/pub/hangul/fonts
63 *Note2: please let me know appropriate font setting for WMGLOBAL/WindowMaker,
64 and the fonts' URL to download. mail-to: manome@itlb.te.noda.sut.ac.jp
79 new_locale
=`echo $i |sed -e "s|--locale=||" -`;;
81 if [ -z $family ]; then
88 if [ -z "$family" ] && [ -z "$new_locale" ] && [ -z "$auto" ]; then
92 ################################################################################
93 # You should make changes only in this area
94 # (or it is not what I wanted it to be...)
98 # For --auto and --locale= switch...
100 all_codings
="latin1 latin2 greek japanese korean2 russian"
101 latin1
="ca da de gl nl fi fr de is it no pt es sv se"
102 latin2
="hr cz cs hu pl ro sk sl"
109 # These are lists of all domains and keys we're gonna change...
111 DomainNames
="WMGLOBAL WindowMaker"
112 DomainWMGLOBAL
="SystemFont BoldSystemFont MultiByteText"
113 DomainWindowMaker
="WindowTitleFont MenuTitleFont MenuTextFont IconTitleFont ClipTitleFont DisplayFont"
115 for i
in $DomainNames; do
117 eval AllKeys
="\"$AllKeys \$${tmp}\""
121 # Items that don't need to have coding string appended ( = not fonts).
123 NotFont
="MultiByteText"
126 # Elements of $NodefUnable will always have fonts set to defaults, while those
127 # of $NonedefAble will have changed only coding part of font name (if --nodef
128 # command line argument is used).
130 NodefAble
="default latin1 latin2 greek russian"
131 NodefUnable
="japanese korean korean2"
132 Supported
="$NodefAble $NodefUnable"
135 latin1Coding
="iso8859-1"
136 latin2Coding
="iso8859-2"
137 greekCoding
="iso8859-7"
138 russianCoding
="koi8-r"
140 defaultMultiByteText
="AUTO"
141 latin1MultiByteText
="NO"
142 latin2MultiByteText
="YES"
143 greekMultiByteText
="YES"
144 russianMultiByteText
="YES"
147 # Default WindowMaker fonts for NodefAble font families (part telling us
148 # the font coding will be added automaticly from *Coding).
150 DefaultSystemFont
="-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-"
151 DefaultBoldSystemFont
="-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-"
152 DefaultWindowTitleFont
="-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-"
153 DefaultMenuTitleFont
="-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-"
154 DefaultMenuTextFont
="-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-"
155 DefaultIconTitleFont
="-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-"
156 DefaultClipTitleFont
="-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-"
157 DefaultDisplayFont
="-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-"
158 DefaultMultiByteText
="AUTO"
161 # NodefUnable have to give full font descriptions...
163 japaneseSystemFont
="-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-%d-*,-*-*-medium-r-normal-*-*-*"
164 japaneseBoldSystemFont
="-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-%d-*,-*-*-medium-r-normal-*-*-*"
165 japaneseWindowTitleFont
="-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-14-*,-*-*-medium-r-normal-*-*-*"
166 japaneseMenuTitleFont
="-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-14-*,-*-*-medium-r-normal-*-*-*"
167 japaneseMenuTextFont
="-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-14-*,-*-*-medium-r-normal-*-*-*"
168 japaneseIconTitleFont
="-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-*-*"
169 japaneseClipTitleFont
="-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-*-*"
170 japaneseDisplayFont
="-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-14-*,-*-*-medium-r-normal-*-*-*"
171 japaneseMultiByteText
="YES"
173 koreanSystemFont
="-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--%d-*-*-*-*-*-*-*,*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*,*-*-*-*-*--%d-*-*-*-*-*-*-*,*"
174 koreanBoldSystemFont
="-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-kodig-bold-r-normal--%d-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--%d-*-*-*-*-*-*-*,*-*-bold-r-normal-*-%d-*-*-*-*-*-*-*,*-*-*-*-*--%d-*-*-*-*-*-*-*,*"
175 koreanWindowTitleFont
="-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--12-*-*-*-*-*-*-*,-*-*-medium-r-normal--12-*-*-*-*-*-*-*,-*-*-medium-r-normal--*-*-*-*-*-*-*-*,-*-*-*-r-normal--*-*-*-*-*-*-*-*,-*-*-*-*-*--*-*-*-*-*-*-*-*,*"
176 koreanMenuTitleFont
="-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--14-*-*-*-*-*-*-*,-*-*-medium-r-normal--12-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*"
177 koreanMenuTextFont
="-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--14-*-*-*-*-*-*-*,*-*-medium-r-normal--12-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*"
178 koreanIconTitleFont
="-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--10-*-*-*-*-*-*-*,*-*-medium-r-normal--10-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*"
179 koreanClipTitleFont
="-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--10-*-*-*-*-*-*-*,*-*-medium-r-normal--10-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*"
180 koreanDisplayFont
="-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-kodig-medium-r-normal--12-*-*-*-*-*-*-*,*-*-medium-r-normal--12-*-*-*-*-*-*-*,*-*-medium-r-normal--*-*-*-*-*-*-*-*,*-*-*-r-normal--*-*-*-*-*-*-*-*,*"
181 koreanMultiByteText
="YES"
183 korean2SystemFont
="-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-medium-r-normal-*-%d-*,-*-medium-r-normal-*"
184 korean2BoldSystemFont
="-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-medium-r-normal-*-%d-*,-*-medium-r-normal-*"
185 korean2WindowTitleFont
="7x14,-*-gothic-medium-r-normal-*-16-*-*-*-*-*-ksc5601.1987-*"
186 korean2MenuTitleFont
="7x14,-*-gothic-medium-r-normal-*-16-*-*-*-*-*-ksc5601.1987-*"
187 korean2MenuTextFont
="7x14,-*-gothic-medium-r-normal-*-16-*-*-*-*-*-ksc5601.1987-*"
188 korean2IconTitleFont
="-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*,-*-gothic-medium-r-normal-*-12-*-*-*-*-*-ksc5601.1987-*"
189 korean2ClipTitleFont
="-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*,-*-gothic-medium-r-normal-*-12-*-*-*-*-*-ksc5601.1987-*"
190 korean2DisplayFont
="-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,-*-gothic-medium-r-normal-*-16-*-*-*-*-*-ksc5601.1987-*"
191 korean2MultiByteText
="YES"
194 # End of area meant to hold everything you could need to modify...
195 ################################################################################
198 # Get current locale automaticaly (--auto).
200 if [ -z "$family" ]; then
201 if [ -n "$new_locale" ]; then
205 if [ -z "$locale" ]; then
210 if [ -z "$locale" ]; then
213 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
236 cat >/dev
/stderr
<<EOT
237 Sorry, font coding $family or locale $locale not recognized.
238 Type $PROGRAM with no arguments for list of supported font codings...
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
250 cat >/dev
/stderr
<<-EOT
251 Sorry, --nodef argument is not allowed for these font codings:
253 Run $PROGRAM without --nodef argument to set default fonts for your
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}"
291 cat >/dev
/stderr
<<EOT
292 You used --nodef command line argument. You should note, that this
293 works with these font codings only:
295 You should not use it to change fonts from other font codings than
296 those listed above. If your WindowMaker does not appear to find fonts,
297 you should run $PROGRAM once again without --nodef argument.
302 # Ok, in the following, `i' will be the domain file name,
303 # `j' is the actual key in that file we try to change...
305 for i
in $DomainNames; do
307 echo "Setting up $i domain file..."
311 if test -n "$nodef"; then # --nodef, change coding only
313 for k
in $NotFont; do
314 if test "$k" = "$j"; then
319 if test -n "$not_font"; then # don't append coding
323 #TODO:make this funny sed script a lot smarter to let us make changes in font
324 # lists, etc... (then we can enable --nodef for NodefUnable codings)
325 #TODO:better (or at least any) check, whether wmaker is installed...
326 tmp1
="${family}Coding"
327 eval _tmp1
="\$${tmp1}"
328 eval $j=`$WDREAD $i $j | sed -e "s/\(^-.*-\).*-.*$/\1${_tmp1}/g"`
330 if test -z "${_j}"; then # failed, load default
336 tmp1
="$j=\"`eval echo '${'$j'}'`\"" # cosmetic length workaround
338 if [ ${#tmp1} -lt 80 ]; then
339 tmp1
=`echo $tmp1 | sed -e 's/^\(.\{1,76\}\).*/\1/'`
343 $WDWRITE $i $j \"${_j}\"