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

測試 XFree86-4.0.2 之 "freetype" 模組成功……



眾所周知,本來是 patch 的 xfsft 和 x-tt 皆正式進入了 XFree86-4.x 裏,
分別名為 "freetype" 和 "xtt" 模組。目前 Debian 中文計劃仍沿用日本的 xtt,
而在 /etc/X11/XF86Config-4 也要把 Section "Module" 內的 Load "freetype"
改作 Load "xtt"。

其實 xfsft 和 x-tt 兩者在幕後所用的 TrueType 字型描繪器的都是 FreeType 1,
而聽說 xfsft 也支援多種不同編碼的字型,但我自己始終沒有試過 "freetype"
module 的中文支援。前天,我終於決定一試,竟然成功了!  :-)
如果你也想玩玩,不妨試試。(但如果你不熟 X11,或不懂如何恢復原來設定,
請不要亂試。)測試方法如下:

  1. 把 /etc/X11/XF86Config-4 內的 Load "xtt" 改為 Load "freetype"。

  2. # cd /usr/lib/X11/fonts/TrueType
  3. 備份原來的 /usr/lib/X11/fonts/TrueType/fonts.scale 檔:
	# cp -av fonts.scale fonts.scale.xtt

  3. 修改 fonts.scale。xfonts-arphic-* 套件裏面的 fonts.scale 是給
     xtt 用的;freetype 用的格式不同;可惜兩者不能共存。我自己暫時
     測試的 /usr/lib/X11/fonts/TrueType/fonts.scale 是:

12
bkai00mp.ttf -Arphic-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-big5-0
bkai00mp.ttf -Arphic-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-iso8859-1
bkai00mp.ttf -Arphic-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-iso10646-1
bsmi00lp.ttf -Arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-big5-0
bsmi00lp.ttf -Arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-iso8859-1
bsmi00lp.ttf -Arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-iso10646-1
gkai00mp.ttf -Arphic-AR PL KaitiM GB-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
gkai00mp.ttf -Arphic-AR PL KaitiM GB-medium-r-normal--0-0-0-0-c-0-iso8859-1
gkai00mp.ttf -Arphic-AR PL KaitiM GB-medium-r-normal--0-0-0-0-c-0-iso10646-1
gbsn00lp.ttf -Arphic-AR PL SungtiL GB-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
gbsn00lp.ttf -Arphic-AR PL SungtiL GB-medium-r-normal--0-0-0-0-c-0-iso8859-1
gbsn00lp.ttf -Arphic-AR PL SungtiL GB-medium-r-normal--0-0-0-0-c-0-iso10646-1

  4. 執行(全一行):
	# mkfontdir -e /usr/lib/X11/fonts/encodings -e /usr/lib/X11/fonts/encodings/large
     也不妨順便看看 /usr/lib/X11/fonts/encodings 目錄裏的東西。 :-)

  5. 重新啟動 X 視窗系統。

  6. 在 X 底下,試試:
	$ xlsfonts -fn '-arphic-*'
	$ xlsfonts -fn '-default-*'     # CLE 和 Debian 皆設了一大堆
					# "default" 的 font aliases.
	$ xfd -fn '-arphic-ar pl mingti2l big5-medium-r-normal--24-0-0-0-c-0-big5-0' -start 41216
	$ xfd -fn '-arphic-ar pl kaitim big5-medium-r-normal--24-0-0-0-c-0-big5-0' -start 41216
	$ xfd -fn '-arphic-ar pl kaitim gb-medium-r-normal--24-0-0-0-c-0-gb2312.1980-0' -start 8448
	$ xfd -fn '-arphic-ar pl sungtil gb-medium-r-normal--24-0-0-0-c-0-gb2312.1980-0' -start 8448

  7. 斜體?用 XFLD 的 linear transformation 吧!
	$ xfd -fn '-arphic-ar pl sungtil gb-medium-r-normal--[24 0 3 24]-0-0-0-c-0-gb2312.1980-0' -start 8448
     如此類推。

XFree86 4.x 裏 xtt 與 freetype module 的比較:

  1. 似乎 freetype 比 xtt 稍快一點?這個我可沒有做過正式測試,只是似乎
     是快一點,但也可能是心理作用。

  2. freetype module 似乎不支援 poor-man's bold,也就是不能夠自動顯示
     「窮人的粗體」字型。 CLE, Debian 上的文鼎字型本來不是粗體字型,
     要用粗體時,xtt 會把每個字重覆顯示兩次,左右分開了一點兒,
     看起來就像是粗體了。freetype module 似乎沒有這個。

  3. 兩者皆可支援斜體,但如果要用 freetype module 顯示斜體,大概要用
     "default" 的 aliases 了,例如在 fonts.alias 裏:

	-default-kai-medium-i-normal--24-240-72-72-c-240-big5-0 "-Arphic-AR PL KaitiM Big5-medium-r-normal--[24 0 3 24]--0-0-c-0-big5-0"

     直接用 -Arphic-AR PL KaitiM Big5-medium-i-normal--24-240-0-0-c-0-big5-0
     出不了斜體。

  4. 目前的 xtt 轉碼表有 bug?  (還有 bug 嗎?) 只有 xtt 自己用。
     在 /usr/X11R6/lib/modules/codeconv/ 底下。
     freetype 用的轉碼表,似乎不只 freetype 用,而 Type1、CID 字型等也用
     相同的轉碼表。在 /usr/lib/X11/fonts/encodings 底下。

  5. fonts.scale, 即 fonts.dir 的格式不同。暫時兩者也不相容。
     我本來想 xfonts-arphic-* 這四個 Debian 套件同時支援 xtt 和 freetype
     的 fonts.scale 模式,但似乎比預料中的困難。將來再算把。

哈,我這封信就是在 XFree86 4.0.2 利用 Load "freetype" 在一個使用了文鼎
楷書字型的 crxvt 裏面打的了。似乎也相當不錯啊!  :-)  不過因為以上提及
粗體字的問題,所以都是暫時用 xtt module 好了。不知道將來這兩個 modules
的發展如何,因為究竟大家做的事都是相同的,差不多可以互相取替了。
將來會合而為一嗎?難說,難說!  :-)

					東東

-- 
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: