github.com/SahandAslani/gomobile@v0.0.0-20210909130135-2cb2d44c09b2/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  //go:build !android
     6  // +build !android
     7  
     8  package font
     9  
    10  import "io/ioutil"
    11  
    12  func buildDefault() ([]byte, error) {
    13  	// Try Noto first, but fall back to Droid as the latter was deprecated
    14  	noto, nerr := ioutil.ReadFile("/usr/share/fonts/truetype/noto/NotoSans-Regular.ttf")
    15  	if nerr != nil {
    16  		if droid, err := ioutil.ReadFile("/usr/share/fonts/truetype/droid/DroidSans.ttf"); err == nil {
    17  			return droid, nil
    18  		}
    19  	}
    20  	return noto, nerr
    21  }
    22  
    23  func buildMonospace() ([]byte, error) {
    24  	// Try Noto first, but fall back to Droid as the latter was deprecated
    25  	noto, nerr := ioutil.ReadFile("/usr/share/fonts/truetype/noto/NotoMono-Regular.ttf")
    26  	if nerr != nil {
    27  		if droid, err := ioutil.ReadFile("/usr/share/fonts/truetype/droid/DroidSansMono.ttf"); err == nil {
    28  			return droid, nil
    29  		}
    30  	}
    31  	return noto, nerr
    32  }