-
Notifications
You must be signed in to change notification settings - Fork 23
/
init.go
24 lines (20 loc) · 870 Bytes
/
init.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
package renderer
import (
"golang.org/x/image/font"
"golang.org/x/image/math/fixed"
)
// These variables represent a default monospaced font for renderers to use
// and caches of properties that are useful for a renderer. Renderers don't
// *have* to use them, but doing so avoids race conditions with freetype and
// makes it easier to use default implementations built around them, as well
// as ensures consistency between renderers of different languages.
var (
MonoFontFace, MonoFontFaceBold font.Face
MonoFontHeight, MonoFontAdvance, MonoFontGlyphWidth, MonoFontAscent fixed.Int26_6
)
func init() {
// initialize the font face to 96 DPI as a default. RecalculateFontFace should be called
// once we know the real screen DPI, but that's not known until a size.Event comes in
// from shiny.
RecalculateFontFace(96)
}