123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- #!/bin/sh
- Usage() {
- cat <<EOF
- Usage: updmap-otf {hiragino|morisawa|kozuka|nofont|"installed font name"|auto|status}
- hiragino: set Hiragino Fonts embedded in pdf files by otf package
- morisawa: set Morisawa Fonts embedded in pdf files by otf package
- kozuka: set kozuka Fonts embedded in pdf files by otf package
- nofont: set no fonts are embedded
- If your system does not have above 3 font families,
- this target is selected automatically.
- "installed font name":
- set fonts which are installed as
- TEXMF/fonts/map/dvipdfm/otf-"install font name".map
- auto: set fonts automatically
- status: get information about current environment and usable font map
- EOF
- }
- CheckInstallFont() {
- if kpsewhich HiraMinPro-W3.otf >/dev/null ; then
- HIRAGINO=installed
- else
- HIRAGINO=""
- fi
-
- if kpsewhich A-OTF-RyuminPro-Light.otf >/dev/null ; then
- MORISAWA=installed
- else
- MORISAWA=""
- fi
- if kpsewhich KozMinPro-Regular.otf >/dev/null ; then
- KOZUKA=installed
- else
- KOZUKA=""
- fi
- }
- GetStatus() {
- STATUS=$(grep ^kanjiEmbed $(kpsewhich updmap.cfg) | awk '{print$2}')
- if kpsewhich otf-$STATUS.map >/dev/null ; then
- echo "CURRENT map file : otf-$STATUS.map"
- else
- echo "WARNING: Currently selected map file cannot be found: otf-$STATUS.map"
- fi
-
- for MAPFILE in otf-hiragino.map otf-morisawa.map otf-kozuka.map
- do
- if [ "$MAPFILE" = "otf-$STATUS.map" ] ; then
- continue
- fi
- mffound=`kpsewhich $MAPFILE`
- if [ -n "$mffound" ] ; then
- case "$MAPFILE" in
- otf-hiragino.map)
- if [ "$HIRAGINO" = "installed" ]; then
- echo "Standby map file : $MAPFILE"
- fi
- ;;
- otf-morisawa.map)
- if [ "$MORISAWA" = "installed" ]; then
- echo "Standby map file : $MAPFILE"
- fi
- ;;
- otf-kozuka.map)
- if [ "$KOZUKA" = "installed" ]; then
- echo "Standby map file : $MAPFILE"
- fi
- ;;
- *)
- echo "Should not happen!"
- ;;
- esac
- fi
- done
- }
- SetupMapFile() {
- MAPFILE=otf-$1.map
- if kpsewhich $MAPFILE >/dev/null ; then
- echo "Setting up ... $MAPFILE"
- updmap-sys -setoption kanjiEmbed $1
- updmap-sys
- else
- echo "NOT EXIST $MAPFILE"
- return 1
- fi
- }
- main() {
- mktexlsr 2> /dev/null
- CheckInstallFont
- if [ $# != 1 ] ; then
- eval Usage ${0##*/}
- return -1
- fi
- case "$1" in
- hiragino)
- if [ "$HIRAGINO" = "installed" ]; then
- SetupMapFile hiragino
- else
- main auto
- fi
- ;;
- morisawa)
- if [ "$MORISAWA" = "installed" ]; then
- SetupMapFile morisawa
- else
- main auto
- fi
- ;;
- kozuka)
- if [ "$KOZUKA" = "installed" ]; then
- SetupMapFile kozuka
- else
- main auto
- fi
- ;;
- nofont)
- SetupMapFile noEmbed
- ;;
- auto)
- GetStatus
- if [ "$STATUS" = "morisawa" ] && [ "$MORISAWA" = "installed" ]; then
- SetupMapFile morisawa
- elif [ "$STATUS" = "kozuka" ] && [ "$KOZUKA" = "installed" ]; then
- SetupMapFile kozuka
- elif [ "$STATUS" = "noEmbed" ] && [ "$HIRAGINO" = "installed" ]; then
- SetupMapFile hiragino
- elif [ "$HIRAGINO" = "installed" ]; then
- SetupMapFile hiragino
- elif [ "$MORISAWA" = "installed" ]; then
- SetupMapFile morisawa
- elif [ "$KOZUKA" = "installed" ]; then
- SetupMapFile kozuka
- else
- SetupMapFile noEmbed
- fi
- ;;
- status)
- GetStatus
- return 0
- ;;
- *)
- SetupMapFile $1
- ;;
- esac
- }
- main $@
|