go findfont
1.0.0
FontConfig 라이브러리를 통해 시스템 글꼴을 찾으십시오 (일명 fc-match )
go get -u github.com/danielgatis/go-findfont그런 다음 코드에서 패키지를 가져옵니다.
import "github.com/danielgatis/go-findfont/findfont"아래에 설명 된 예는 사용 사례 중 하나입니다.
package main
import (
"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 n Style : %v n Path : %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.ttc
Family: Twitter Color Emoji
Style : Regular
Path : /Users/daniel/Library/Fonts/TwitterColorEmoji-SVGinOT.ttf
Family: .LastResort
Style : Regular
Path : /System/Library/Fonts/LastResort.otf
저작권 (c) 2020- 표준 Daniel Gatis
MIT 라이센스에 따라 라이센스