Skip to content

Find system fonts through the fontconfig library (a.k.a `fc-match`).

License

Notifications You must be signed in to change notification settings

danielgatis/go-findfont

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-findfont

Go Report Card License MIT Go Doc

Find system fonts through the fontconfig library (a.k.a fc-match)

Install

go get -u github.com/danielgatis/go-findfont

And then import the package in your code:

import "github.com/danielgatis/go-findfont/findfont"

Example

An example described below is one of the use cases.

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\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.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

License

Copyright (c) 2020-present Daniel Gatis

Licensed under MIT License

About

Find system fonts through the fontconfig library (a.k.a `fc-match`).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages