Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danielgatis/go-findfont
Find system fonts through the fontconfig library (a.k.a `fc-match`).
https://github.com/danielgatis/go-findfont
font fontconfig fontconfig-library fonts go golang
Last synced: about 1 month ago
JSON representation
Find system fonts through the fontconfig library (a.k.a `fc-match`).
- Host: GitHub
- URL: https://github.com/danielgatis/go-findfont
- Owner: danielgatis
- License: mit
- Created: 2020-05-28T13:17:46.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-26T04:33:57.000Z (about 4 years ago)
- Last Synced: 2024-08-03T23:15:49.247Z (4 months ago)
- Topics: font, fontconfig, fontconfig-library, fonts, go, golang
- Language: Go
- Homepage:
- Size: 6.84 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-golang-repositories - go-findfont - match`). (Repositories)
README
# go-findfont
[![Go Report Card](https://goreportcard.com/badge/github.com/danielgatis/go-findfont?style=flat-square)](https://goreportcard.com/report/github.com/danielgatis/go-findfont)
[![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/danielgatis/go-findfont/master/LICENSE)
[![Go Doc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/danielgatis/go-findfont)Find system fonts through the fontconfig library (a.k.a `fc-match`)
## Install
```bash
go get -u github.com/danielgatis/go-findfont
```And then import the package in your code:
```go
import "github.com/danielgatis/go-findfont/findfont"
```### Example
An example described below is one of the use cases.
```go
package mainimport (
"fmt"
"os""github.com/danielgatis/go-findfont/findfont"
)func main() {
fonts, err := findfont.Find("Emoji", findfont.FontRegular)if err != nil {
fmt.Printf("Err: %v", err)
os.Exit(1)
}for _, f := range fonts {
fmt.Printf("Family: %v\nStyle : %v\nPath : %v\n\n", f[0], f[1], f[2])
}
}
``````
❯ go run main.go
Family: Apple Color Emoji
Style : Regular,標準體,Ordinær,Normal,Normaali,Regolare,レギュラー,일반체,Regulier,Обычный,常规体,عادي
Path : /System/Library/Fonts/Apple Color Emoji.ttcFamily: Twitter Color Emoji
Style : Regular
Path : /Users/daniel/Library/Fonts/TwitterColorEmoji-SVGinOT.ttfFamily: .LastResort
Style : Regular
Path : /System/Library/Fonts/LastResort.otf
```## License
Copyright (c) 2020-present [Daniel Gatis](https://github.com/danielgatis)
Licensed under [MIT License](./LICENSE)