freetype/truetype/runes.go
Steven Edwards 5e7426d6f5 Add parseName, Name, and Style funcs.
Also includes decodeUTF16 func, which is used by parseName.
2015-09-04 15:44:53 -04:00

16 lines
329 B
Go

package truetype
import (
"bytes"
"io/ioutil"
"golang.org/x/text/encoding/unicode"
"golang.org/x/text/transform"
)
func decodeUTF16(b []byte) ([]byte, error) {
r := bytes.NewReader(b)
enc := unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM)
r2 := transform.NewReader(r, enc.NewDecoder())
return ioutil.ReadAll(r2)
}