[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian 3.0 (woody) 版中文化



On Sun, May 13, 2001 at 06:03:22PM +0800, Edward G.J. Lee wrote:
>   pdflatex 可能可以用,但 cjk-latex + dvips 可能就不一定了,因為字型並
>   非使用 CJK 編碼。
>  
>   cjk.pfb(由 ttf2pfb 所產生的)
>   ...
>   dup 0/cjkC4EB put
>   dup 1/cjkC4EC put
>   dup 2/cjkC4ED put
>   ...
> 
>   non-cjk.pfb(由 ttf2pt1 所產生的)
>   ...
>   dup 0 /c0 put
>   dup 1 /c1 put
>   dup 2 /c2 put
>   ...

>   不曉得是 dvips 的問題,還是 ttf2pt1 的問題。ttf2pfb 會預設產生
>   CJK 編碼的字型,所以很容易就可以被 cjk-latex + dvips 使用。如
>   果由 pfaedit 很容易就看出兩者不同,不知道是不是這個原因?

ttf2pt1 似乎硬要用 latin1 (iso8859-1) 編碼的字型名稱,不知這個是否我的
致命傷? :-)  大概是時候玩玩 ttf2pt1 的原始碼了。 :-|

>   相反的,由 ttf2pfb 做出來的 CJK 編碼字型,卻無法被 pdflatex 使
>   用,這下怎麼辦?:-(
>   Error: pdflatex (file aming01.pfb): unexpected end of file

  請問你用 ttf2pfb 處理文鼎字型時,是用什麼指令的?你用的字型是
bsmi00lp.ttf 嗎?因為我不知道如何叫 ttf2pfb 讀 Unicode 編碼的
gkai00mp.ttf 而製出 CJK LaTeX 使用的 map。

>   比較之下,由 ttf2pt1 自 Unicode 文鼎 TTF 做出來的字型,編譯出 pdf
>   檔時,字型品質明顯差一點,可能是我還不熟悉 ttf2pt1 的關係。
>   我的製作方式:
>   ttf2pt1 -b -A -e -L cubig5.map+01 aming.ttf aming01
>   * 我的 ttf2pt1 是 link 至 freetype2 的。而 ttf2pfb 則是 link 至
>     freetype1。

我的 ttf2pt1 (3.3.3) 沿用 ttf2pt1 自帶的 ttf engine (我今次懶,沒有
link FreeType 2。 /usr/bin/ttf2pfb 跟你一樣,都是連至 FreeType 1.x
(即 libttf.so.2)。

>   foka 兄能否說明您製作過程?謝謝!

  # 製作字型檔:
  for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 \
           21 22 23 24 25 26 27 28 29 30 31 32 33 34 35; do 
    ./ttf2pt1 -L maps/cugb.map+$i gkai00mp.ttf gkai$i
    ./t1asm -b gkai$i.t1a gkai$1.pfb
  done

其中 "t1asm",在我的系統上有三個版本:
ttf2pt1 內附的 t1asm, ttf2pfb 附的 t1asm (在 Debian 上是
/usr/bin/t1asm-freetype),和 t1utils 套件裏的 t1asm (最新版,
Debian 上是 /usr/bin/t1asm)。我三者都試過,似乎效果相同。唔……
ttf2pfb 的 t1asm (t1asm-freetype),Werner Lemberg 加了個 patch,
以幫助 dvips 的 partial font downloading。但那是兩年多前的事了,
可能現今的 dvips 已經夠聰明?不知道。

然後,把字型複製至適檔的目錄裏:

  cp gkai??.afm /usr/share/texmf/fonts/afm/arphic/gkai00mp/  
  cp gkai??.tfm /usr/share/texmf/fonts/tfm/arphic/gkai00mp/
  cp gkai??.pfb /usr/share/texmf/fonts/type1/arphic/gkai00mp/

(註:這是為了方便測試嘛!不過其實我可能應該把這些放在
      /usr/local/share/texmf 底下。另外,這樣會把 tfm-arphic-gkai00mp 套件
      原有的一些 gkai??.tfm 檔覆寫掉,所以我先做了備份。)

然後修改或添加以下檔案:

/usr/share/texmf/tex/latex/CJK/GB/c10gkai.fd
	\def\fileversion{4.2.0}
	\def\filedate{1998/12/13}
	\ProvidesFile{c10gkai.fd}[\filedate\space\fileversion]
	
	% simplified Chinese characters in GuoBiao encoding scheme.
	
	% Arphic PL TrueType font "AR PL KaitiM GB"
	
	%\DeclareFontFamily{C10}{gkai}{}
	\DeclareFontFamily{C10}{gkai}{\hyphenchar \font\m@ne}
	
	\DeclareFontShape{C10}{gkai}{m}{n}{<-> CJK * gkai}{}
	\DeclareFontShape{C10}{gkai}{m}{sl}{<-> CJK * gkais}{}
	\DeclareFontShape{C10}{gkai}{m}{it}{<-> CJKssub * gkai/m/sl}{}
	\DeclareFontShape{C10}{gkai}{bx}{n}{<-> CJKb * gkai}{\CJKbold}
	\DeclareFontShape{C10}{gkai}{bx}{sl}{<-> CJKb * gkais}{\CJKbold}
	\DeclareFontShape{C10}{gkai}{bx}{it}{<-> CJKssub * kai/bx/sl}{\CJKbold}

	\endinput

對了,那個 {\hyphenchar \font\m@ne} 是幹什麼的?我以前一向都沒有加。 :-)


/etc/texmf/dvips/arphic.map:
	gkai01 Gkai01 <gkai01.pfb
	gkai02 Gkai02 <gkai02.pfb
	gkai03 Gkai03 <gkai03.pfb
	...
	gkais01 Gkai01 " .167 SlantFont " <gkai01.pfb
	gkais02 Gkai02 " .167 SlantFont " <gkai02.pfb
	gkais03 Gkai03 " .167 SlantFont " <gkai03.pfb
	...
等等。也就是說,可以很容易製作斜體字了。 :-)  不過要加上對應的
gkais??.tfm 檔。我暫時只是把 gkai??.tfm 複製為 gkais??.tfm,橫豎它們
的字寬是相同的。 :-)  但將來應該用更正統的方法解決。直排?我就不知道
簡單的方法了。不知 cwTeX 和 ChiTeX 是如何辦到的。 ttf2pk 可以旋轉字型,
但基本上是另製一套 *pk 檔。唔……

/etc/texmf/dvips/config.arphic:
	p +arphic.map

/etc/texmf/pdftex/pdftex.cfg 的檔末加了:
	map +arphic.map

然後執行 mktexlsr 就是了。

我試了 CJK-LaTeX 裏的 GB.tex,稍作了修改,用 "gkai" 字型:

	latex GB.tex
	dvips -P arphic -P cmz GB.dvi -o
	gv GB.ps
	gs GB.ps

gv 和 gs 的效果相同,中文字都以 Courier 代替了,只是 gs 更顯示了什麼
地方出錯(gs 往別處找 gkai 字型幹嘛?)

反之, pdflatex 出來的效果卻是完美的:

	pdflatex GB.tex
	acroread GB.pdf
	xpdf GB.pdf

acroread 和 xpdf 都能順利讀到這個 PDF 檔,顯示漂亮的文鼎楷書字型。 :-)

有空也可以問問 Werner Lemberg (CJK for LaTeX 的作者; FreeType 的
co-author,等等)。另外,相信陳老師或王老師也可能知道解決方法。 :-)

P.S. Werner 似乎出了 CJK 4.4.0 = TeXLife6-CJK.tar.bz2,在
http://cjk.ffii.org/ 上有連結。我下載了,未玩。 :-)

					東東

-- 
Anthony Fok Tung-Ling                Civil and Environmental Engineering
foka@ualberta.ca, foka@debian.org    University of Alberta, Canada
   Debian GNU/Linux Chinese Project -- http://www.debian.org/intl/zh/
Come visit Our Lady of Victory Camp -- http://www.olvc.ab.ca/



Reply to: