go-fonts/liberation
GitHub: go-fonts/liberation
将 Liberation 系列字体封装为可直接导入的 Go 包,让 Go 应用无需外部字体文件即可使用这些度量兼容经典字体。
Stars: 6 | Forks: 0
# liberation
[](https://github.com/go-fonts/liberation/releases)
[](https://godoc.org/github.com/go-fonts/liberation)
[](https://github.com/go-fonts/liberation/raw/master/LICENSE)
`liberation` 将 [liberation](https://github.com/liberationfonts/liberation-fonts/) 字体提供为可导入的 Go 包。
这些字体基于 [SIL Open Font](https://github.com/go-fonts/liberation/raw/master/LICENSE-SIL) 许可证发布。
这些 Go 包基于 [BSD-3](https://github.com/go-fonts/liberation/raw/master/LICENSE) 许可证。
## 示例
```
import (
"fmt"
"log"
"github.com/go-fonts/liberation/liberationserifregular"
"golang.org/x/image/font/sfnt"
)
func Example() {
ttf, err := sfnt.Parse(liberationserifregular.TTF)
if err != nil {
log.Fatalf("could not parse Liberation Serif font: %+v", err)
}
var buf sfnt.Buffer
v, err := ttf.Name(&buf, sfnt.NameIDVersion)
if err != nil {
log.Fatalf("could not retrieve font version: %+v", err)
}
fmt.Printf("version: %s\n", v)
fmt.Printf("num glyphs: %d\n", ttf.NumGlyphs())
// Output:
// version: Version 2.1.4
// num glyphs: 2601
}
```
标签:EVTX分析, Go, Liberation Fonts, Ruby工具, 图像处理, 字体库, 开源组件, 日志审计