LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 748|回复: 3

为Latex-CJK生成字体的sh无法运行?

[复制链接]
发表于 2003-11-22 10:25:05 | 显示全部楼层 |阅读模式
从网上找到的一段代码,运行出错,麻烦大家帮忙看一下,多谢!
连接:http://liy.slat.org/study/tips/latex/pdftex.html/view
#!/bin/sh
#
# By Edward G.J. Lee 2001.11.25
# This code is Public Domain.
#
if [ $# -ne 1 ]
then
  echo "Usage: `basename $0` your.ttf"
  exit 1
fi
echo
echo "Now create *.t1a and *.enc files, wait... "
echo
FONTNAME=$1
MAPFILE=/usr/share/ttf2pt1/maps/cubig5.map
n=1
while [ $n -lt 10 ]
do
  m=0$n
ttf2pt1 -GE -pft -Ohub -W0 -L $MAPFILE+$m $FONTNAME ${FONTNAME%.ttf}$m
  n=`expr $n + 1`
done
m=10
while [ $m -lt 56 ]
do
ttf2pt1 -GE -pft -Ohub -W0 -L $MAPFILE+$m $FONTNAME ${FONTNAME%.ttf}$m
  m=`expr $m + 1`
done
# avoid dvips(k)(before v5.86) t1part module bug.
perl -pi -e 's/_/Z/g' *.t1a *.afm
echo
echo "Now create *.pfb, wait... "
echo
for ps in *.t1a
do
  t1asm -b $ps > ${ps%.t1a}.pfb
done

echo
echo "Now create *.tfm, wait... "
echo
for afm in *.afm
do
  afm2tfm $afm
done
AFM=${FONTNAME%.ttf}-afm
TFM=${FONTNAME%.ttf}-tfm
PFB=${FONTNAME%.ttf}-pfb
ENC=${FONTNAME%.ttf}-enc
rm -f *.t1a
mkdir -p $AFM $TFM $PFB $ENC
mv -f *.enc $ENC
mv -f *.afm $AFM
mv -f *.tfm $TFM
mv -f *.pfb $PFB
echo
echo "OK, all done. :-)"
echo
发表于 2003-11-23 10:47:36 | 显示全部楼层
你提供的链接已经说明得很详细的啦~~
另外,把你的运行时出现的信息帖出来,
BTW:t1asm是什么命令?
发表于 2003-11-23 14:27:38 | 显示全部楼层
在perl这样就是加载一个模块了。象Net::FTP Net::Nslookup

在shell,类似吧。。
 楼主| 发表于 2003-11-24 21:40:25 | 显示全部楼层
问题解决,原来是Win2000下的Vim转存后忘改格式,在Debian下的Vim没看出问题就是无法运行,后在FB下的Vi中将各行未的^M删除即可,如想生成GBK汉字要更改相应的Map文件和循环的次数,同时最后的*.fd与*.map也要作相应的修改,同时各系统的map文件位置也不一样,当然生成字体的方法很多,测试这个脚本的目的只是好奇. 多谢回贴的各位兄弟!

T1ASM(1)

NAME
       t1asm - assemble PostScript Type 1 font

SYNOPSIS
       t1asm [-a|-b] [-l length] [input [output]]

DESCRIPTION
       t1asm  assembles  Adobe Type 1 font programs into either PFA (hexadeci‐
       mal) or PFB (binary) formats from a human‐readable form.  If  the  file
       output is not specified output goes to the standard output. If the file
       input is not specified input comes from the standard input.

       t1asm tokenizes the charstring data and performs eexec  and  charstring
       encryption  as  specified in the ‘‘black book,’’ Adobe Type 1 Font For‐
       mat.

       The input must have a line of the form
              /‐|{string currentfile exch readstring pop}executeonly def
       which defines the  command,  in  this  case  ‘-|’,  that  is  to  start
       charstring  data.  It is an error not to define such a command. Another
       common name for this command is ‘RD’.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表