source: projects/vutils/trunk/update-defaultfont @ 9944

Revision 9944, 7.2 KB checked in by munepi, 8 years ago (diff)

update-defaultfont: fixed

Line 
1#!/bin/bash
2
3# default font setting script for Vine Linux 7/7CR
4# used by tex, gs, xpdf..
5#
6# usage: update-defaultfont
7
8TEXMF=/var/lib/texmf
9PTEXMAPFILE=$TEXMF/fonts/map/dvipdfmx/vine/ptex-vine.map
10UPTEXMAPFILE=$TEXMF/fonts/map/dvipdfmx/vine/uptex-vine.map
11OTFMAPFILE=$TEXMF/fonts/map/dvipdfmx/vine/otf-vine.map
12OTFUPMAPFILE=$TEXMF/fonts/map/dvipdfmx/vine/otf-up-vine.map
13TEXALIASDIR=$TEXMF/fonts/truetype/vine
14ALIASDIR=/usr/share/fonts/alias/TrueType
15
16TMPPTEXMAPFILE=$(mktemp /tmp/ptex-vine.map.XXXXXX)
17TMPUPTEXMAPFILE=$(mktemp /tmp/uptex-vine.map.XXXXXX)
18TMPOTFMAPFILE=$(mktemp /tmp/otf-vine.map.XXXXXX)
19TMPOTFUPMAPFILE=$(mktemp /tmp/otf-up-vine.map.XXXXXX)
20
21# set default font symlink
22lnttf() {
23    F=$(fc-match -v "$2" | grep "file:" | cut -f2 -d\")
24    ln -sf $F $TEXALIASDIR/$3.ttf
25    ln -sf $F $ALIASDIR/$3.ttf
26    cat <<EOF >> $TMPPTEXMAPFILE
27% $1 %
28$1      H       $3.ttf
29t$1     V       $3.ttf
30$1i     H       $3.ttf -s .3
31t$1i    V       $3.ttf -s .3
32
33EOF
34}
35
36# make symlink for CR fonts
37lnttc() {
38    F=$(find /usr/share/fonts/ -name "$2.ttc" -type f | head -1)
39    if [ -f "$F" ]; then
40      ln -sf $F $TEXALIASDIR/$3.ttc
41      cat <<EOF >> $TMPPTEXMAPFILE
42% $3 %
43$1      H       $3.ttc
44t$1     V       $3.ttc
45$1i     H       $3.ttc -s .3
46t$1i    V       $3.ttc -s .3
47
48EOF
49    fi
50}
51
52########################################################################################
53
54cat <<EOF > $TMPPTEXMAPFILE
55% Vine additional map %
56rml     2004-H  Mincho-Medium.ttf
57rmlv    2004-V  Mincho-Medium.ttf
58gbm     2004-H  Gothic-Medium.ttf
59gbmv    2004-V  Gothic-Medium.ttf
60
61% italic %
62rmli    2004-H  Mincho-Medium.ttf,Italic
63rmlvi   2004-V  Mincho-Medium.ttf,Italic
64gbmi    2004-H  Gothic-Medium.ttf,Italic
65gbmvi   2004-V  Gothic-Medium.ttf,Italic
66
67% new JIS font metric %
68rmln    2004-H  Mincho-Medium.ttf
69rmlnv   2004-V  Mincho-Medium.ttf
70gbmn    2004-H  Gothic-Medium.ttf
71gbmnv   2004-V  Gothic-Medium.ttf
72
73EOF
74
75cat <<EOF > $TMPUPTEXMAPFILE
76urml            UniJIS2004-UTF16-H      Mincho-Medium.ttf
77urmlv           UniJIS2004-UTF16-V      Mincho-Medium.ttf
78ugbm            UniJIS2004-UTF16-H      Gothic-Medium.ttf
79ugbmv           UniJIS2004-UTF16-V      Gothic-Medium.ttf
80
81uprml-h         UniJIS2004-UTF16-H      Mincho-Medium.ttf
82uprml-v         UniJIS2004-UTF16-V      Mincho-Medium.ttf
83upgbm-h         UniJIS2004-UTF16-H      Gothic-Medium.ttf
84upgbm-v         UniJIS2004-UTF16-V      Gothic-Medium.ttf
85uprml-hq        UniJIS-UCS2-H   Mincho-Medium.ttf
86upgbm-hq        UniJIS-UCS2-H   Gothic-Medium.ttf
87
88EOF
89
90cat<<EOF > $TMPOTFMAPFILE
91% TEXT, 90JIS
92hminl-h H       Mincho-Medium.ttf
93hminl-v V       Mincho-Medium.ttf
94hminr-h H       Mincho-Medium.ttf
95hminr-v V       Mincho-Medium.ttf
96hminb-h H       FutoMin-Bold.ttf
97hminb-v V       FutoMin-Bold.ttf
98hgothr-h        H       Gothic-Medium.ttf
99hgothr-v        V       Gothic-Medium.ttf
100hgothb-h        H       FutoGo-Bold.ttf
101hgothb-v        V       FutoGo-Bold.ttf
102hgotheb-h       H       FutoGo-Bold.ttf
103hgotheb-v       V       FutoGo-Bold.ttf
104hmgothr-h       H       MaruGo-Medium.ttf
105hmgothr-v       V       MaruGo-Medium.ttf
106
107% TEXT, JIS04
108hminln-h        2004-H  Mincho-Medium.ttf
109hminln-v        2004-V  Mincho-Medium.ttf
110hminrn-h        2004-H  Mincho-Medium.ttf
111hminrn-v        2004-V  Mincho-Medium.ttf
112hminbn-h        2004-H  FutoMin-Bold.ttf
113hminbn-v        2004-V  FutoMin-Bold.ttf
114hgothrn-h       2004-H  Gothic-Medium.ttf
115hgothrn-v       2004-V  Gothic-Medium.ttf
116hgothbn-h       2004-H  FutoGo-Bold.ttf
117hgothbn-v       2004-V  FutoGo-Bold.ttf
118hgothebn-h      2004-H  FutoGo-Bold.ttf
119hgothebn-v      2004-V  FutoGo-Bold.ttf
120hmgothrn-h      2004-H  MaruGo-Medium.ttf
121hmgothrn-v      2004-V  MaruGo-Medium.ttf
122
123% CID
124otf-cjml-h      Identity-H      Mincho-Medium.ttf
125otf-cjml-v      Identity-V      Mincho-Medium.ttf
126otf-cjmr-h      Identity-H      Mincho-Medium.ttf
127otf-cjmr-v      Identity-V      Mincho-Medium.ttf
128otf-cjmb-h      Identity-H      FutoMin-Bold.ttf
129otf-cjmb-v      Identity-V      FutoMin-Bold.ttf
130otf-cjgr-h      Identity-H      Gothic-Medium.ttf
131otf-cjgr-v      Identity-V      Gothic-Medium.ttf
132otf-cjgb-h      Identity-H      FutoGo-Bold.ttf
133otf-cjgb-v      Identity-V      FutoGo-Bold.ttf
134otf-cjge-h      Identity-H      FutoGo-Bold.ttf
135otf-cjge-v      Identity-V      FutoGo-Bold.ttf
136otf-cjmgr-h     Identity-H      MaruGo-Medium.ttf
137otf-cjmgr-v     Identity-V      MaruGo-Medium.ttf
138
139% Unicode 90JIS
140otf-ujml-h      UniJIS-UTF16-H  Mincho-Medium.ttf
141otf-ujml-v      UniJIS-UTF16-V  Mincho-Medium.ttf
142otf-ujmr-h      UniJIS-UTF16-H  Mincho-Medium.ttf
143otf-ujmr-v      UniJIS-UTF16-V  Mincho-Medium.ttf
144otf-ujmb-h      UniJIS-UTF16-H  FutoMin-Bold.ttf
145otf-ujmb-v      UniJIS-UTF16-V  FutoMin-Bold.ttf
146otf-ujgr-h      UniJIS-UTF16-H  Gothic-Medium.ttf
147otf-ujgr-v      UniJIS-UTF16-V  Gothic-Medium.ttf
148otf-ujgb-h      UniJIS-UTF16-H  FutoGo-Bold.ttf
149otf-ujgb-v      UniJIS-UTF16-V  FutoGo-Bold.ttf
150otf-ujge-h      UniJIS-UTF16-H  FutoGo-Bold.ttf
151otf-ujge-v      UniJIS-UTF16-V  FutoGo-Bold.ttf
152otf-ujmgr-h     UniJIS-UTF16-H  MaruGo-Medium.ttf
153otf-ujmgr-v     UniJIS-UTF16-V  MaruGo-Medium.ttf
154
155% Unicode JIS04
156otf-ujmln-h     UniJIS2004-UTF16-H      Mincho-Medium.ttf
157otf-ujmln-v     UniJIS2004-UTF16-V      Mincho-Medium.ttf
158otf-ujmrn-h     UniJIS2004-UTF16-H      Mincho-Medium.ttf
159otf-ujmrn-v     UniJIS2004-UTF16-V      Mincho-Medium.ttf
160otf-ujmbn-h     UniJIS2004-UTF16-H      FutoMin-Bold.ttf
161otf-ujmbn-v     UniJIS2004-UTF16-V      FutoMin-Bold.ttf
162otf-ujgrn-h     UniJIS2004-UTF16-H      Gothic-Medium.ttf
163otf-ujgrn-v     UniJIS2004-UTF16-V      Gothic-Medium.ttf
164otf-ujgbn-h     UniJIS2004-UTF16-H      FutoGo-Bold.ttf
165otf-ujgbn-v     UniJIS2004-UTF16-V      FutoGo-Bold.ttf
166otf-ujgen-h     UniJIS2004-UTF16-H      FutoGo-Bold.ttf
167otf-ujgen-v     UniJIS2004-UTF16-V      FutoGo-Bold.ttf
168otf-ujmgrn-h    UniJIS2004-UTF16-H      MaruGo-Medium.ttf
169otf-ujmgrn-v    UniJIS2004-UTF16-V      MaruGo-Medium.ttf
170
171EOF
172
173cat<<EOF > $TMPOTFUPMAPFILE
174
175% TEXT, 90JIS
176uphminl-h       UniJIS-UTF16-H  Mincho-Medium.ttf
177uphminl-v       UniJIS-UTF16-V  Mincho-Medium.ttf
178uphminr-h       UniJIS-UTF16-H  Mincho-Medium.ttf
179uphminr-v       UniJIS-UTF16-V  Mincho-Medium.ttf
180uphminb-h       UniJIS-UTF16-H  FutoMin-Bold.ttf
181uphminb-v       UniJIS-UTF16-V  FutoMin-Bold.ttf
182uphgothr-h      UniJIS-UTF16-H  Gothic-Medium.ttf
183uphgothr-v      UniJIS-UTF16-V  Gothic-Medium.ttf
184uphgothb-h      UniJIS-UTF16-H  FutoGo-Bold.ttf
185uphgothb-v      UniJIS-UTF16-V  FutoGo-Bold.ttf
186uphgotheb-h     UniJIS-UTF16-H  FutoGo-Bold.ttf
187uphgotheb-v     UniJIS-UTF16-V  FutoGo-Bold.ttf
188uphmgothr-h     UniJIS-UTF16-H  MaruGo-Medium.ttf
189uphmgothr-v     UniJIS-UTF16-V  MaruGo-Medium.ttf
190
191% TEXT, JIS04
192uphminln-h      UniJIS2004-UTF16-H      Mincho-Medium.ttf
193uphminln-v      UniJIS2004-UTF16-V      Mincho-Medium.ttf
194uphminrn-h      UniJIS2004-UTF16-H      Mincho-Medium.ttf
195uphminrn-v      UniJIS2004-UTF16-V      Mincho-Medium.ttf
196uphminbn-h      UniJIS2004-UTF16-H      FutoMin-Bold.ttf
197uphminbn-v      UniJIS2004-UTF16-V      FutoMin-Bold.ttf
198uphgothrn-h     UniJIS2004-UTF16-H      Gothic-Medium.ttf
199uphgothrn-v     UniJIS2004-UTF16-V      Gothic-Medium.ttf
200uphgothbn-h     UniJIS2004-UTF16-H      FutoGo-Bold.ttf
201uphgothbn-v     UniJIS2004-UTF16-V      FutoGo-Bold.ttf
202uphgothebn-h    UniJIS2004-UTF16-H      FutoGo-Bold.ttf
203uphgothebn-v    UniJIS2004-UTF16-V      FutoGo-Bold.ttf
204uphmgothrn-h    UniJIS2004-UTF16-H      MaruGo-Medium.ttf
205uphmgothrn-v    UniJIS2004-UTF16-V      MaruGo-Medium.ttf
206
207EOF
208
209## make these directories if these do not exists
210mkdir -p $TEXALIASDIR $ALIASDIR
211
212## remove broken symbolic links
213rm -f $TEXALIASDIR/*
214rm -f $ALIASDIR/*
215#find -L $TEXALIASDIR -type l -exec rm -f \{\} \;
216#find -L $ALIASDIR -type l -exec rm -f \{\} \;
217
218## alias font
219#     tfm name  fontconfig alias                PostScript name
220lnttf min       Serif                           Mincho-Medium
221lnttf goth      Sans                            Gothic-Medium
222lnttf futomin   FutoMin                         FutoMin-Bold
223lnttf futogo    FutoGo                          FutoGo-Bold
224lnttf marugo    Jun                             MaruGo-Medium
225
226# make symlink for CR fonts
227for i in /usr/share/vine/fonts.d/*
228do
229  if echo $file | grep -q "lnttc-.*\.sh$" ; then
230    . $i
231  fi
232done
233
234#
235cp -f $TMPPTEXMAPFILE $PTEXMAPFILE
236cp -f $TMPUPTEXMAPFILE $UPTEXMAPFILE
237cp -f $TMPOTFMAPFILE $OTFMAPFILE
238cp -f $TMPOTFUPMAPFILE $OTFUPMAPFILE
239rm -f $TMPPTEXMAPFILE $TMPUPTEXMAPFILE $TMPOTFMAPFILE $TMPOTFUPMAPFILE
240chmod 644 $PTEXMAPFILE $UPTEXMAPFILE $OTFMAPFILE $OTFUPMAPFILE
Note: See TracBrowser for help on using the repository browser.