看板FreeBSD
标 题Re: [outta-port] moefonts-dir 增加粗体,斜体,粗斜体支援
发信站SayYA 资讯站 (Mon Jul 1 05:04:21 2002)
转信站Ptt!news.ntu!freebsd.ntu!ctu-peer!news.nctu!ctu-reader!Cynix
※ 引述《statue (statue)》之铭言:
> chinese/moefonts-cid 只有基本的字体,看过 gs-cjk 的作法後,
> 帮 moefonts-dir 增加粗体,斜体,粗斜体支援,由於还在测试所以先放
> outta-port,帮忙看看有没有问题吧 :)
> # cd /usr/ports/outta-port/moefonts-cid
> # make install
> # gv work/moefonts-cid-1.0/cid.ps
> snapshot: http://freebsd.sinica.edu.tw/~statue/snapshot/moefonts-cid.png
如果对列印的部分有兴趣可以参考
现在的中文列印
http://freebsd.sinica.edu.tw/~statue/index.php?file=20020527
kde2 中文列印
http://freebsd.sinica.edu.tw/~statue/index.php?file=20020614
CID-keyed
http://freebsd.sinica.edu.tw/~statue/zh-tut/cidps.html
chinese/ghostscript6 已经不需要了,经由 gs-cjk 的整合,现在已经是
print/ghostscript-gnu 内建的一部分了,而 outta-port/ghostscript-gnu-zhfont
也已经可以由 chinese/ttfm 的 gs-cjk 模组来产生了。
以 MOESung-Regular 为例子
从 adobe 网站可以抓到 40pt 的 MOESung-Regular 档案,这是 CIDFont,
所以必须额外安装 adobe-cmaps 来搭配,所以会 DEPENDS print/adobe-cmaps。
再来是建立粗体,斜体,粗斜体等,在看完 ttfm 的 gs-cjk 模组後,
有个想法就是 gs-cjk 的做法是在 ttf 上面建立粗体,斜体,粗斜体等,
这些做法是不是应该也适用於 moefonts-cid?
因此就建立了 MOESung-Regular-Bold
=== ---< ===
%!PS-Adobe-3.0 Resource-CIDFont
%%BeginResource: CIDFont (MOESung-Regular-Bold)
/MOESung-Regular-Bold
/MOESung-Regular /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
=== >--- ===
以及 MOESung-Regular-Bold-ETen-B5-H.gsf
=== ---< ===
/MOESung-Regular-Bold-ETen-B5-H
/MOESung-Regular-Bold (MOESung-Regular-Bold)
/ETen-B5-H (CMap/ETen-B5-H)
1 index /CMap resourcestatus
{pop pop pop}
{runlibfile} ifelse
/CMap findresource
3 1 roll
1 index /CIDFont resourcestatus
{pop pop pop}
{runlibfile} ifelse
/CIDFont findresource
[ exch ] composefont pop
=== >--- ===
结果发现在测试档 cid.ps
=== ---< ===
/MOESung-Regular-ETen-B5-H findfont 30 scalefont setfont
50 600 moveto (2000年5月29日) show
/MOESung-Regular-Bold-ETen-B5-H findfont 30 scalefont setfont
50 560 moveto (2000年5月29日) show
/MOESung-Regular-Italic-ETen-B5-H findfont 30 scalefont setfont
50 520 moveto (2000年5月29日) show
/MOESung-Regular-BoldItalic-ETen-B5-H findfont 30 scalefont setfont
50 480 moveto (2000年5月29日) show
/MOEKai-Regular-ETen-B5-H findfont 30 scalefont setfont
50 440 moveto (2000年5月29日) show
/MOEKai-Regular-Bold-ETen-B5-H findfont 30 scalefont setfont
50 400 moveto (2000年5月29日) show
/MOEKai-Regular-Italic-ETen-B5-H findfont 30 scalefont setfont
50 360 moveto (2000年5月29日) show
/MOEKai-Regular-BoldItalic-ETen-B5-H findfont 30 scalefont setfont
50 320 moveto (2000年5月29日) show
showpage
quit
=== >--- ===
粗体的部分出现了预期的效果,所以就继续制作斜体与粗斜体,
这部分可以参考
斜体:MOESung-Regular-Italic
粗斜体:MOESung-Regular-BoldItalic
最後,记得把这些 .gsf 写入 /usr/local/share/ghostscript/7.05/lib/Fontmap.GS
写法是:字型 (字型.gsf)
=== ---< ===
/MOESung-Regular-ETen-B5-H (MOESung-Regular-ETen-B5-H.gsf) ;
/MOESung-Regular-Bold-ETen-B5-H (MOESung-Regular-Bold-ETen-B5-H.gsf) ;
/MOESung-Regular-BoldItalic-ETen-B5-H (MOESung-Regular-BoldItalic-ETen-B5-H.gsf) ;
/MOESung-Regular-Italic-ETen-B5-H (MOESung-Regular-Italic-ETen-B5-H.gsf) ;
=== >--- ===
最後修改一下 -H 成 -V 再重复上面的过程即可,
其他的字型也是几乎一样的做法就可以完工了,
不过,真的比不上用 ttf 做出来的呀 :p
如此建立完,就会有一堆可用的 CID-keyed 字型
MOESung-Regular-ETen-B5-H
MOESung-Regular-Bold-ETen-B5-H
MOESung-Regular-BoldItalic-ETen-B5-H
MOESung-Regular-Italic-ETen-B5-H
这样子在配合文书软体上,应该会更好,我想文书软体慢慢的也会把列印的部分用
gs 所提供的字型来模拟,像是 editors/Abiword 就是个很棒的例子,
而 kde2 则是自己做粗体,斜体等的模拟,不过我还没去测试到粗体和斜体的部分,
等有空闲了再去试试...
另外,想徵求人来做 FreeBSD Chinese HOWTO 的维护,当时间越来越少的时候,
很怕这份文件会烂掉 :Q
--
※ Origin: SayYA 资讯站 <bbs.sayya.org>
◆ From: u8-177.u203-204.giga.net.tw