Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Sep 2003 00:09:23 +0800 (CST)
From:      Statue <statue@freebsd.sinica.edu.tw>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/57180: Update port: chinese/ttfm
Message-ID:  <20030924160923.5D1FFAEE@freebsd.sinica.edu.tw>
Resent-Message-ID: <200309241610.h8OGAKt0010605@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         57180
>Category:       ports
>Synopsis:       Update port: chinese/ttfm
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 24 09:10:20 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Statue
>Release:        FreeBSD 4.9-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD freebsd.sinica.edu.tw 4.9-PRERELEASE FreeBSD 4.9-PRERELEASE #4: Mon Sep 15 18:44:48 CST 2003 root@freebsd.sinica.edu.tw:/usr/src/sys/compile/GENERIC i386


	
>Description:
update to 0.9.4
update MASTER_SITES
take maintainership
remove: files/patch-Makefile files/patch-modules::abiword.ttfm
	patch-modules::gscjk.ttfm patch-modules::xttfm.ttfm
	patch-ttfinfo.c
	
>How-To-Repeat:
	
>Fix:

diff -ruN ttfm.orig/Makefile ttfm/Makefile
--- ttfm.orig/Makefile	Thu Sep 25 00:05:03 2003
+++ ttfm/Makefile	Thu Sep 25 00:04:27 2003
@@ -6,20 +6,15 @@
 #
 
 PORTNAME=	ttfm
-PORTVERSION=	0.9.3
-PORTREVISION=	3
+PORTVERSION=	0.9.4
 CATEGORIES=	chinese print
-MASTER_SITES=	ftp://freebsd.sinica.edu.tw/pub/keith/ttfm/
+MASTER_SITES=	ftp://freebsd.sinica.edu.tw/pub/statue/ttfm/
 
-MAINTAINER=	keith@FreeBSD.org
+MAINTAINER=	statue@freebsd.sinica.edu.tw
 COMMENT=	A Big5/GB enhanced TrueType Font Manager
 
-.include <bsd.port.pre.mk>
-.if ${XFREE86_VERSION} == 4
 RUN_DEPENDS=	mkfontdir:${PORTSDIR}/x11/XFree86-4-clients
-.endif
-
-USE_FREETYPE=	yes
+LIB_DEPENDS=	freetype.9:${PORTSDIR}/print/freetype2
 
 FONTSDIR=	${PREFIX}/share/fonts/TrueType/
 MODULESDIR=	${PREFIX}/share/ttfm/
@@ -33,14 +28,11 @@
 .endfor
 	@${INSTALL_MAN} ${WRKSRC}/ttfm.sh.1 ${PREFIX}/man/man1
 	@${MKDIR} ${MODULESDIR}
-.for module in abiword.ttfm gscjk.ttfm xfreetype.ttfm xttfm.ttfm
+.for module in gscjk.ttfm xttfm.ttfm
 	@${INSTALL_SCRIPT} ${WRKSRC}/modules/${module} ${MODULESDIR}
 .endfor
-.for module in chitex.ttfm ghostscript6.ttfm ttf2pk.ttfm xttfm-tcl.ttfm
-	@${INSTALL_SCRIPT} ${WRKSRC}/modules/${module} ${MODULESDIR}/${module}.nop
-.endfor
 	@${MKDIR} ${FONTSDIR}
 
 MAN1=	ttfm.sh.1
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff -ruN ttfm.orig/distinfo ttfm/distinfo
--- ttfm.orig/distinfo	Thu Sep 25 00:05:03 2003
+++ ttfm/distinfo	Thu Sep 25 00:01:54 2003
@@ -1 +1 @@
-MD5 (ttfm-0.9.3.tar.gz) = fb9fb633adafa3523b5d4c222c848417
+MD5 (ttfm-0.9.4.tar.gz) = 53c67a9d7ef5379ee7ddaec033ca5244
diff -ruN ttfm.orig/files/patch-Makefile ttfm/files/patch-Makefile
--- ttfm.orig/files/patch-Makefile	Thu Sep 25 00:05:03 2003
+++ ttfm/files/patch-Makefile	Thu Jan  1 08:00:00 1970
@@ -1,12 +0,0 @@
-
-$FreeBSD: ports/chinese/ttfm/files/patch-Makefile,v 1.1 2002/03/14 11:16:37 sobomax Exp $
-
---- Makefile	2002/03/14 07:35:10	1.1
-+++ Makefile	2002/03/14 07:35:23
-@@ -1,5 +1,5 @@
- FREETYPE_BASE=/usr/local
--FREETYPE_INCL=$(FREETYPE_BASE)/include
-+FREETYPE_INCL=$(FREETYPE_BASE)/include/freetype1
- FREETYPE_LIB=$(FREETYPE_BASE)/lib
- prefix=/usr
- 
diff -ruN ttfm.orig/files/patch-modules::abiword.ttfm ttfm/files/patch-modules::abiword.ttfm
--- ttfm.orig/files/patch-modules::abiword.ttfm	Thu Sep 25 00:05:03 2003
+++ ttfm/files/patch-modules::abiword.ttfm	Thu Jan  1 08:00:00 1970
@@ -1,681 +0,0 @@
---- modules/abiword.ttfm.orig	Sun Jun  2 14:22:27 2002
-+++ modules/abiword.ttfm	Sun Jun  2 14:22:57 2002
-@@ -1,82 +1,56 @@
- #!/bin/sh
--#
--# TTFM's module for AbiWord 0.7.12.
--#
--# This script is distributed under the revised BSD license.
--#
--# For any problem reports or suggestions, please contact
--# Jing-Tang Keith Jang <keith@FreeBSD.org>.
--#
--
--#
--# AbiWord searches the following subdirectories under fonts/ for fonts.dir:
--# $country, $country-$region, $encoding, $country-$region.$encoding.  For
--# example, fonts/{zh, zh-TW, Big5, zh-TW.Big5} are all valid directories.
--# However, this module will only generate fonts/$encoding/fonts.dir for the
--# sake of simplicity.
--#
--# Here are the sample lines of a font in AbiWord's fonts.dir:
--#
--# Kai-Medium, -default-kai-medium-r-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000
--# Kai-Medium, -default-kai-bold-r-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000
--# Kai-Medium, -default-kai-medium-i-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000
--# Kai-Medium, -default-kai-bold-i-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000
--#
--# AbiWord uses the first field for printing, second field for displaying.
--# The last three fields are font's ascent, descent, and width, used when
--# printing.
--#
--# Because AbiWord follows normal X convention, there's no need that the font
--# must be TTF.  But we'll only accept TTF here, since it's better in scaling.
--# CID fonts may be supported in the future, depending on the demanding.
--#
--
--# Name & version
--export NAME; NAME="AbiWord Font Manager"
--export VERSION; VERSION=0.9.3
-+#/*
-+# * Copyrighy (c) 2001 CLE Project. All rights reserved.
-+# * Copyright (c) 2001 Chung-Yen Chang. All rights reserved.
-+# *    with Big5-HKSCS font support added by Anthony Fok
-+# *    thanks to ThizLinux Laboratory Ltd., Thiz Technology Group
-+# *
-+# * Redistribution and use in source and binary forms, with or without
-+# * modification, are permitted provided that the following conditions
-+# * are met:
-+# * 1. Redistributions of source code must retain the above copyright
-+# *    notice, this list of conditions and the following disclaimer.
-+# * 2. Redistributions in binary form must reproduce the above copyright
-+# *    notice, this list of conditions and the following disclaimer in the
-+# *    documentation and/or other materials provided with the distribution.
-+# * 3. All advertising materials mentioning features or use of this software
-+# *    must display the following acknowledgement:
-+# *      This product includes software developed by
-+# *      Chih-Wei Huang and contributors for CLE Project
-+# * 4. Neither the name of the Author nor the names of contributors
-+# *    may be used to endorse or promote products derived from this software
-+# *    without specific prior written permission.
-+# *
-+# *
-+# * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-+# * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+# * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+# * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-+# * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+# * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+# * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+# * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+# * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+# * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+# * SUCH DAMAGE.
-+# */
- 
- # Global constants
-+export TWABIFONTPATH; TWABIFONTPATH="/usr/X11R6/share/AbiSuite/fonts/zh-TW"
-+export CNABIFONTPATH; CNABIFONTPATH="/usr/X11R6/share/AbiSuite/fonts/zh-CN"
-+export HKABIFONTPATH; HKABIFONTPATH="/usr/X11R6/share/AbiSuite/fonts/zh-HK"
-+export TEMPFILE; TEMPFILE="`mktemp /tmp/ttfm.tmpXXXXXX`"
-+export DEFAULTPATH; DEFAULTPATH="/usr/local/share/fonts/TrueType"
-+
-+for i in $TWABIFONTPATH $CNABIFONTPATH $CNABIFONTPATH.GBK $HKABIFONTPATH; do
-+    test -d $i || mkdir $i
-+    test -f $i/fonts.dir || mkfontdir $i
-+    touch $i/.already-in-fp
-+done
- 
--export PREFIX; PREFIX=/usr/local
--export X11BASE; X11BASE=/usr/X11R6
--export PATH; PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PREFIX/bin:$PREFIX/sbin:$X11BASE/bin
--export TEMPFILE; TEMPFILE="`mktemp /tmp/ttfm.tmpXXX`"
--export ABIFontPath; ABIFontPath=$PREFIX/AbiSuite/fonts
--export DefaultFontPath; DefaultFontPath=$PREFIX/share/fonts/TrueType
--export TTFM; TTFM=$PREFIX/bin/ttfm.sh
--export XTTFFONTPATH; XTTFFONTPATH="$X11BASE/lib/X11/fonts/TrueType"
--export GSMODULE; GSMODULE="ghostscript6"
--export XMODULE; XMODULE="xttfm"
--export TTFINFOPATH; TTFINFOPATH="$PREFIX/bin/ttfinfo"
--export DEFAULTMING_NAME; DEFAULTMING_NAME="default_ming"
--export DEFAULTKAI_NAME; DEFAULTKAI_NAME="default_kai"
--export PRINTPARAM; PRINTPARAM="880, 120, 1000"
--
--
--#
--# Encoding/Directory table, used to convert the XLFD of a font to AbiWord's
--# charset directories, and vice versa.  Used by add_fonts().
--#
--export ed_table; ed_table=\
--"Big5,big5-0\n
--GB2312,gb2312.1980-0\n
--KSC5601,ksc5601.1987-0\n
--JISX0208,jisx0208.1983-0\n
--JISX0212,jisx0212.1990-0\n"
--
--
--#
--# Encoding/Postscript name table, used to convert a font's XLFD encoding
--# to its frequently used Postscript name.  I'm not sure if the entries
--# are correct, except Big5.
--#
--export ep_table; ep_table=\
--"big5-0,B5pc-H\n
--gb2312.1980-0,GBpc-EUC-H\n
--ksc5601.1987-0,KSCpc-EUC-H\n
--jisx0208.1983-0,EUC-H\n
--jisx0212.1990-0,Hojo-EUC-H\n"
--
-+# Name & version
-+export NAME; NAME="AbiWord 1.0.1 TrueType Font Manager"
-+export VERSION; VERSION=1.0
- 
- # Who am I?
- print_name()
-@@ -84,7 +58,6 @@
-     echo "$NAME $VERSION"
- }
- 
--
- # Usage
- Usage()
- {
-@@ -96,204 +69,275 @@
-     echo "       --add <file>...    install ttf font"
-     echo "       --remove <file>... remove ttf font from the system"
-     echo "       --list             list all ttf fonts on the system"
--    echo "       --setdefault <file> "
--    echo "                          set default font to file"
--    echo "       --setdefault_kai <file> "
--    echo "                          set default \kai font to file"
--    echo "       --setdefault_ming <file> "
--    echo "                          set default \ming font to file"
-     echo "       --help             show this info"
-     echo
- }
- 
- 
--check_abiword()
--{
--	 if [ ! -d $ABIFontPath ]; then
--		  mkdir -p $ABIFontPath
--	 fi
--	 fontsdirlist=`find $ABIFontPath -name fonts.dir`
--}
--
--
--#
--# List all fonts installed under $AbiFontPath
--#
--# I'm not sure if font filenames should also be displayed, since the XLFD
--# may be provided from xfs.
--#
-+# List all ttf fonts installed in $ABIFONTPATH
- list_fonts()
- {
--    if [ "X$fontsdirlist" = "X" ]; then
--        echo "No fonts installed."
-+    if [ -f ${TWABIFONTPATH}/fonts.dir -o -f ${CNABIFONTPATH}/fonts.dir \
-+	 -o -f ${HKABIFONTPATH}/fonts.dir ]; then
-+        echo "Installed TTF fonts:"
-+	if [ -f ${TWABIFONTPATH}/fonts.dir ]; then
-+          awk -F, 'FNR>1 {print $1,$2}' ${TWABIFONTPATH}/fonts.dir
-+	fi
-+	if [ -f ${CNABIFONTPATH}/fonts.dir ]; then
-+          awk -F, 'FNR>1 {print $1,$2}' ${CNABIFONTPATH}/fonts.dir
-+	fi
-+	if [ -f ${CNABIFONTPATH}.GBK/fonts.dir ]; then
-+          awk -F, 'FNR>1 {print $1,$2}' ${CNABIFONTPATH}.GBK/fonts.dir
-+	fi
-+	if [ -f ${HKABIFONTPATH}/fonts.dir ]; then
-+          awk -F, 'FNR>1 {print $1,$2}' ${HKABIFONTPATH}/fonts.dir
-+	fi
-+        echo
-     else
--        for f in $fontsdirlist; do
--            echo "In `dirname $f`:"
--            sed -e '1d' $f |cut -d ',' -f 1 |sort |uniq
--				echo
--        done
-+        echo "No TTF fonts installed!"
-     fi
- }
- 
-+# Get ttfinfo
-+get_ttfinfo()
-+{
-+    TTFINFO="/usr/local/bin/ttfinfo"
-+    if [ "z$TTFINFO" = "z" ]; then
-+        echo "ttfinfo not found, aborted!"
-+        exit 3
-+    fi
-+    eval `$TTFINFO $1`
-+}
- 
--#
--# Remove ttf fonts.  It accepts PS or TTF arguments, eg.
--# remove_fonts DefaultMingB5-Regular(series), or
--# remove_fonts /usr/local/share/fonts/TrueType/bsmi00lp.ttf.
--#
--# We won't delete font files, since the AbiWord module solely
--# depends on other modules like xttfm or ghostscript6, font
--# files should be managed by them, not here.
--#
--remove_fonts()
-+# Get Unicode fontmap
-+get_unicode_fontmap()
- {
--    for f in $@; do
--		  case $f in
--		  *.[Tt][Tt][CcFf])
--				i=`basename $f`
--				psnamelist=`$TTFM --list $GSMODULE |grep $i |cut -d '(' -f 1`
--				if [ -z "$psnamelist" ]; then
--					 echo "$f is not installed"
--					 continue
--				else
--				for psname in $psnamelist; do
--					 for fontsdir in $fontsdirlist; do
--						  sed -e "/^$psname/d" $fontsdir > $TEMPFILE
--						  num=`cat $TEMPFILE |wc -l`
--						  num=`expr $num - 1`
--						  sed -e "1s/.*/$num/g" $TEMPFILE > $fontsdir
--					 done
--				done
--				fi
--		  ;;
--		  *)
--				for fontsdir in $fontsdirlist; do
--					 sed -e "/$f/d" $fontsdir > $TEMPFILE
--					 num=`cat $TEMPFILE |wc -l`
--					 num=`expr $num - 1`
--					 sed -e "1s/.*/$num/g" $TEMPFILE > $fontsdir
--				done
--		  ;;
--		  esac
-+    j=1; n=0
-+    while [ $j -le $TTFINFO_MAPNUM ]; do
-+        eval "fontmap=\$TTFINFO_FONTMAP$j"
-+        if (echo $fontmap | grep -q big5); then
-+            eval "NAMEEXT$n=_big5; TBL$n=UBig5"; n=$(($n+1))
-+        elif (echo $fontmap | grep -q gb); then
-+            eval "NAMEEXT$n=_gb; TBL$n=UGB"; n=$(($n+1))
-+        elif (echo $fontmap | grep -q jisx0208); then
-+            eval "NAMEEXT$n=_jis; TBL$n=UJIS"; n=$(($n+1))
-+        elif (echo $fontmap | grep -q ksc5601); then
-+            eval "NAMEEXT$n=_ksc; TBL$n=UKS"; n=$(($n+1))
-+        fi
-+        j=$(($j+1))
-+    done
-+  # do not append ext if only one fontmap found
-+    [ $n -eq 1 ] && NAMEEXT0=""
-+
-+    j=0
-+    while [ $j -lt $n ]; do
-+        eval "NAME$j=$font\$NAMEEXT$j"
-+        j=$(($j+1))
-     done
- }
- 
- 
--#
- # Add ttf fonts
--#
--# This script won't do the low-level work for both X Window or Ghostscript,
--# such as adding fonts.dir or ps font entries.  It just calls $TTFM with
--# appropriate modules.  All file handlings will be managed by those modules.
--#
- add_fonts()
- {
--	 for addfile in $@; do
--		  # Some sanity checking
--		  if [ ! -r "$addfile" ]; then
--				echo "$addfile does not exist, skipped."
--				continue
--		  fi
--		  if [ -z "`echo $addfile |grep -i -e ".*tt[cf]$"`" ]; then
--				echo "$addfile is not a TTF, skipped."
--				continue
--		  fi
--		  # Those modules will manage if fonts are already installed.
--		  $TTFM --add $XMODULE $addfile
--		  $TTFM --add $GSMODULE $addfile
--
--		  f="`basename "$addfile"`"
--		  xlfd="`$TTFM --list $XMODULE |grep $f |sed -e "/iso/d" -e "s/$f //g" |sort |uniq`"
--		  encoding=`echo $xlfd |cut -d '-' -f 14-15`
--		  subdir="`printf "$ed_table" |awk -F "," -v i=$encoding '{dir[$2]=$1} END {print dir[i]}'`"
--		  cidname="`$TTFM --list $GSMODULE |grep $f |cut -d '(' -f 1 |sed -e "/^Default/d"`"
--		  psname="$cidname"-"`printf "$ep_table" |awk -F "," -v i=$encoding '{ps[$1]=$2} END {print ps[i]}'`"
--
--		  if [ ! -d $ABIFontPath/$subdir ]; then
--				mkdir -p $ABIFontPath/$subdir
--		  fi
--		  touch $ABIFontPath/$subdir/.already-in-fp
--		  if [ ! -r $ABIFontPath/$subdir/fonts.dir ]; then
--				echo 0 > $ABIFontPath/$subdir/fonts.dir
--		  fi
--		  num=`head -1 $ABIFontPath/$subdir/fonts.dir`
--		  cp $ABIFontPath/$subdir/fonts.dir $TEMPFILE
--		  # There may be spaces in $xlfd, quote it.
--		  abifont="$psname, $xlfd, $PRINTPARAM"
--		  echo $abifont >> $TEMPFILE
--		  echo $abifont |sed -e "s/-medium-r-/-bold-r-/g" >> $TEMPFILE
--		  echo $abifont |sed -e "s/-medium-r-/-medium-i-/g" >> $TEMPFILE
--		  echo $abifont |sed -e "s/-medium-r-/-bold-i-/g" >> $TEMPFILE
--		  num=`cat $TEMPFILE |wc -l`
--		  num=`expr $num - 1`
--		  sed -e "1s/.*/$num/g" $TEMPFILE > $ABIFontPath/$subdir/fonts.dir
-+    error=0
-+    for f in "$@"; do
-+        if [ ! -e "$f" ]; then
-+            if [ -e "$DEFAULTPATH/$f" ]; then
-+                f="$DEFAULTPATH/$f"
-+            else
-+                echo "Cannot find font $f, ignored!"
-+                error=$(($error+1))
-+                continue
-+            fi
-+        fi
-+
-+        fontfile=`basename $f`
-+        eval `echo $fontfile | awk -F. '{ printf "font=%s;ext=%s",\$1,\$2 }'`
-+
-+        get_ttfinfo $f
-+        i=1
-+        while [ $i -le $TTFINFO_MAPNUM ]; do
-+          eval I1=\$TTFINFO_FONTMAP${i}
-+	  I2=`echo $I1|sed -e s/medium-r/bold-r/`
-+	  I3=`echo $I1|sed -e s/medium-r/medium-i/`
-+	  I4=`echo $I1|sed -e s/medium-r/bold-i/`
-+	  J1=`echo $I1|cut -c2-`
-+	  J2=`echo $I2|cut -c2-`
-+	  J3=`echo $I3|cut -c2-`
-+	  J4=`echo $I4|cut -c2-`
-+	  MYENC=`echo $I1 | awk -F- '{print $14}'`
-+	  case $MYENC in
-+	    big5)
-+	      # zh-TW
-+              grep -v "$J1" $TWABIFONTPATH/fonts.dir |grep -v "$J2" |grep -v "$J3" |grep -v "$J4" |sed -e "1d" > $TEMPFILE.1
-+	      echo "${TTFINFO_FONT_PSNAME}-ETen-B5-H, $I1, 880, 120, 1000" > $TEMPFILE.2
-+	      echo "${TTFINFO_FONT_PSNAME}-Bold-ETen-B5-H, $I2, 880, 120, 1000" >> $TEMPFILE.2
-+	      echo "${TTFINFO_FONT_PSNAME}-Italic-ETen-B5-H, $I3, 880, 120, 1000" >> $TEMPFILE.2
-+	      echo "${TTFINFO_FONT_PSNAME}-BoldItalic-ETen-B5-H, $I4, 880, 120, 1000" >> $TEMPFILE.2
-+	      if [ "$TTFINFO_FONT_PSNAME" = "ShanHeiSun-Light" ]; then
-+		cat $TEMPFILE.2 $TEMPFILE.1 > $TEMPFILE
-+	      else
-+		cat $TEMPFILE.1 $TEMPFILE.2 > $TEMPFILE
-+	      fi
-+	      LINE=`wc -l < $TEMPFILE`
-+              echo $LINE > $TWABIFONTPATH/fonts.dir
-+	      cat $TEMPFILE >> $TWABIFONTPATH/fonts.dir
-+	      # zh-HK
-+	      I1=`echo $I1 | sed -e 's/-big5-0$/-big5hkscs-0/'`
-+	      I2=`echo $I2 | sed -e 's/-big5-0$/-big5hkscs-0/'`
-+	      I3=`echo $I3 | sed -e 's/-big5-0$/-big5hkscs-0/'`
-+	      I4=`echo $I4 | sed -e 's/-big5-0$/-big5hkscs-0/'`
-+	      J1=`echo $I1|cut -c2-`
-+	      J2=`echo $I2|cut -c2-`
-+	      J3=`echo $I3|cut -c2-`
-+	      J4=`echo $I4|cut -c2-`
-+              grep -v "$J1" $HKABIFONTPATH/fonts.dir |grep -v "$J2" |grep -v "$J3" |grep -v "$J4" |sed -e "1d" > $TEMPFILE
-+	      grep -i '[[:space:]]\+-[^-]\+-[^-]\+HKSCS-' $TEMPFILE > $TEMPFILE.1
-+	      grep -vi '[[:space:]]\+-[^-]\+-[^-]\+HKSCS-' $TEMPFILE > $TEMPFILE.2
-+	      echo "${TTFINFO_FONT_PSNAME}-HKscs-B5-H, $I1, 880, 120, 1000" > $TEMPFILE.3
-+	      echo "${TTFINFO_FONT_PSNAME}-Bold-HKscs-B5-H, $I2, 880, 120, 1000" >> $TEMPFILE.3
-+	      echo "${TTFINFO_FONT_PSNAME}-Italic-HKscs-B5-H, $I3, 880, 120, 1000" >> $TEMPFILE.3
-+	      echo "${TTFINFO_FONT_PSNAME}-BoldItalic-HKscs-B5-H, $I4, 880, 120, 1000" >> $TEMPFILE.3
-+	      if ( echo $I1 | grep -qi '^-[^-]\+-[^-]*HKSCS-' ); then
-+		if [ "$TTFINFO_FONT_PSNAME" = "InnMing-Light" ]; then
-+		  cat $TEMPFILE.3 $TEMPFILE.1 $TEMPFILE.2 > $TEMPFILE
-+		else
-+		  cat $TEMPFILE.1 $TEMPFILE.3 $TEMPFILE.2 > $TEMPFILE
-+		fi
-+	      elif [ "$TTFINFO_FONT_PSNAME" = "ShanHeiSun-Light" ]; then
-+		cat $TEMPFILE.1 $TEMPFILE.3 $TEMPFILE.2 > $TEMPFILE
-+	      else
-+		cat $TEMPFILE.1 $TEMPFILE.2 $TEMPFILE.3 > $TEMPFILE
-+	      fi
-+	      LINE=`wc -l < $TEMPFILE`
-+              echo $LINE > $HKABIFONTPATH/fonts.dir
-+	      cat $TEMPFILE >> $HKABIFONTPATH/fonts.dir
-+	    ;;
-+	    gb2312.1980)
-+	      # zh-CN
-+              grep -v "$J1" $CNABIFONTPATH/fonts.dir|grep -v "$J2"|grep -v "$J3"|grep -v "$J4"|sed -e "1d" > $TEMPFILE
-+	      echo "${TTFINFO_FONT_PSNAME}-GB-EUC-H, $I1, 880, 120, 1000" >> $TEMPFILE
-+	      echo "${TTFINFO_FONT_PSNAME}-Bold-GB-EUC-H, $I2, 880, 120, 1000" >> $TEMPFILE
-+	      echo "${TTFINFO_FONT_PSNAME}-Italic-GB-EUC-H, $I3, 880, 120, 1000" >> $TEMPFILE
-+	      echo "${TTFINFO_FONT_PSNAME}-BoldItalic-GB-EUC-H, $I4, 880, 120, 1000" >> $TEMPFILE
-+	      LINE=`wc -l < $TEMPFILE`
-+              echo $LINE > $CNABIFONTPATH/fonts.dir
-+	      cat $TEMPFILE >> $CNABIFONTPATH/fonts.dir
-+	      # zh-CN.GBK
-+	      I1=`echo $I1 | sed -e 's/-gb2312.1980-0$/-gbk-0/'`
-+	      I2=`echo $I2 | sed -e 's/-gb2312.1980-0$/-gbk-0/'`
-+	      I3=`echo $I3 | sed -e 's/-gb2312.1980-0$/-gbk-0/'`
-+	      I4=`echo $I4 | sed -e 's/-gb2312.1980-0$/-gbk-0/'`
-+	      J1=`echo $I1|cut -c2-`
-+	      J2=`echo $I2|cut -c2-`
-+	      J3=`echo $I3|cut -c2-`
-+	      J4=`echo $I4|cut -c2-`
-+              grep -v "$J1" $CNABIFONTPATH.GBK/fonts.dir |grep -v "$J2" |grep -v "$J3" |grep -v "$J4" |sed -e "1d" > $TEMPFILE
-+	      echo "${TTFINFO_FONT_PSNAME}-GBK-EUC-H, $I1, 880, 120, 1000" >> $TEMPFILE
-+	      echo "${TTFINFO_FONT_PSNAME}-Bold-GBK-EUC-H, $I2, 880, 120, 1000" >> $TEMPFILE
-+	      echo "${TTFINFO_FONT_PSNAME}-Italic-GBK-EUC-H, $I3, 880, 120, 1000" >> $TEMPFILE
-+	      echo "${TTFINFO_FONT_PSNAME}-BoldItalic-GBK-EUC-H, $I4, 880, 120, 1000" >> $TEMPFILE
-+	      LINE=`wc -l < $TEMPFILE`
-+              echo $LINE > $CNABIFONTPATH.GBK/fonts.dir
-+	      cat $TEMPFILE >> $CNABIFONTPATH.GBK/fonts.dir
-+            ;;
-+#	    ksc5601.1987)
-+#	      echo
-+#	    ;;
-+#	    jisx0208.1983|jisx0201.1976)
-+#	      echoC "todo"
-+#	    ;;
-+	  esac
-+          i=$(($i+1))     # Linux should use bash...:)
-+        done
-     done
-+    return $error
- }
- 
- 
--#
--# Set default font, accept kai or ming(default) only, all others will be
--# treated as ming, eg.
--# "setdefault kai /usr/local/share/fonts/TrueType/bkai00mp.ttf".
--#
--# setdefault() causes chain effects, ie. setdefault() in AbiWord WILL
--# make that font default both in X Window or Ghostscript.  While we can
--# make AbiWord's default font an ordinary TTF in X Window, it's hard
--# to do so do so with Ghostscript.
--#
--# One implication of this behaviour is that the default fonts of Abiword,
--# Ghostscript, and X Window have to be the same.  If they're not in sync,
--# strange problems may arise.
--#
--setdefault()
-+# Remove ttf fonts
-+remove_fonts()
- {
--	 face=$1
--	 addfile=$2
--	 # Some sanity checking
--	 if [ ! -r "$addfile" ]; then
--		  echo "$addfile does not exist, skipped."
--		  continue
--	 fi
--	 if [ -z "`echo $addfile |grep -i -e ".*tt[cf]$"`" ]; then
--		  echo "$addfile is not a TTF, skipped."
--		  continue
--	 fi
--	 # Those modules will manage if fonts are already installed.
--	 $TTFM --add $XMODULE $addfile
--	 $TTFM --add $GSMODULE $addfile
--	 if [ "$face" = "kai" ]; then
--		  $TTFM --setdefault_kai $XMODULE $addfile
--		  $TTFM --setdefault_kai $GSMODULE $addfile
--	 else
--		  $TTFM --setdefault $XMODULE $addfile
--		  $TTFM --setdefault $GSMODULE $addfile
--	 fi
--
--	 f="`basename "$addfile"`"
--	 # We know it's default, but which encoding is unknown.
--	 xlfd="`$TTFM --list $XMODULE |grep $f |sed -e "/iso/d" -e "s/$f //g" |sort |uniq`"
--	 encoding=`echo $xlfd |cut -d '-' -f 14-15`
--	 subdir="`printf "$ed_table" |awk -F "," -v i=$encoding '{dir[$2]=$1} END {print dir[i]}'`"
--	 cidname="`$TTFM --list $GSMODULE |grep -e "^Default.*$f" |cut -d '(' -f 1`"
--	 psname="$cidname"-"`printf "$ep_table" |awk -F "," -v i=$encoding '{ps[$1]=$2} END {print ps[i]}'`"
--
--	 if [ ! -d $ABIFontPath/$subdir ]; then
--		  mkdir -p $ABIFontPath/$subdir
--	 fi
--	 touch $ABIFontPath/$subdir/.already-in-fp
--	 if [ ! -r $ABIFontPath/$subdir/fonts.dir ]; then
--		  echo 0 > $ABIFontPath/$subdir/fonts.dir
--	 fi
--	 cp $ABIFontPath/$subdir/fonts.dir $TEMPFILE
--	 # There may be spaces in $xlfd, quote it.
--	 abifont="$psname, $xlfd, $PRINTPARAM"
--	 echo $abifont >> $TEMPFILE
--	 echo $abifont |sed -e "s/-medium-r-/-bold-r-/g" >> $TEMPFILE
--	 echo $abifont |sed -e "s/-medium-r-/-medium-i-/g" >> $TEMPFILE
--	 echo $abifont |sed -e "s/-medium-r-/-bold-i-/g" >> $TEMPFILE
--	 num=`cat $TEMPFILE |wc -l`
--	 num=`expr $num - 1`
--	 sed -e "1s/.*/$num/g" $TEMPFILE > $ABIFontPath/$subdir/fonts.dir
-+    error=0
-+    for f in "$@"; do
-+        if [ ! -e "$f" ]; then
-+            if [ -e "$DEFAULTPATH/$f" ]; then
-+                f="$DEFAULTPATH/$f"
-+            else
-+                echo "Cannot find font $f, ignored!"
-+                error=$(($error+1))
-+                continue
-+            fi
-+        fi
-+
-+        fontfile=`basename $f`
-+        eval `echo $fontfile | awk -F. '{ printf "font=%s;ext=%s",\$1,\$2 }'`
-+
-+        get_ttfinfo $f
-+        i=1
-+        while [ $i -le $TTFINFO_MAPNUM ]; do
-+          eval I1=\$TTFINFO_FONTMAP${i}
-+	  I2=`echo $I1|sed -e s/medium-r/bold-r/`
-+	  I3=`echo $I1|sed -e s/medium-r/medium-i/`
-+	  I4=`echo $I1|sed -e s/medium-r/bold-i/`
-+	  J1=`echo $I1|cut -c2-`
-+	  J2=`echo $I2|cut -c2-`
-+	  J3=`echo $I3|cut -c2-`
-+	  J4=`echo $I4|cut -c2-`
-+	  MYENC=`echo $I1 | awk -F- '{print $14}'`
-+	  case $MYENC in
-+	    big5)
-+	      # zh-TW
-+              grep -v "$J1" $TWABIFONTPATH/fonts.dir |grep -v "$J2" |grep -v "$J3" |grep -v "$J4" |sed -e "1d" > $TEMPFILE
-+	      LINE=`wc -l < $TEMPFILE`
-+              echo $LINE > $TWABIFONTPATH/fonts.dir
-+	      cat $TEMPFILE >> $TWABIFONTPATH/fonts.dir
-+	      # zh-HK
-+	      I1=`echo $I1 | sed -e 's/-big5-0$/-big5hkscs-0/'`
-+	      I2=`echo $I2 | sed -e 's/-big5-0$/-big5hkscs-0/'`
-+	      I3=`echo $I3 | sed -e 's/-big5-0$/-big5hkscs-0/'`
-+	      I4=`echo $I4 | sed -e 's/-big5-0$/-big5hkscs-0/'`
-+	      J1=`echo $I1|cut -c2-`
-+	      J2=`echo $I2|cut -c2-`
-+	      J3=`echo $I3|cut -c2-`
-+	      J4=`echo $I4|cut -c2-`
-+              grep -v "$J1" $HKABIFONTPATH/fonts.dir |grep -v "$J2" |grep -v "$J3" |grep -v "$J4" |sed -e "1d" > $TEMPFILE
-+	      LINE=`wc -l < $TEMPFILE`
-+              echo $LINE > $HKABIFONTPATH/fonts.dir
-+	      cat $TEMPFILE >> $HKABIFONTPATH/fonts.dir
-+	    ;;
-+	    gb2312.1980)
-+	      # zh-CN
-+              grep -v "$J1" $CNABIFONTPATH/fonts.dir|grep -v "$J2"|grep -v "$J3"|grep -v "$J4"|sed -e "1d" > $TEMPFILE
-+	      LINE=`wc -l < $TEMPFILE`
-+              echo $LINE > $CNABIFONTPATH/fonts.dir
-+	      cat $TEMPFILE >> $CNABIFONTPATH/fonts.dir
-+	      # zh-CN.GBK
-+	      I1=`echo $I1 | sed -e 's/-gb2312.1980-0$/-gbk-0/'`
-+	      I2=`echo $I2 | sed -e 's/-gb2312.1980-0$/-gbk-0/'`
-+	      I3=`echo $I3 | sed -e 's/-gb2312.1980-0$/-gbk-0/'`
-+	      I4=`echo $I4 | sed -e 's/-gb2312.1980-0$/-gbk-0/'`
-+	      J1=`echo $I1|cut -c2-`
-+	      J2=`echo $I2|cut -c2-`
-+	      J3=`echo $I3|cut -c2-`
-+	      J4=`echo $I4|cut -c2-`
-+              grep -v "$J1" $CNABIFONTPATH.GBK/fonts.dir |grep -v "$J2" |grep -v "$J3" |grep -v "$J4" |sed -e "1d" > $TEMPFILE
-+	      LINE=`wc -l < $TEMPFILE`
-+              echo $LINE > $CNABIFONTPATH.GBK/fonts.dir
-+	      cat $TEMPFILE >> $CNABIFONTPATH.GBK/fonts.dir
-+            ;;
-+#	    ksc5601.1987)
-+#	      echo
-+#	    ;;
-+#	    jisx0208.1983|jisx0201.1976)
-+#	      echoC "todo"
-+#	    ;;
-+	  esac
-+          i=$(($i+1))     # Linux should use bash...:)
-+        done
-+    done
-+    return $error
- }
- 
- 
-@@ -306,8 +350,6 @@
-     exit 1
- fi
- 
--check_abiword
--
- ARG=$1
- shift 1
- 
-@@ -316,52 +358,36 @@
-     Usage
-     ;;
- --name)
-+    echo
-     echo "$NAME $VERSION"
-+    echo
-     ;;
- --list)
-     list_fonts
-     ;;
- --add)
-     if [ $# -lt 1 ]; then
--        echo "Missing font filename argument."
-+        echo "Missing font filename argument!"
-         Usage
-         exit 1
-     fi
-     add_fonts $@
--    echo "Adding $@."
-+    echo "Done!"
-     ;;
- --remove)
-     if [ $# -lt 1 ]; then
--        echo "Missing font filename argument."
-+        echo "Missing font filename argument!"
-         Usage
-         exit 1
-     fi
-     remove_fonts $@
--    echo "Removing $@."
-+    echo "Done!"
-     ;;
- --setdefault|--setdefault_ming)
--    if [ $# -lt 1 ]; then
--        echo "Missing font filename arguments."
--        Usage
--        exit 1
--    elif [ $# -gt 1 ]; then
--        echo "Only need one font filename."
--        Usage
--        exit 1
--    fi
--    setdefault ming $1
-+    echo "No need to set default fonts"
-     ;;
- --setdefault_kai)
--    if [ $# -lt 1 ]; then
--        echo "Missing font filename arguments."
--        Usage
--        exit 1
--    elif [ $# -gt 1 ]; then
--        echo "Only need one font filename."
--        Usage
--        exit 1
--    fi
--    setdefault kai $1
-+    echo "No need to set default fonts"
-     ;;
- *)
-     Usage
-@@ -369,7 +395,18 @@
-     ;;
- esac
- 
--rm -f $TEMPFILE
-+rm -f $TEMPFILE $TEMPFILE.1 $TEMPFILE.2 $TEMPFILE.3
- exit 0
- 
- 
-+# ChangeLog
-+#
-+# * Fri Jan  12 2001 Chung-Yen Chang <candyz@cle.linux.org.tw>
-+# - first release
-+#
-+# * Tue Sep  4 2001 Anthony Fok <anthony@thizlinux.com>
-+# - Added Big5-HKSCS font support thanks to ThizLinux Laboratory Ltd., Thiz
-+#   Technology Group.  Also added preliminary GBK support
-+# - Use the _real_ PostScript font names, and with Bold, Italic and BoldItalic
-+# - List InnMing-Light / HKSCS (zh_HK) or ShanHeiSun-Light (zh_TW) first
-+#
diff -ruN ttfm.orig/files/patch-modules::gscjk.ttfm ttfm/files/patch-modules::gscjk.ttfm
--- ttfm.orig/files/patch-modules::gscjk.ttfm	Thu Sep 25 00:05:03 2003
+++ ttfm/files/patch-modules::gscjk.ttfm	Thu Jan  1 08:00:00 1970
@@ -1,763 +0,0 @@
---- modules/gscjk.ttfm.orig	Sun Jun  2 03:40:13 2002
-+++ modules/gscjk.ttfm	Sun Jun  2 03:39:59 2002
-@@ -0,0 +1,760 @@
-+#!/bin/sh
-+#
-+# TTFM module for Ghostscript 6.51 with GS-CJK
-+#
-+# This script is distributed under the revised BSD license.
-+#
-+# For any problem reports or suggestions, please contact
-+# Chung-Yen Chang <candyz@linux.org.tw>,
-+# Anthony Fok <anthony@thizlinux.org>
-+# or the original author Jing-Tang Keith Jang <keith@FreeBSD.org>.
-+#
-+
-+# This script can handle both CID and TrueType fonts.
-+
-+# Name & version
-+export NAME; NAME="Ghostscript 7.06 TTF Font Manager"
-+export VERSION; VERSION=1.0
-+
-+# Global constants
-+
-+export PREFIX; PREFIX=/usr/local
-+export TTFINFOPath; TTFINFOPath="${PREFIX}/bin/ttfinfo"
-+export GS6Path; GS6Path="${PREFIX}/share/ghostscript"
-+export GS6CJKPath; GS6CJKPath="${GS6Path}/Resource"
-+export CJKCMapPath; CJKCMapPath="${GS6CJKPath}/CMap"
-+export CJKFontPath; CJKFontPath="${GS6CJKPath}/Font"
-+export CJKCIDPath; CJKCIDPath="${GS6CJKPath}/CIDFont"
-+# Not used
-+# export CJKTTFPath; CJKTTFPath="${GS6CJKPath}/TrueType"
-+export GS6LibPath; GS6LibPath="${GS6Path}/7.06/lib"
-+export DefaultMing_Name; DefaultMing_Name="DEFAULT-MING"
-+export DefaultKai_Name; DefaultKai_Name="DEFAULT-KAI"
-+export TEMPFILE; TEMPFILE="`mktemp /tmp/ttfm.tmpXXXXXX`"
-+
-+# Encoding/Ordering table, used to convert the output of ttfinfo(encoding)
-+# to CID font's ordering property, and vice versa.  See guess_ttf_info()
-+# below.
-+#
-+export eo_table; eo_table=\
-+"Adobe CNS1,big5-0\n
-+Adobe GB1,gb2312.1980-0\n
-+Adobe Korea1,ksc5601.1987-0\n
-+Adobe Japan1,jisx0208.1983-0\n
-+Adobe Japan2,jisx0212.1990-0\n"
-+
-+# Postscript command to open TTFs, defined in gs_ttf.ps.
-+# It needs gs_ttf.ps-cjkv-*.patch of http://www.aihara.co.jp/~taiji/tops/.
-+export OpenTTFont; OpenTTFont=.openttcidfont
-+
-+# Who am I?
-+print_name()
-+{
-+    echo "$NAME $VERSION"
-+}
-+
-+
-+# Usage
-+Usage()
-+{
-+    echo
-+    echo "$NAME $VERSION"
-+    echo
-+    echo "Usage: $NAME [option]"
-+    echo
-+    echo "       --check            check Ghostscript 7.06 settings"
-+    echo "       --add <file>...                install CID font"
-+    echo "       --add [alias=]<file>...        install TTF font"
-+    echo "       --remove <file>... remove font from the system"
-+    echo "       --list             list all fonts on the system"
-+    echo "       --setdefault <file>"
-+    echo "                          set default font to file"
-+    echo "       --setdefault_kai <file>"
-+    echo "                          set default \kai font to file"
-+    echo "       --setdefault_ming <file>"
-+    echo "                          set default \ming font to file"
-+    echo "       --help             show this info"
-+    echo
-+}
-+
-+
-+#
-+# Check if CJK CMap files are correctly installed with Ghostscript 6.
-+# Give a warning if Adobe CNS1/GB1/Identity/Japan1/Japan2/Korea1 is not found.
-+#
-+# We'll also check gs_res.ps & gs_ttf.ps.
-+#
-+check_gs6()
-+{
-+    if [ ! -x $TTFINFOPath ]; then
-+        echo "ttfinfo not installed!"
-+        exit 1
-+    fi
-+
-+    if [ ! -d "${CJKCMapPath}" ]; then
-+        echo "Error: You have no CMap files installed!"
-+        exit 1
-+    fi
-+
-+    # ac1
-+    if [ -z "`grep -l "Adobe CNS1" ${CJKCMapPath}/*`" ]; then
-+        echo "Warning: Adobe-CNS1-3 CMap files not installed!"
-+    # ag1
-+    elif [ -z "`grep -l "Adobe GB1" ${CJKCMapPath}/*`" ]; then
-+        echo "Warning: Adobe-GB1-3 CMap files not installed!"
-+    # aj1
-+    elif [ -z "`grep -l "Adobe Japan1" ${CJKCMapPath}/*`" ]; then
-+        echo "Warning: Adobe-Japan1-4 CMap files not installed!"
-+    # aj2
-+    elif [ -z "`grep -l "Adobe Japan2" ${CJKCMapPath}/*`" ]; then
-+        echo "Warning: Adobe-Japan2-0 CMap files not installed!"
-+    # ak1
-+    elif [ -z "`grep -l "Adobe Korea1" ${CJKCMapPath}/*`" ]; then
-+        echo "Warning: Adobe-Korea1-2 CMap files not installed!"
-+    # I'm not sure if it's needed, so just a warning if not found.
-+    elif [ -z "`grep -l "Adobe Identity" ${CJKCMapPath}/*`" ]; then
-+        echo "Warning: Adobe Identity CMap files not installed!"
-+    fi
-+
-+    # These two conditions are pretty weak. :-)
-+    if [ -z "`grep -l "Taiji Yamada" ${GS6LibPath}/gs_ttf.ps`" ]; then
-+        echo "Error: Your gs_ttf.ps is not patched."
-+        echo "See http://www.aihara.co.jp/~taiji/tops/ for details."
-+        exit 1
-+    elif [ -n "`grep -l -e "/FontResourceDir (/Resource/Font/)\|/FontResourceDir (/Resource/Font/)" ${GS6LibPath}/gs_res.ps`" ]; then
-+        echo "Error: Please modify FontResourceDir or FontResourceDir in gs_res.ps."
-+        echo "See http://www.aihara.co.jp/~taiji/tops/ for details."
-+        exit 1
-+    fi
-+
-+    echo "No errors found."
-+}
-+
-+
-+# List all fonts installed in ${CJKFontPath}, cross-referenced with those
-+# fonts installed in ${CJKCIDPath}.
-+list_fonts()
-+{
-+    echo "Installed TTF fonts:"
-+    for CIDFont in `ls ${CJKCIDPath}`; do
-+        echo "${CIDFont}:"
-+        cd ${CJKFontPath}; ls ${CIDFont}* 2>/dev/null
-+        echo
-+    done
-+}
-+
-+
-+# Remove fonts
-+remove_fonts()
-+{
-+    for f in "$@"; do
-+        targetname=`basename $f`
-+
-+        rm -f ${CJKCIDPath}/${targetname} ${CJKFontPath}/${targetname}*
-+    done
-+}
-+
-+
-+#
-+# guess_ttf_info <fontfile>, eg. guess_ttf_info bsmi00lp.ttf.
-+#
-+# Guess the alias of a ttf, and put it in $TTF_ALIAS.
-+# Guess which index to use, and put it in $TTF_INDEX.
-+# Guess which ordering a ttf should use, eg. "Adobe CNS1" for bsmi00lp.ttf.
-+#    Then put the ordering in $TTF_ORDERING.
-+#
-+# Simply put, we guess everything. :-)
-+#
-+guess_ttf_info()
-+{
-+    targetname=$1
-+
-+    eval `$TTFINFOPath -c ${targetname}`
-+    # Set fontname from the filename if it's unknown.
-+    # I assume there's no ttf filename like "-----.ttf".
-+    unset HKSCS
-+    ( echo $TTFINFO_FONT_NAME | grep -qi HKSCS ) && export HKSCS=1
-+    if [ "$TTFINFO_FONT_NAME" = "unknown" ]; then
-+        TTFINFO_FONT_NAME=`basename $targetname |cut -d "." -f 1 |sed -e "s/-//g"`
-+    fi
-+
-+    # Extract slant/property/encoding, then install.
-+    MAPNUM=1
-+    while [ $MAPNUM -le $TTFINFO_MAPNUM ]; do
-+        eval TTFINFO_FONTMAP=\$TTFINFO_FONTMAP${MAPNUM}
-+        fontweight=`echo $TTFINFO_FONTMAP |cut -d "-" -f 4`
-+        fontslant=`echo $TTFINFO_FONTMAP |cut -d "-" -f 5`
-+        encoding1=`echo $TTFINFO_FONTMAP |cut -d "-" -f 14`
-+        encoding2=`echo $TTFINFO_FONTMAP |cut -d "-" -f 15`
-+        fontencoding=${encoding1}-${encoding2}
-+
-+        if [ -n "`echo ${fontencoding} |grep -i -e "big5\|cns\|gb\|ksc\|jis"`" ]; then
-+            break
-+        fi
-+
-+        MAPNUM=`expr $MAPNUM + 1`
-+    done
-+
-+    if [ -z "`echo ${fontencoding} |grep -i -e "big5\|cns\|gb\|ksc\|jis"`" ]; then
-+        echo "${targetname}" is not a CJK TTF!
-+        exit 1
-+    fi
-+
-+    # The first characters of foundry & font names should be uppercase.
-+    i=`echo "$TTFINFO_FOUNDRY_NAME" |cut -b 1`
-+    j=`echo $i |tr [:lower:] [:upper:]`
-+    TTFINFO_FOUNDRY_NAME=`echo $TTFINFO_FOUNDRY_NAME |sed -e "s/^$i/$j/"`
-+    i=`echo "$TTFINFO_FONT_NAME" |cut -b 1`
-+    j=`echo $i |tr [:lower:] [:upper:]`
-+    TTFINFO_FONT_NAME=`echo $TTFINFO_FONT_NAME |sed -e "s/^$i/$j/"`
-+
-+    # Alias property.  The first two are in favor of Chinese TTFs.
-+    # We'll also strip any spaces in foundry and font names.
-+    TTFINFO_FOUNDRY_NAME="`echo $TTFINFO_FOUNDRY_NAME |sed -e "s/ //g"`"
-+#    if [ -n "`echo ${fontencoding} |grep -i "big5"`" ]; then
-+#        if [ -z "`echo $TTFINFO_FONT_NAME |grep " "`" ]; then
-+#            TTF_ALIAS="${TTFINFO_FOUNDRY_NAME}${TTFINFO_FONT_NAME}B5"
-+#        # The following two are hacks, in favor of Arphic TTF.
-+#        elif [ -n "`echo $TTFINFO_FONT_NAME |grep -i -e "kai"`" ]; then
-+#            TTF_ALIAS="${TTFINFO_FOUNDRY_NAME}KaiB5"
-+#        elif [ -n "`echo $TTFINFO_FONT_NAME |grep -i -e "ming"`" ]; then
-+#            TTF_ALIAS="${TTFINFO_FOUNDRY_NAME}MingB5"
-+#        else
-+#            TTF_ALIAS="${TTFINFO_FOUNDRY_NAME}`echo $TTFINFO_FONT_NAME |sed -e "s/ //g"`B5"
-+#        fi
-+#    elif [ -n "`echo ${fontencoding} |grep -i "gb"`" ]; then
-+#        if [ -z "`echo $TTFINFO_FONT_NAME |grep " "`" ]; then
-+#            TTF_ALIAS="${TTFINFO_FOUNDRY_NAME}${TTFINFO_FONT_NAME}GB"
-+#        # The following two are hacks, in favor of Arphic TTF.
-+#        elif [ -n "`echo $TTFINFO_FONT_NAME |grep -i -e "kai"`" ]; then
-+#            TTF_ALIAS="${TTFINFO_FOUNDRY_NAME}KaiGB"
-+#        elif [ -n "`echo $TTFINFO_FONT_NAME |grep -i -e "ming"`" ]; then
-+#            TTF_ALIAS="${TTFINFO_FOUNDRY_NAME}MingGB"
-+#        else
-+#            TTF_ALIAS="${TTFINFO_FOUNDRY_NAME}`echo $TTFINFO_FONT_NAME |sed -e "s/ //g"`GB"
-+#        fi
-+#    else
-+#        TTF_ALIAS=${TTFINFO_FOUNDRY_NAME}"`echo $TTFINFO_FONT_NAME |sed -e "s/ //g"`"
-+#    fi
-+    TTF_ALIAS=$TTFINFO_FONT_PSNAME
-+
-+#    case "$fontweight" in
-+#    'bold')
-+#        TTF_ALIAS="${TTF_ALIAS}-Bold"
-+#    ;;
-+#    *)
-+#        TTF_ALIAS="${TTF_ALIAS}-Regular"
-+#    ;;
-+#    esac
-+
-+    # Index
-+    TTF_INDEX=$MAPNUM
-+    # Ordering property
-+    TTF_ORDERING="`printf "$eo_table" |awk -F "," -v i=$fontencoding '{encoding[$2]=$1} END {print encoding[i]}'`"
-+}
-+
-+
-+#
-+# install_ttf <alias> <filename>[,ttf_index] eg.
-+# install_ttf Arphic-MingB5 /usr/share/fonts/ttf/bsmi00lp.ttf,1.
-+#
-+# Write CID info file of a TTF, so it can be used as a CID font afterwards.
-+# Currently we'll always call install_ttf() with ttf_index.
-+#
-+install_ttf()
-+{
-+    alias=$1
-+    filename=$2
-+
-+    TTE=""
-+    case "$alias" in
-+    *-Adobe-*[0-9])
-+        TTE=' /'`echo "$alias" |sed -n -e "s/^.*-\(Adobe-.*[0-9]\)$/\1/p"`"-Unicode"
-+    ;;
-+    *,Adobe-*[0-9]-*)
-+        TTE=' /'`echo "$alias" |sed -n -e "s/^\(.*\),\(Adobe-.*[0-9]-.*\)$/\2/p"`
-+        alias=`echo "$alias" |sed -n -e "s/^\(.*\),\(Adobe-.*[0-9]-.*\)$/\1/p"`
-+    ;;
-+    esac
-+
-+    case "$filename" in
-+    *.[Tt][Tt][CcFf],[0-9])
-+        TTF=`echo "$filename" |sed -n -e "s/^\(.*\),\([0-9]\)$/\1/p"`
-+        TTI=`echo "$filename" |sed -n -e "s/^\(.*\),\([0-9]\)$/\2/p"`
-+	# Regular font
-+        [ "$HKSCS" = "1" -o ! -f "$CJKCIDPath/$alias" ] && cat <<EOF > "$CJKCIDPath/$alias" && echo "+$alias=$TTF"
-+%!PS-Adobe-3.0 Resource-CIDFont
-+%%BeginResource: CIDFont ($FNN)
-+/$alias
-+($TTF) $TTI$TTE $OpenTTFont
-+dup length dict begin {def} forall currentdict end
-+/CIDFont defineresource pop
-+%%EndResource
-+%%EOF
-+EOF
-+	# Bold font
-+        [ "$HKSCS" = "1" -o ! -f "$CJKCIDPath/$alias-Bold" ] && cat <<EOF > "$CJKCIDPath/$alias-Bold" && echo "+$alias=$TTF-Bold"
-+%!PS-Adobe-3.0 Resource-CIDFont
-+%%BeginResource: CIDFont ($FNN-Bold)
-+/$alias-Bold
-+/$alias /CIDFont findresource
-+16 dict begin
-+  /basecidfont exch def
-+  /basefont-H /.basefont-H /Identity-H [ basecidfont ] composefont def
-+  /basefont-V /.basefont-V /Identity-V [ basecidfont ] composefont def
-+  /CIDFontName dup basecidfont exch get def
-+  /CIDFontType 1 def
-+  /CIDSystemInfo dup basecidfont exch get def
-+  /FontInfo dup basecidfont exch get def
-+  /FontMatrix [ 1 0 0 1 0 0 ] def
-+  /FontBBox [
-+    basecidfont /FontBBox get cvx exec
-+    4 2 roll basecidfont /FontMatrix get transform
-+    4 2 roll basecidfont /FontMatrix get transform
-+  ] def
-+  /cid 2 string def
-+  /BuildGlyph {
-+    gsave
-+    exch begin
-+      dup 256 idiv cid exch 0 exch put
-+      256 mod cid exch 1 exch put
-+      rootfont /WMode known { rootfont /WMode get 1 eq } { false } ifelse
-+      { basefont-V } { basefont-H } ifelse setfont
-+      .03 setlinewidth 1 setlinejoin
-+      newpath
-+      0 0 moveto cid false charpath stroke
-+      0 0 moveto cid show
-+      currentpoint setcharwidth
-+    end
-+    grestore
-+  } bind def
-+  currentdict
-+end
-+/CIDFont defineresource pop
-+%%EndResource
-+%%EOF
-+EOF
-+	# Italic font
-+        [ "$HKSCS" = "1" -o ! -f "$CJKCIDPath/$alias-Italic" ] && cat <<EOF > "$CJKCIDPath/$alias-Italic" && echo "+$alias=$TTF-Italic"
-+%!PS-Adobe-3.0 Resource-CIDFont
-+%%BeginResource: CIDFont ($FNN-Italic)
-+/$alias-Italic
-+/$alias /CIDFont findresource
-+dup length dict begin { 1 index /FontMatrix eq { [1 0 .3 1 0 0] matrix concatmatrix def } { def } ifelse } forall currentdict end
-+/CIDFont defineresource pop
-+%%EndResource
-+%%EOF
-+EOF
-+	# BoldItalic font
-+        [ "$HKSCS" = "1" -o ! -f "$CJKCIDPath/$alias-BoldItalic" ] && cat <<EOF > "$CJKCIDPath/$alias-BoldItalic" && echo "+$alias=$TTF-BoldItalic"
-+%!PS-Adobe-3.0 Resource-CIDFont
-+%%BeginResource: CIDFont ($FNN-BoldItalic)
-+/$alias-BoldItalic
-+/$alias /CIDFont findresource
-+16 dict begin
-+  /basecidfont exch def
-+  /basefont-H /.basefont-H /Identity-H [ basecidfont ] composefont def
-+  /basefont-V /.basefont-V /Identity-V [ basecidfont ] composefont def
-+  /CIDFontName dup basecidfont exch get def
-+  /CIDFontType 1 def
-+  /CIDSystemInfo dup basecidfont exch get def
-+  /FontInfo dup basecidfont exch get def
-+  /FontMatrix [ 1 0 0 1 0 0 ] def
-+  /FontBBox [
-+    basecidfont /FontBBox get cvx exec
-+    4 2 roll basecidfont /FontMatrix get transform
-+    4 2 roll basecidfont /FontMatrix get transform
-+  ] def
-+  /cid 2 string def
-+  /BuildGlyph {
-+    gsave
-+    exch begin
-+      dup 256 idiv cid exch 0 exch put
-+      256 mod cid exch 1 exch put
-+      rootfont /WMode known { rootfont /WMode get 1 eq } { false } ifelse
-+      { basefont-V } { basefont-H } ifelse setfont
-+      .03 setlinewidth 1 setlinejoin
-+      newpath
-+      0 0 moveto cid false charpath stroke
-+      0 0 moveto cid show
-+      currentpoint setcharwidth
-+    end
-+    grestore
-+  } bind def
-+  currentdict
-+end
-+dup length dict begin { 1 index /FontMatrix eq { [1 0 .3 1 0 0] matrix concatmatrix def } { def } ifelse } forall currentdict end
-+/CIDFont defineresource pop
-+%%EndResource
-+%%EOF
-+EOF
-+    ;;
-+    *.[Tt][Tt][CcFf])
-+        TTF="$filename"
-+	# Regular Font
-+        [ "$HKSCS" = "1" -o ! -f "$CJKCIDPath/$alias" ] && cat <<EOF > "$CJKCIDPath/$alias" && echo "+$alias=$TTF"
-+%!PS-Adobe-3.0 Resource-CIDFont
-+%%BeginResource: CIDFont ($FNN)
-+/$alias
-+($TTF)$TTE $OpenTTFont
-+dup length dict begin {def} forall currentdict end
-+/CIDFont defineresource pop
-+%%EndResource
-+%%EOF
-+EOF
-+	# Bold Font
-+        [ "$HKSCS" = "1" -o ! -f "$CJKCIDPath/$alias-Bold" ] && cat <<EOF > "$CJKCIDPath/$alias-Bold" && echo "+$alias=$TTF-Bold"
-+%!PS-Adobe-3.0 Resource-CIDFont
-+%%BeginResource: CIDFont ($FNN-Bold)
-+/$alias-Bold
-+/$alias /CIDFont findresource
-+16 dict begin
-+  /basecidfont exch def
-+  /basefont-H /.basefont-H /Identity-H [ basecidfont ] composefont def
-+  /basefont-V /.basefont-V /Identity-V [ basecidfont ] composefont def
-+  /CIDFontName dup basecidfont exch get def
-+  /CIDFontType 1 def
-+  /CIDSystemInfo dup basecidfont exch get def
-+  /FontInfo dup basecidfont exch get def
-+  /FontMatrix [ 1 0 0 1 0 0 ] def
-+  /FontBBox [
-+    basecidfont /FontBBox get cvx exec
-+    4 2 roll basecidfont /FontMatrix get transform
-+    4 2 roll basecidfont /FontMatrix get transform
-+  ] def
-+  /cid 2 string def
-+  /BuildGlyph {
-+    gsave
-+    exch begin
-+      dup 256 idiv cid exch 0 exch put
-+      256 mod cid exch 1 exch put
-+      rootfont /WMode known { rootfont /WMode get 1 eq } { false } ifelse
-+      { basefont-V } { basefont-H } ifelse setfont
-+      .03 setlinewidth 1 setlinejoin
-+      newpath
-+      0 0 moveto cid false charpath stroke
-+      0 0 moveto cid show
-+      currentpoint setcharwidth
-+    end
-+    grestore
-+  } bind def
-+  currentdict
-+end
-+/CIDFont defineresource pop
-+%%EndResource
-+%%EOF
-+EOF
-+	# Italic Font
-+        [ "$HKSCS" = "1" -o ! -f "$CJKCIDPath/$alias-Italic" ] && cat <<EOF > "$CJKCIDPath/$alias-Italic" && echo "+$alias=$TTF-Italic"
-+%!PS-Adobe-3.0 Resource-CIDFont
-+%%BeginResource: CIDFont ($FNN-Italic)
-+/$alias-Italic
-+/$alias /CIDFont findresource
-+dup length dict begin { 1 index /FontMatrix eq { [1 0 .3 1 0 0] matrix concatmat
-+rix def } { def } ifelse } forall currentdict end
-+/CIDFont defineresource pop
-+%%EndResource
-+%%EOF
-+EOF
-+	# BoldItalic Font
-+        [ "$HKSCS" = "1" -o ! -f "$CJKCIDPath/$alias-BoldItalic" ] && cat <<EOF > "$CJKCIDPath/$alias-BoldItalic" && echo "+$alias=$TTF-BoldItalic"
-+%!PS-Adobe-3.0 Resource-CIDFont
-+%%BeginResource: CIDFont ($FNN-BoldItalic)
-+/$alias-BoldItalic
-+/$alias /CIDFont findresource
-+16 dict begin
-+  /basecidfont exch def
-+  /basefont-H /.basefont-H /Identity-H [ basecidfont ] composefont def
-+  /basefont-V /.basefont-V /Identity-V [ basecidfont ] composefont def
-+  /CIDFontName dup basecidfont exch get def
-+  /CIDFontType 1 def
-+  /CIDSystemInfo dup basecidfont exch get def
-+  /FontInfo dup basecidfont exch get def
-+  /FontMatrix [ 1 0 0 1 0 0 ] def
-+  /FontBBox [
-+    basecidfont /FontBBox get cvx exec
-+    4 2 roll basecidfont /FontMatrix get transform
-+    4 2 roll basecidfont /FontMatrix get transform
-+  ] def
-+  /cid 2 string def
-+  /BuildGlyph {
-+    gsave
-+    exch begin
-+      dup 256 idiv cid exch 0 exch put
-+      256 mod cid exch 1 exch put
-+      rootfont /WMode known { rootfont /WMode get 1 eq } { false } ifelse
-+      { basefont-V } { basefont-H } ifelse setfont
-+      .03 setlinewidth 1 setlinejoin
-+      newpath
-+      0 0 moveto cid false charpath stroke
-+      0 0 moveto cid show
-+      currentpoint setcharwidth
-+    end
-+    grestore
-+  } bind def
-+  currentdict
-+end
-+dup length dict begin { 1 index /FontMatrix eq { [1 0 .3 1 0 0] matrix concatmat
-+rix def } { def } ifelse } forall currentdict end
-+/CIDFont defineresource pop
-+%%EndResource
-+%%EOF
-+EOF
-+    ;;
-+    *)
-+        [ "$HKSCS" = "1" -o ! -f "$CJKCIDPath/$alias" ] && cat <<EOF > "$CJKCIDPath/$alias" && echo "+$alias=$filename"
-+%!PS-Adobe-3.0 Resource-CIDFont
-+%%BeginResource: CIDFont ($FNN)
-+/$alias
-+/$filename /CIDFont findresource
-+dup length dict begin {def} forall currentdict end
-+/CIDFont defineresource pop
-+%%EndResource
-+%%EOF
-+EOF
-+    ;;
-+    esac
-+}
-+
-+
-+#
-+# install_cid <ordering> <fontname>, eg.
-+# install_cid "Adobe CNS1" MOESung-Regular.
-+#
-+# Write all CID-related font files.  It can be used to install TTF once
-+# the CID info file of TTF is available.
-+#
-+install_cid()
-+{
-+    CID_ordering=$1
-+    fontname=$2
-+    CMaps=`cd $CJKCMapPath; grep -l -e "$CID_ordering\|Adobe Identity" *`
-+
-+    for cmap in $CMaps; do
-+        if [ $cmap = 'Roman' -o $cmap = 'Katakana' -o $cmap = 'Hiragana' -o $cmap = 'Hankaku' ]; then
-+            to='.'
-+        else
-+            to='-'
-+        fi
-+	for style in '' '-Bold' '-Italic' '-BoldItalic'; do
-+	  [ "$HKSCS" = "1" -o ! -f "$CJKFontPath/$fontname$style$to$cmap" ] && cat <<EOF > "$CJKFontPath/$fontname$style$to$cmap" && echo "+$fontname$style$to$cmap"
-+%!PS-Adobe-3.0 Resource-Font
-+%%DocumentNeededResources: $cmap (CMap)
-+%%IncludeResource: $cmap (CMap)
-+%%BeginResource: Font ($fontname$style$to$cmap)
-+/$fontname$style$to$cmap
-+/$cmap /CMap findresource
-+[/$fontname$style /CIDFont findresource]
-+composefont pop
-+%%EndResource
-+%%EOF
-+EOF
-+	done
-+    done
-+}
-+
-+
-+#
-+# Add fonts
-+#
-+add_fonts()
-+{
-+    ALIASES=$*
-+    for alias in $ALIASES; do
-+        case "$alias" in
-+        ?*=?*)    # We have alias & font filename.
-+            FNN="`echo "$alias" |sed -n -e 's/^\(.*\)=\(.*\)$/\1/p'`"
-+            fnn="`echo "$alias" |sed -n -e 's/^\(.*\)=\(.*\)$/\2/p'`"
-+            if [ ! -f "$fnn" ]; then
-+                echo "$fnn not found!"
-+            fi
-+            guess_ttf_info "$fnn"
-+            TTF_ALIAS="$FNN"
-+            install_ttf "$FNN" "$fnn",$TTF_INDEX
-+            install_cid "$TTF_ORDERING" "$fnn"
-+        ;;
-+        ?*.[Tt][Tt][CcFf])    # We have to make up an alias.
-+            if [ ! -f "$alias" ]; then
-+                echo "$alias not found!"
-+            fi
-+            guess_ttf_info "$alias"
-+	    FNN=$TTF_ALIAS
-+            install_ttf $TTF_ALIAS "$alias",$TTF_INDEX
-+            install_cid "$TTF_ORDERING" $TTF_ALIAS
-+        ;;
-+        *)    # CID font
-+            if [ ! -f "$alias" ]; then
-+                echo "$alias not found!"
-+            fi
-+            if [ ! -f "$CJKCIDPath/`basename $alias`" ]; then
-+                ln -s "$alias" "$CJKCIDPath"
-+            fi
-+            cid_registry=`head -10 "$alias" |grep ^%%Title |cut -d " " -f 3`
-+            cid_ordering=`head -10 "$alias" |grep ^%%Title |cut -d " " -f 4`
-+            install_cid "$cid_registry $cid_ordering" "`basename "$alias"`"
-+        ;;
-+        esac
-+    done
-+}
-+
-+
-+#
-+# setdefault <face> <fontfile>, eg.
-+# setdefault ming /usr/share/fonts/ttf/bsmi00lp.ttf.
-+#
-+# Set default font, accept kai or ming(default) only, all others will be
-+# treated as ming.
-+#
-+# All aliases will be set to "Default<face><encoding>-<weight>", like
-+# DefaultMingB5-Regular, or DefaultKaiGB-Regular.
-+#
-+# Currently we can't assign a CID font as default Kai/Ming.  This is
-+# because CID font has "/FontName" hard-coded.  I'm not sure if there
-+# are any safe ways to substitute this.
-+#
-+setdefault()
-+{
-+    face=$1
-+    if [ "$face" != "Ming" -a "$face" != "Kai" ]; then
-+        face="Ming"
-+    fi
-+    fontfile=$2
-+    if [ -n "`echo "$fontfile" |grep '='`" ]; then    # Ignore alias
-+        fontfile="`echo "$fontfile" |sed -n -e 's/^\(.*\)=\(.*\)$/\2/p'`"
-+    fi
-+    if [ ! -f "$fontfile" ]; then
-+        echo "$fontfile not found!"
-+    fi
-+
-+    case "$fontfile" in
-+    *.[Tt][Tt][CcFf])
-+        guess_ttf_info "$fontfile"
-+
-+        case "$TTF_ORDERING" in
-+        "Adobe CNS1")
-+            TTF_ALIAS="Default${face}B5-`echo $TTF_ALIAS |cut -d '-' -f 2`"
-+        ;;
-+        "Adobe GB1")
-+            TTF_ALIAS="Default${face}GB-`echo $TTF_ALIAS |cut -d '-' -f 2`"
-+        ;;
-+        *)
-+            TTF_ALIAS="Default${face}-`echo $TTF_ALIAS |cut -d '-' -f 2`"
-+        ;;
-+        esac
-+
-+        install_ttf "$TTF_ALIAS" "$fontfile",$TTF_INDEX
-+        install_cid "$TTF_ORDERING" "$TTF_ALIAS"
-+    ;;
-+    *)    # CID font.  Give a message and exit.
-+        echo "CID fonts can't be used as default fonts."
-+        echo "Please use TTF instead."
-+        exit 1
-+    ;;
-+    esac
-+}
-+
-+
-+#
-+# main program
-+#
-+
-+if [ $# -lt 1 ]; then
-+    Usage
-+    exit 1
-+fi
-+
-+ARG=$1
-+shift 1
-+
-+case $ARG in
-+--help)
-+    Usage
-+    ;;
-+--name)
-+    echo
-+    echo "$NAME $VERSION"
-+    echo
-+    ;;
-+--list)
-+    list_fonts
-+    ;;
-+--check)
-+    check_gs6
-+    ;;
-+--add)
-+    if [ $# -lt 1 ]; then
-+        echo "Missing font filename argument!"
-+        Usage
-+        exit 1
-+    fi
-+    add_fonts $@
-+    echo "Done!"
-+    ;;
-+--remove)
-+    if [ $# -lt 1 ]; then
-+        echo "Missing font filename argument!"
-+        Usage
-+        exit 1
-+    fi
-+    remove_fonts $@
-+    echo "Done!"
-+    ;;
-+--setdefault|--setdefault_ming)
-+    if [ $# -lt 1 ]; then
-+        echo "Missing font filename arguments!"
-+        Usage
-+        exit 1
-+    elif [ $# -gt 1 ]; then
-+        echo "Only need one font filename!"
-+        Usage
-+        exit 1
-+    fi
-+    setdefault "Ming" $1
-+    echo "Done!"
-+    ;;
-+--setdefault_kai)
-+    if [ $# -lt 1 ]; then
-+        echo "Missing font filename arguments!"
-+        Usage
-+        exit 1
-+    elif [ $# -gt 1 ]; then
-+        echo "Only need one font filename!"
-+        Usage
-+        exit 1
-+    fi
-+    setdefault "Kai" $1
-+    echo "Done!"
-+    ;;
-+*)
-+    Usage
-+    exit 1
-+    ;;
-+esac
-+
-+rm -f $TEMPFILE
-+exit 0
-+
-+
-+# ChangeLog
-+#
-+# * Sat Oct 18 2001 Chung-Yen Chang <candyz@linux.org.tw>
-+# - add Italic fonts support
-+#
-+# * Tue Sep  4 2001 Anthony Fok <anthony@thizlinux.com>
-+# - Use original PostScript font names instead of making them up  :-)
-+# - Added poorman's Bold font.  Still needs to work on Italic.
-+# - Gives HKSCS priority, e.g. kai00m.ttf (Big5&HKSCS) and bkai00mp.ttf
-+#   are both ZenKai-Medium; kai00m.ttf takes precedence.
-+#
-+# * Sat Dec 9 2000 Chung-Yen Chang <candyz@cle.linux.org.tw>
-+# - Modified for Red Hat Linux 
-+#
-+# $Log: gscjk.ttfm,v $
-+# Revision 1.1  2001/12/14 15:21:26  candyz
-+# add ttfm.sh.1 gscjk.ttfm
-+#
-+# Revision 1.1  2000/11/23 04:32:57  Keith
-+# Log entry was added.
-+#
-+# * Thu Nov 23 2000 Jing-Tang Keith Jang <keith@FreeBSD.org>
-+# - Initial version.
diff -ruN ttfm.orig/files/patch-modules::xttfm.ttfm ttfm/files/patch-modules::xttfm.ttfm
--- ttfm.orig/files/patch-modules::xttfm.ttfm	Thu Sep 25 00:05:03 2003
+++ ttfm/files/patch-modules::xttfm.ttfm	Thu Jan  1 08:00:00 1970
@@ -1,32 +0,0 @@
---- modules/xttfm.ttfm.orig	Sat Dec 21 22:56:45 2002
-+++ modules/xttfm.ttfm	Sat Dec 21 23:01:09 2002
-@@ -129,18 +129,25 @@
-     fontproperties=$7
-     fontencoding=$8
- 
-+    if [ "$fontproperties" = "m" ] ; then
-+       fontproperties="p"   
-+       FONTFACE="fn=1:"
-+    else
-+       FONTFACE=""
-+    fi
-+
-     # Create and update fonts.scale
-     touch $XTTFFONTPATH/fonts.scale
-     # Delete the first line, and duplicate entries if exist.
-     # We can't use uniq(1) here, since filenames may start with numbers.
-     sed -e "1d" $XTTFFONTPATH/fonts.scale |grep -iv "$fontfoundry-$fontfamily.*-$fontencoding$" > $TEMPFILE
- 
--    echo "$targetname -$fontfoundry-$fontfamily-$fontweight-$fontslant-$fontwidth--0-0-0-0-$fontproperties-0-$fontencoding" >> $TEMPFILE
-+    echo "${FONTFACE}$targetname -$fontfoundry-$fontfamily-$fontweight-$fontslant-$fontwidth--0-0-0-0-$fontproperties-0-$fontencoding" >> $TEMPFILE
-     # If it's medium-r, make a {medium,bold}-{i,r} full suite
-     if [ "X$fontweight" = "Xmedium" ] && [ "X$fontslant" = "Xr" ]; then
--        echo "ai=0.3:$targetname -$fontfoundry-$fontfamily-medium-i-$fontwidth--0-0-0-0-$fontproperties-0-$fontencoding" >> $TEMPFILE
--        echo "ds=y:$targetname -$fontfoundry-$fontfamily-bold-r-$fontwidth--0-0-0-0-$fontproperties-0-$fontencoding" >> $TEMPFILE
--        echo "ds=y:ai=0.3:$targetname -$fontfoundry-$fontfamily-bold-i-$fontwidth--0-0-0-0-$fontproperties-0-$fontencoding" >> $TEMPFILE
-+        echo "${FONTFACE}ai=0.3:$targetname -$fontfoundry-$fontfamily-medium-i-$fontwidth--0-0-0-0-$fontproperties-0-$fontencoding" >> $TEMPFILE
-+        echo "${FONTFACE}ds=y:$targetname -$fontfoundry-$fontfamily-bold-r-$fontwidth--0-0-0-0-$fontproperties-0-$fontencoding" >> $TEMPFILE
-+        echo "${FONTFACE}ds=y:ai=0.3:$targetname -$fontfoundry-$fontfamily-bold-i-$fontwidth--0-0-0-0-$fontproperties-0-$fontencoding" >> $TEMPFILE
-     fi
-     echo `cat $TEMPFILE |wc -l` > $XTTFFONTPATH/fonts.scale
-     cat $TEMPFILE >> $XTTFFONTPATH/fonts.scale
diff -ruN ttfm.orig/files/patch-ttfinfo.c ttfm/files/patch-ttfinfo.c
--- ttfm.orig/files/patch-ttfinfo.c	Thu Sep 25 00:05:03 2003
+++ ttfm/files/patch-ttfinfo.c	Thu Jan  1 08:00:00 1970
@@ -1,143 +0,0 @@
---- ttfinfo.c.orig	Sun Dec 17 02:56:41 2000
-+++ ttfinfo.c	Tue Jul 30 10:48:21 2002
-@@ -112,6 +112,7 @@
- static void  usage             (const char *name);
- static const char *get_foundry (const TT_Char orig_code[4]);
- static const char *get_name    (TT_Face face);
-+static const char *get_psname  (TT_Face face);
- static void  add_mapping (struct xlfdmapping **listhead,
- 			  char *file_name,
- 			  const char *foundry_name,
-@@ -684,6 +685,7 @@
-     TT_Face face;
-     TT_Face_Properties  properties;
-     const char *font_name;
-+    const char *font_psname;
-     const char *foundry_name;
-     const char *weight_name;
-     const char *width_name;
-@@ -722,6 +724,7 @@
-     }
- 
-     font_name    = get_name (face);
-+    font_psname  = get_psname (face);
-     foundry_name = get_foundry (properties.os2->achVendID);
-     weight_name  = get_weight (path, &properties);
-     width_name   = get_width_name (path, &properties);
-@@ -729,6 +732,7 @@
-     /* basic fone information */
-     fprintf(outstream,"TTFINFO_FONT_FILE=\"%s\"\n",path);
-     fprintf(outstream,"TTFINFO_FONT_NAME=\"%s\"\n",font_name);
-+    fprintf(outstream,"TTFINFO_FONT_PSNAME=\"%s\"\n",font_psname);
-     fprintf(outstream,"TTFINFO_FOUNDRY_NAME=\"%s\"\n",foundry_name);
-     fprintf(outstream,"TTFINFO_WEIGHT_NAME=\"%s\"\n",weight_name);
-     fprintf(outstream,"TTFINFO_WIDTH=\"%s\"\n",width_name);
-@@ -1206,7 +1210,7 @@
-        function returns as soon as an english name for the font is found,
-        so most of the time one loop is enough; however some fonts have only
-        non-english names in their font faminly entry, so the second loop
--       to try the Postscript name as last ressort
-+       to try the Postscript name as last resort
-     */
-     for (k = 0; k < 2; k++) {
- 
-@@ -1276,6 +1280,99 @@
- 		    }
- 	    }
- 	}
-+    }
-+ 
-+    /* Not found */
-+    return "unknown";
-+}
-+
-+/* This get_psname() function is copied from get_name().  I probably should
-+   try to merge the two functions somehow, but unfortunately, I do not have
-+   the time right now.  :-)  Anthony Fok <anthony@thizlinux.com>
-+*/
-+
-+const char *
-+get_psname (TT_Face face)
-+{
-+    int i, j, k, n;
-+
-+    TT_UShort  platform;
-+    TT_UShort  encoding;
-+    TT_UShort  language;
-+    TT_UShort  NameId;
-+
-+    /* get the number of name strings in this font */
-+    if ((n = TT_Get_Name_Count (face)) < 0) {
-+	return NULL;
-+    }
-+    /* printf("\nn=%d\n",n); */
-+
-+    /* for (k = 0; k < 2; k++) { */
-+
-+    k = 1;
-+	/* now look at every entry */
-+	for (i = 0; i < n; i++) {
-+	    TT_Get_Name_ID (face, i, &platform, &encoding, &language, &NameId);
-+	    /*	    printf("k=%d, face=%d, i=%d, platform=%d, encoding=%d, lang=%d, Id=%d\n",k ,face, i, platform, encoding, language, NameId); */
-+
-+	    if (NameId == TT_NAME_ID_PS_NAME) {
-+
-+		/* Try a Macintosh english name */
-+		if ((platform == TT_PLATFORM_MACINTOSH) && 
-+		    (language == TT_MAC_LANGID_ENGLISH))
-+		    {
-+			char*  string;
-+			TT_UShort string_len;
-+			static char  name_buffer[257];
-+			int   name_len;
-+			int   english=1;
-+
-+			TT_Get_Name_String (face, i, &string, &string_len);
-+			string_len =  string_len < 257 ? string_len : 257;
-+			name_len = 0;
-+
-+			for (j = 0; j < string_len; j++) {
-+			    /* some font names claim to be in english but aren't */
-+			    if ((string[j] & 0xff) > 0x7f) english=0;
-+			    name_buffer[name_len++] = string[j];
-+			}
-+
-+			name_buffer[name_len] = '\0';
-+			if (english) return name_buffer;
-+		    }
-+		/* Try to find an Apple Unicode or Microsoft English name */
-+		if ((platform == TT_PLATFORM_APPLE_UNICODE) ||
-+		    ((platform == TT_PLATFORM_MICROSOFT) &&
-+		     ((language & 0x00FF) ==
-+		      (TT_MS_LANGID_ENGLISH_UNITED_STATES & 0x00FF))) ||
-+		    (((platform == TT_PLATFORM_MICROSOFT) &&
-+		      (encoding == TT_MS_ID_UNICODE_CS)) &&
-+		     (NameId == TT_NAME_ID_PS_NAME)))
-+		    {
-+			/* The following code was inspired from Mark Leisher's */
-+			/* ttf2bdf package                                     */
-+			char*  string;
-+			TT_UShort string_len;
-+			static char  name_buffer[513];
-+			int   name_len;
-+			int   english=1;
-+
-+			TT_Get_Name_String (face, i, &string, &string_len);
-+			string_len =  string_len < 512 ? string_len : 512;
-+			name_len = 0;
-+			/* convert from unicode to ASCII */
-+			for (j = 0; j < string_len; j ++) {
-+			  /* drop the NULL part, dont't use j+=2 to avoid
-+			     endian problem. */
-+			  if (string[j] != '\0'){
-+			    if ((string[j] & 0xff) > 0x7f) english=0;
-+			    name_buffer[name_len++] = string[j];
-+			  }
-+			}
-+			name_buffer[name_len] = '\0';
-+			if (english) return name_buffer;
-+		    }
-+	    }
-     }
-  
-     /* Not found */
diff -ruN ttfm.orig/pkg-plist ttfm/pkg-plist
--- ttfm.orig/pkg-plist	Thu Sep 25 00:05:03 2003
+++ ttfm/pkg-plist	Thu Sep 25 00:01:07 2003
@@ -2,13 +2,7 @@
 bin/ttfm.sh
 share/doc/ttfm/README
 share/doc/ttfm/USAGE
-share/ttfm/abiword.ttfm
-share/ttfm/chitex.ttfm.nop
-share/ttfm/ghostscript6.ttfm.nop
 share/ttfm/gscjk.ttfm
-share/ttfm/ttf2pk.ttfm.nop
-share/ttfm/xttfm-tcl.ttfm.nop
-share/ttfm/xfreetype.ttfm
 share/ttfm/xttfm.ttfm
 @dirrm share/ttfm
 @dirrm share/doc/ttfm
	


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030924160923.5D1FFAEE>