本文整理汇总了Golang中github.com/BurntSushi/xgbutil/xgraphics.MustFont函数的典型用法代码示例。如果您正苦于以下问题:Golang MustFont函数的具体用法?Golang MustFont怎么用?Golang MustFont使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MustFont函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: DefaultFullTheme
func DefaultFullTheme(X *xgbutil.XUtil) *FullTheme {
return &FullTheme{
Font: xgraphics.MustFont(xgraphics.ParseFont(
bytes.NewBuffer(misc.DejavusansTtf))),
FontSize: 15,
AFontColor: render.NewColor(0xffffff),
IFontColor: render.NewColor(0x000000),
TitleSize: 25,
ATitleColor: render.NewColor(0x3366ff),
ITitleColor: render.NewColor(0xdfdcdf),
ACloseButton: builtInButton(X, misc.ClosePng),
ICloseButton: builtInButton(X, misc.ClosePng),
AMaximizeButton: builtInButton(X, misc.MaximizePng),
IMaximizeButton: builtInButton(X, misc.MaximizePng),
AMinimizeButton: builtInButton(X, misc.MinimizePng),
IMinimizeButton: builtInButton(X, misc.MinimizePng),
BorderSize: 10,
ABorderColor: render.NewColor(0x3366ff),
IBorderColor: render.NewColor(0xdfdcdf),
}
}
示例2:
ActiveFontColor render.Color
GroupBgColor render.Color
GroupFont *truetype.Font
GroupFontSize float64
GroupFontColor render.Color
GroupSpacing int
}
var DefaultSelectTheme = &SelectTheme{
BorderSize: 10,
BgColor: render.NewImageColor(color.RGBA{0xff, 0xff, 0xff, 0xff}),
BorderColor: render.NewImageColor(color.RGBA{0x0, 0x0, 0x0, 0xff}),
Padding: 20,
Font: xgraphics.MustFont(xgraphics.ParseFont(
bytes.NewBuffer(bindata.DejavusansTtf()))),
FontSize: 20.0,
FontColor: render.NewImageColor(color.RGBA{0x0, 0x0, 0x0, 0xff}),
ActiveBgColor: render.NewImageColor(color.RGBA{0x0, 0x0, 0x0, 0xff}),
ActiveFontColor: render.NewImageColor(color.RGBA{0xff, 0xff, 0xff, 0xff}),
GroupBgColor: render.NewImageColor(color.RGBA{0xff, 0xff, 0xff, 0xff}),
GroupFont: xgraphics.MustFont(xgraphics.ParseFont(
bytes.NewBuffer(bindata.DejavusansTtf()))),
GroupFontSize: 25.0,
GroupFontColor: render.NewImageColor(color.RGBA{0x33, 0x66, 0xff, 0xff}),
GroupSpacing: 15,
}
type SelectConfig struct {
示例3:
ActiveFontColor render.Color
GroupBgColor render.Color
GroupFont *truetype.Font
GroupFontSize float64
GroupFontColor render.Color
GroupSpacing int
}
var DefaultSelectTheme = &SelectTheme{
BorderSize: 10,
BgColor: render.NewImageColor(color.RGBA{0xff, 0xff, 0xff, 0xff}),
BorderColor: render.NewImageColor(color.RGBA{0x0, 0x0, 0x0, 0xff}),
Padding: 20,
Font: xgraphics.MustFont(xgraphics.ParseFont(
bytes.NewBuffer(misc.DataFile("DejaVuSans.ttf")))),
FontSize: 20.0,
FontColor: render.NewImageColor(color.RGBA{0x0, 0x0, 0x0, 0xff}),
ActiveBgColor: render.NewImageColor(color.RGBA{0x0, 0x0, 0x0, 0xff}),
ActiveFontColor: render.NewImageColor(color.RGBA{0xff, 0xff, 0xff, 0xff}),
GroupBgColor: render.NewImageColor(color.RGBA{0xff, 0xff, 0xff, 0xff}),
GroupFont: xgraphics.MustFont(xgraphics.ParseFont(
bytes.NewBuffer(misc.DataFile("DejaVuSans.ttf")))),
GroupFontSize: 25.0,
GroupFontColor: render.NewImageColor(color.RGBA{0x33, 0x66, 0xff, 0xff}),
GroupSpacing: 15,
}
type SelectConfig struct {
示例4: fatal
"github.com/BurntSushi/xgb/xproto"
"github.com/BurntSushi/xgbutil"
"github.com/BurntSushi/xgbutil/keybind"
"github.com/BurntSushi/xgbutil/xevent"
"github.com/BurntSushi/xgbutil/xgraphics"
"github.com/BurntSushi/xgbutil/xwindow"
"github.com/BurntSushi/wingo/bindata"
"github.com/BurntSushi/wingo/render"
"github.com/BurntSushi/wingo/text"
)
var (
// A near guaranteed font. If parsing fails, MustFont wll panic.
font = xgraphics.MustFont(xgraphics.ParseFont(
bytes.NewBuffer(bindata.FreemonoTtf())))
fontSize = 30.0
fontColor = render.NewImageColor(color.RGBA{0x0, 0x0, 0x0, 0xff})
bgColor = render.NewImageColor(color.RGBA{0xff, 0xff, 0xff, 0xff})
width = 800
padding = 10
)
func fatal(err error) {
if err != nil {
log.Fatal(err)
}
}
func main() {
X, err := xgbutil.NewConn()