2
0
mirror of synced 2025-02-24 07:18:15 +00:00
mobile/exp/font/font_linux.go
Péter Szilágyi f7e06c9519 exp/font: droid->noto fallback in tests
The Droid font has been superseeded by the Noto family upstream in
Android. This resulted in Debian and inherently Ubuntu too dropping
support for the first in favor of the latter. This CL ensures that
tests will pass on both older and newer debian based distros.

Refs:
 * https://github.com/googlei18n/noto-fonts/blob/master/FAQ.md#how-does-noto-relate-to-droid
 * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804683

Fixes golang/go#16990

Change-Id: Id0820d6c3bfde7822984fac58054f7dcc4625685
Reviewed-on: https://go-review.googlesource.com/28495
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2016-09-06 08:36:09 +00:00

32 lines
943 B
Go

// 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.
// +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
}