本文整理汇总了Golang中github.com/shibukawa/nanovgo.Context.CreateFontFromMemory方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.CreateFontFromMemory方法的具体用法?Golang Context.CreateFontFromMemory怎么用?Golang Context.CreateFontFromMemory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/shibukawa/nanovgo.Context
的用法示例。
在下文中一共展示了Context.CreateFontFromMemory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewStandardTheme
func NewStandardTheme(ctx *nanovgo.Context) *Theme {
ctx.CreateFontFromMemory("sans", MustAsset("fonts/Roboto-Regular.ttf"), 0)
ctx.CreateFontFromMemory("sans-bold", MustAsset("fonts/Roboto-Bold.ttf"), 0)
ctx.CreateFontFromMemory("icons", MustAsset("fonts/entypo.ttf"), 0)
return &Theme{
StandardFontSize: 16,
ButtonFontSize: 20,
TextBoxFontSize: 20,
WindowCornerRadius: 2,
WindowHeaderHeight: 30,
WindowDropShadowSize: 10,
ButtonCornerRadius: 2,
DropShadow: nanovgo.MONO(0, 128),
Transparent: nanovgo.MONO(0, 0),
BorderDark: nanovgo.MONO(29, 255),
BorderLight: nanovgo.MONO(92, 255),
BorderMedium: nanovgo.MONO(35, 255),
TextColor: nanovgo.MONO(255, 160),
DisabledTextColor: nanovgo.MONO(255, 80),
TextColorShadow: nanovgo.MONO(0, 160),
IconColor: nanovgo.MONO(255, 160),
ButtonGradientTopFocused: nanovgo.MONO(64, 255),
ButtonGradientBotFocused: nanovgo.MONO(48, 255),
ButtonGradientTopUnfocused: nanovgo.MONO(74, 255),
ButtonGradientBotUnfocused: nanovgo.MONO(58, 255),
ButtonGradientTopPushed: nanovgo.MONO(41, 255),
ButtonGradientBotPushed: nanovgo.MONO(29, 255),
WindowFillUnfocused: nanovgo.MONO(43, 230),
WindowFillFocused: nanovgo.MONO(45, 230),
WindowTitleUnfocused: nanovgo.MONO(220, 160),
WindowTitleFocused: nanovgo.MONO(255, 190),
WindowHeaderGradientTop: nanovgo.MONO(74, 255),
WindowHeaderGradientBot: nanovgo.MONO(58, 255),
WindowHeaderSepTop: nanovgo.MONO(92, 255),
WindowHeaderSepBot: nanovgo.MONO(29, 255),
WindowPopup: nanovgo.MONO(50, 255),
WindowPopupTransparent: nanovgo.MONO(50, 0),
FontNormal: "sans",
FontBold: "sans-bold",
FontIcons: "icons",
}
}
示例2: LoadDemo
func LoadDemo(ctx *nanovgo.Context) *demo.DemoData {
d := &demo.DemoData{}
for i := 0; i < 12; i++ {
path := fmt.Sprintf("assets/image%d.jpg", i+1)
d.Images = append(d.Images, ctx.CreateImageFromMemory(0, demo.MustAsset(path)))
if d.Images[i] == 0 {
log.Fatalf("Could not load %s", path)
}
}
d.FontIcons = ctx.CreateFontFromMemory("icons", demo.MustAsset("assets/entypo.ttf"), 0)
if d.FontIcons == -1 {
log.Fatalln("Could not add font icons.")
}
d.FontNormal = ctx.CreateFontFromMemory("sans", demo.MustAsset("assets/Roboto-Regular.ttf"), 0)
if d.FontNormal == -1 {
log.Fatalln("Could not add font italic.")
}
d.FontBold = ctx.CreateFontFromMemory("sans-bold", demo.MustAsset("assets/Roboto-Bold.ttf"), 0)
if d.FontBold == -1 {
log.Fatalln("Could not add font bold.")
}
return d
}
示例3: LoadFont
func LoadFont(ctx *nanovgo.Context) {
ctx.CreateFontFromMemory("materialicons", MustAsset("font/MaterialIcons-Regular.ttf"), 0)
}
示例4: LoadFontAs
func LoadFontAs(ctx *nanovgo.Context, name string) {
ctx.CreateFontFromMemory(name, MustAsset("font/MaterialIcons-Regular.ttf"), 0)
}