提交 e0097532 编写于 作者: N Nigel Tao

freetype/truetype: support symbol fonts such as Webdings.

LGTM=bsiegert
R=bsiegert
CC=golang-codereviews
https://codereview.appspot.com/60380043
上级 49fa4a4d
...@@ -119,10 +119,12 @@ func (f *Font) parseCmap() error { ...@@ -119,10 +119,12 @@ func (f *Font) parseCmap() error {
languageIndependent = 0 languageIndependent = 0
// A 32-bit encoding consists of a most-significant 16-bit Platform ID and a // A 32-bit encoding consists of a most-significant 16-bit Platform ID and a
// least-significant 16-bit Platform Specific ID. // least-significant 16-bit Platform Specific ID. The magic numbers are
unicodeEncoding = 0x00000003 // PID = 0 (Unicode), PSID = 3 (Unicode 2.0) // specified at https://www.microsoft.com/typography/otspec/name.htm
microsoftUCS2Encoding = 0x00030001 // PID = 3 (Microsoft), PSID = 1 (UCS-2) unicodeEncoding = 0x00000003 // PID = 0 (Unicode), PSID = 3 (Unicode 2.0)
microsoftUCS4Encoding = 0x0003000a // PID = 3 (Microsoft), PSID = 10 (UCS-4) microsoftSymbolEncoding = 0x00030000 // PID = 3 (Microsoft), PSID = 0 (Symbol)
microsoftUCS2Encoding = 0x00030001 // PID = 3 (Microsoft), PSID = 1 (UCS-2)
microsoftUCS4Encoding = 0x0003000a // PID = 3 (Microsoft), PSID = 10 (UCS-4)
) )
if len(f.cmap) < 4 { if len(f.cmap) < 4 {
...@@ -143,7 +145,11 @@ func (f *Font) parseCmap() error { ...@@ -143,7 +145,11 @@ func (f *Font) parseCmap() error {
if pidPsid == unicodeEncoding { if pidPsid == unicodeEncoding {
offset, found = int(o), true offset, found = int(o), true
break break
} else if pidPsid == microsoftUCS2Encoding || pidPsid == microsoftUCS4Encoding {
} else if pidPsid == microsoftSymbolEncoding ||
pidPsid == microsoftUCS2Encoding ||
pidPsid == microsoftUCS4Encoding {
offset, found = int(o), true offset, found = int(o), true
// We don't break out of the for loop, so that Unicode can override Microsoft. // We don't break out of the for loop, so that Unicode can override Microsoft.
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册