shithub: mycel

ref: 3d58c884fa97567ebb1b8b47bc8ceb8c75b2f680
dir: /style/fonts_unix.go/

View raw version
// +build darwin freebsd netbsd openbsd linux

package style

import (
	"fmt"
	"math"
	"os/exec"
	"strings"
)

func initFontserver() {
	buf, err := exec.Command("fontsrv", "-p", ".").Output()
	if err == nil {
		availableFontNames = strings.Split(string(buf), "\n")
	} else {
		log.Printf("exec fontsrv: %v", err)
	}
}

func (cs Map) FontFilename() string {
	pref := cs.preferedFontName([]string{"HelveticaNeue", "Helvetica"})
	fontSize := 2 * /*dui.Scale(*/int(math.RoundToEven(cs.FontSize()))/*)*/

	return fmt.Sprintf("/mnt/font/"+pref+"%va/font", fontSize)
}