font增加更多字体

This commit is contained in:
源文雨
2023-03-31 15:52:52 +08:00
parent 52ef28cd6a
commit 2964986ee5
4 changed files with 25 additions and 14 deletions

View File

@@ -25,7 +25,7 @@ func init() {
control.Register("font", &ctrl.Options[*zero.Ctx]{
DisableOnDefault: false,
Brief: "渲染任意文字到图片",
Help: "- (用[字体])渲染(抖动)文字xxx\n可选字体: [终末体|终末变体|紫罗兰体|樱酥体|Consolas体|苹方体]",
Help: "- (用[字体])渲染(抖动)文字xxx\n可选字体: [终末体|终末变体|紫罗兰体|樱酥体|Consolas体|粗苹方体|未来荧黑体|Gugi体|八丸体|Impact体|猫啃体|苹方体]",
}).OnRegex(`^(用.+)?渲染(抖动)?文字([\s\S]+)$`).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
fnt := ctx.State["regex_matched"].([]string)[1]
txt := ctx.State["regex_matched"].([]string)[3]
@@ -40,6 +40,18 @@ func init() {
fnt = text.SakuraFontFile
case "用Consolas体":
fnt = text.ConsolasFontFile
case "用粗苹方体":
fnt = text.BoldFontFile
case "用未来荧黑体":
fnt = text.GlowSansFontFile
case "用Gugi体":
fnt = text.GugiRegularFontFile
case "用八丸体":
fnt = text.HachiMaruPopRegularFontFile
case "用Impact体":
fnt = text.ImpactFontFile
case "用猫啃体":
fnt = text.MaokenFontFile
case "用苹方体":
fallthrough
default: