這里做一個(gè)網(wǎng)絡(luò)備份。
前言
文中使用到的軟件和字體有:
看到一些古文的文章附鸽,于是想找一款優(yōu)質(zhì)的字體制作成 PDF 放到 iPad 上,可很多字體一方面字形不夠優(yōu)美瞒瘸,另一方面字體在終端閱讀體驗(yàn)不佳拒炎,最近剛好發(fā)現(xiàn)了方正屏顯蘭亭宋_GBK
這款字體,放在 iPad 上筆畫看起來(lái)適中挨务,閱讀體驗(yàn)不錯(cuò),于是想試試能不能豎排玉组,然而悲劇的是谎柄,這款字體并不支持豎排,所以我用 Glyphs
這款軟件編輯字體惯雳,添加了幾個(gè)豎排的標(biāo)點(diǎn)符號(hào)朝巫,先看看效果:
可以看到經(jīng)過修改,標(biāo)點(diǎn)符號(hào)已經(jīng)符合標(biāo)準(zhǔn)石景,未修改之前是什么效果呢:
我們來(lái)看看是如何實(shí)現(xiàn)的吧劈猿,先理解幾個(gè)概念
字體尺寸(Font Metrics)
上圖定義了這款字體的默認(rèn)字形的尺寸。下圖是通用的尺寸圖:
名詞 | 描述 |
---|---|
baseline | 每一行都有一條基線潮孽,字體從左到右沿著基線排列 |
x height | 小寫字母的高度揪荣,行的基本高度 |
cap height | 大寫字母的高度 |
ascender | 基線為基準(zhǔn),行的最高高度 |
descender | 基線以下的高度 |
舉個(gè)例子往史,修改后的句號(hào)是這樣的:
位置靠右仗颈,在 的位置上下,放大看看:
字體的 features
這里定義了的一些基本特性椎例,比如標(biāo)點(diǎn)符號(hào)替換挨决,字形全寬度和半寬度替換等请祖,我們看看 AdobeSongStd-Light
的 features
:
我們這里只涉及到豎排的支持,所以只需關(guān)注 vert
脖祈。我已經(jīng)整理一個(gè)簡(jiǎn)單的支持中文豎排的替換表(借鑒的是 AdobeSongStd-Light
):
item | unicode | alias | item | unicode | alias |
---|---|---|---|---|---|
uniFF1A | colon.full | uniE790 | colon.vert | ||
uniFF1B | semicolon.full | uniE791 | semicolon.vert | ||
uniFF01 | exclam.full | uniE792 | exclamation.vert | ||
uniFF1F | question.full | uniE793 | question.vert | ||
uniFF0E | period.full | period.full.vert | |||
uni3001 | comma-han | uniE78F | |||
uni3002 | period-han | uniE78E | |||
uni2018 | quoteleft | uniFE41 | |||
uni2019 | quote right | uniFE42 | cornerbracketright | ||
uni201C | quotedblleft | uniFE43 | whitecornerbracketleft | ||
uni201D | quotedblright | uniFE44 | |||
uniFF3B | bracketleft.full | bracketleft.full.vert | |||
uniFF3D | bracketright.full | bracketright.full.vert | |||
uniFF08 | parenleft.full | uniFE35 | parenleft.full.vert | ||
uniFF09 | parenright.full | uniFE36 | parenright.full.vert | ||
uni3008 | anglebracketleft | uniFE3F | anglebracketleft.vert | ||
uni3009 | anglebracketright | uniFE40 | anglebracketright.vert | ||
uni300A | dblanglebracketleft | uniFE3D | dblanglebracketleft.vert | ||
uni300B | dblanglebracketright | uniFE3E | dblanglebracketright.vert | ||
uni300C | cornerbracketleft | uniFE41 | cornerbracketleft.vert | ||
uni300E | whitecornerbracketleft | uniFE43 | |||
uni300D | cornerbracketright | uniFE42 | cornerbracketright.vert | ||
uni300F | whitecornerbracketright | uniFE44 | |||
uni3010 | blacklenticularbracketleft | uniFE3B | |||
uni3011 | blacklenticularbracketright | uniFE3C | |||
uniFF5B | braceleftsmall | uniFE37 | braceleft.full.vert | ||
uniFF5D | braceright.full | uniFE38 | braceright.full.vert |
制作豎排替換表
根據(jù)上表肆捕,我們依葫蘆畫瓢,得到如下的 features
:
script hani;
lookupflag RightToLeft;
# comment
# FZ Ping Xian Lan Ting Song GBK
sub uniFF01 by uniE792 ;
sub uniFF1A by uniE790 ;
sub uniFF1B by uniE791 ;
sub colon by uniE790;
sub comma by uniE78D;
sub quoteleft by uniFE41;
sub quoteright by uniFE42;
sub quotedblleft by uniFE43;
sub quotedblright by uniFE44;
sub uni3001 by uniE78F;
sub uni3002 by uniE78E;
sub uni3008 by uniFE3F;
sub uni3009 by uniFE40;
sub uni300A by uniFE3D;
sub uni300B by uniFE3E;
sub uni300C by uniFE41;
sub uni300D by uniFE42;
sub uni300E by uniFE43;
sub uni300F by uniFE44;
sub uni3010 by uniFE3B;
sub uni3011 by uniFE3C;
sub uniFE50 by uniE78D;
sub uniFE51 by uniE78F;
sub uniFE54 by uniE790;
sub uniFE55 by uniE791;
sub uniFF08 by uniFE35;
sub uniFF09 by uniFE36;
sub uniFF0C by uniE78D;
sub uniFF0E by notdef.27;
sub uniFF1F by uniE793;
sub uniFF3B by notdef.28;
sub uniFF3D by notdef.29;
sub uniFF5B by uniFE37;
sub uniFF5D by uniFE38;
sub
是替換的意思盖高。
添加 features
的時(shí)候用 compile
進(jìn)行測(cè)試慎陵,如果沒有通過,就是 unicode 的編碼不對(duì)或者沒有對(duì)應(yīng)的字形或舞。在添加之前荆姆,我已經(jīng)制作了豎排的標(biāo)點(diǎn)符號(hào):
最后的效果就非常出眾了:
Bug
在 instances
有個(gè)一個(gè)自定義的字段:postscriptFullName
無(wú)法支持中文,所以需要改成英文的映凳。
我們?cè)?font
添加一個(gè) localizedFamilyName
字段胆筒,這樣其他程序就可以正確識(shí)別這個(gè)字體了: