本文整理匯總了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)
}