github.com/SkycoinProject/gomobile@v0.0.0-20190312151609-d3739f865fa6/exp/font/font_linux.go (about)

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