準備

1
# apt install fontforge

合成 Monaco and Powerline 實例

1
2
$ mkdir font-metge
$ cd font-metge
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ vi font-merge.pe

# A font
Open("Monaco_Linux.ttf")
SelectAll()
ScaleToEm(1024)
Generate("Temporary-A.ttf", "", 0x14)
Close()

# B font
Open("PowerlineSymbols.otf")
SelectAll()
ScaleToEm(1024)
Generate("Temporary-B.otf", "", 0x14)
Close()

# Merge font
Open("Temporary-A.ttf")
MergeFonts("Temporary-B.otf")
SetFontNames("Monaco_for_Powerline", "Monaco for Powerline", "Monaco", "Regolare", "")
Generate("Monaco for Powerline.otf", "", 0x14)
Close()

下載所需字體

1
2
$ wget http://www.gringod.com/wp-upload/software/Fonts/Monaco_Linux.ttf
$ wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf

進行合成

1
$ fontforge -script font-merge.pe

說明

Monaco_Linux.ttf 爲 A 字體
PowerlineSymbols.otf 爲 B 字體
Monaco for Powerline.otf 爲合成字體

1
SetFontNames("Monaco_for_Powerline", "Monaco for Powerline", "Monaco", "Regolare", "")

Monaco_for_Powerline 爲 PostScript 名稱
Monaco for Powerline 爲全名
Monaco 爲家族名
Regolare 爲樣式