tizen 2.4 release
[framework/uifw/xorg/util/xfonts-utils.git] / xorg-x11-fonts-update-dirs
1 #!/bin/sh
2 # This script is used by the xorg-x11-fonts package in the %post stage for
3 # some fonts to generate the right encodings.
4
5 fontdir=""
6 encodingsdir="@DATADIR@/X11/fonts/encodings"
7
8 # some fonts need to skip mkfontscale, set to "yes" to skip
9 skip_fontscale=""
10 # some fonts need to run ttmkfdir, set to "yes" to run
11 need_ttmkfdir=""
12
13 if [ $# -lt 1 ]; then
14     echo "Need at least one parameter for font dir."
15     exit 1
16 fi
17
18 while [ $# != 0 ]; do
19     case $1 in
20         --skip-fontscale)
21         skip_fontscale="yes"
22         ;;
23         --need-ttmkfdir)
24         need_ttmkfdir="yes"
25         ;;
26         --encodingsdir)
27         shift
28         encodingsdir="$1"
29         ;;
30         *)
31         fontdir="$1"
32
33         if [ $# != 1 ]; then
34             echo "Too many parameters."
35             exit 1
36         fi
37         ;;
38     esac
39     shift
40 done
41
42 if [ "$skip_fontscale" != "yes" ]; then
43     mkfontscale $fontdir
44 fi
45 if [ "$need_ttmkfdir" = "yes" ]; then
46     ttmkfdir $fontdir
47 fi
48
49 mkfontdir $fontdir
50 fc-cache $fontdir
51
52 if ! [ -z "$encodingsdir" ]; then
53     [ -d "$encodingsdir" ] || mkdir -p "$encodingsdir"
54     oldpwd=$(pwd)
55     cd "$encodingsdir"
56     mkfontscale -n -e "$encodingsdir" -e "$encodingsdir/large"
57     cd ${oldpwd}
58 fi
59
60