forked from golang/mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
font_linux.go
31 lines (26 loc) · 944 Bytes
/
font_linux.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !android
package font
import "io/ioutil"
func buildDefault() ([]byte, error) {
// Try Noto first, but fall back to Droid as the latter was deprecated
noto, nerr := ioutil.ReadFile("/usr/share/fonts/truetype/noto/NotoSans-Regular.ttf")
if nerr != nil {
if droid, err := ioutil.ReadFile("/usr/share/fonts/truetype/droid/DroidSans.ttf"); err == nil {
return droid, nil
}
}
return noto, nerr
}
func buildMonospace() ([]byte, error) {
// Try Noto first, but fall back to Droid as the latter was deprecated
noto, nerr := ioutil.ReadFile("/usr/share/fonts/truetype/noto/NotoMono-Regular.ttf")
if nerr != nil {
if droid, err := ioutil.ReadFile("/usr/share/fonts/truetype/droid/DroidSansMono.ttf"); err == nil {
return droid, nil
}
}
return noto, nerr
}