Tag Archives: font

思源/Noto pan-CJK 字體 & Ubuntu

以開源協議授權釋出的字體大多數以拉丁字母等歐洲語言爲主,但最近 Adobe 和 Google 共同推出的思源/Noto pan-CJK 開源字體不只涵蓋了大部份中日韓所需要的字型,而且繁中、簡中、日文和韓文都用了不同的 OTF 檔案,因此對同一個漢字在不同地區的不同寫法就能個別處理,算是解決了 Unicode 一直爲人詬病的 Han unification 問題。

香港人最關心的應該是該字體是否覆蓋 HKSCS,我檢查過部份 hkscs-2008-big5-iso.txt 的 unicode 碼,在 NotoSansHant 裏都能找到,而且目測在 CJK BCD 區裏都有覆蓋,所以應該夠用(在下面的圖找找吧)。

用 Fontforge 查看 NotoSansHant-Regular.otf
用 Fontforge 查看 NotoSansHant-Regular.otf

從下面幾張 screenshot 可以看到香港字顯示效果理想:


想將 Ubuntu 的桌面 UI 和程式的預設字體改成思源/Noto,可以參考 Ingram Chen 的 blog。小弟改良了一下 Ingram 的 fontconfig 設定檔,使系統在不同 locale 下能優先選擇適當的字體,比如 zh_TW 下繁體的 Noto Sans T Chinese 是第一選擇,在 zh_CN 下則爲簡體的 Noto Sans S Chinese,之後其他的 CJK 字體作爲 fallback。

設定檔已放在 20-noto-cjk.conf,下載後執行:

mkdir ~/.config/fontconfig/conf.d
mv 20-noto-cjk.conf ~/.config/fontconfig/conf.d

另外如果要配置英文字體,可以下載 10-latin.conf,修改一下檔案中的字體部份,同樣放進 ~/.config/fontconfig/conf.d 即可。

Using Kai font for MacTeX on OS X

Typesetting LaTeX with CJK on Mac OS X is provided out-of-box by MacTeX, so working with LaTeX should be a breeze on Mac OS X. However, MacTeX ships with only two Chinese fonts, Arphic Ming Big5 (bsmi) and Arphic Sung GB2312 (gbsn). As I want to use Kai I have to look around for solutions.

I found this great website that explains how to use LaTeX and the CJK package on OS X. The good news is that the author of the page provides a shell script for installing any Unicode truetype fonts for TexLive so that you can use the truetype fonts in your LaTeX documents. The bad news is… it doesn’t work on my system. I tried it on both Arphic Big5 and GB2312 Kai fonts, and when I ran my LaTeX document through the latex command (or in TeXShop, for that matters), I came to this error:

Trying the shell script on the STKaiti font (/Library/Fonts/华文楷体.ttf) shipped with OS X, is even worse, because ttf2tfm gives a “Bus error” (or segfault on Linux) when parsing the truetype font, looks like a bug in ttf2tfm:

At the end, I resort to extracting the necessary files from Debian packages (hurray Debian) and put them into ~/Library/texmf, and that works!

The Debian packages I use are latex-cjk-chinese-arphic-bkai00mp and latex-cjk-chinese-arphic-gkai00mp. Since Debian packages are just ar archives, they can be extracted by the ar x command. After the deb package has been extracted, extract the data.tar.gz file, and then look for the folders called fonts and tex, move them to ~/Library/texmf, which you have to create. Now you should have a directory structure like this:

MacTex font installation

After the font files have been put in place, run these two commands (for the Big5 Kai truetype font):

$ sudo texhash
$ sudo updmap --enable Map bkaiu.map

For the GB2312 one, use:

$ sudo texhash
$ sudo updmap --enable Map gkaiu.map

It’s that easy!