text

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2023 License: GPL-3.0 Imports: 5 Imported by: 82

Documentation

Overview

Package text 文字转图片

Index

Constants

View Source
const (
	// FontPath 通用字体路径
	FontPath = "data/Font/"
	// FontFile 苹方字体
	FontFile = FontPath + "regular.ttf"
	// BoldFontFile 粗体苹方字体
	BoldFontFile = FontPath + "regular-bold.ttf"
	// SakuraFontFile 樱酥体
	SakuraFontFile = FontPath + "sakura.ttf"
	// ConsolasFontFile ...
	ConsolasFontFile = FontPath + "consolas.ttf"
	// SyumatuFontFile 少女终末旅行字体
	SyumatuFontFile = FontPath + "zhongmoti.ttf"
	// NisiFontFile 少女终末旅行字体变体
	NisiFontFile = FontPath + "Nisi-Regular.ttf"
	// VioletEvergardenFontFile 紫罗兰永恒花园字体 https://github.com/kagurazakayashi/EvergardenConverter
	VioletEvergardenFontFile = FontPath + "VioletEvergardenFont.ttf"
	// GlowSansFontFile 未来荧黑 https://github.com/welai/glow-sans
	GlowSansFontFile = FontPath + "GlowSansSC-Normal-ExtraBold.ttf"
	// ImpactFontFile ...
	ImpactFontFile = FontPath + "Impact.ttf"
	// HachiMaruPopRegularFontFile ...
	HachiMaruPopRegularFontFile = FontPath + "HachiMaruPop-Regular.ttf"
	// GugiRegularFontFile ...
	GugiRegularFontFile = FontPath + "Gugi-Regular.ttf"
	// MaokenFontFile 猫啃珠圆体
	MaokenFontFile = FontPath + "MaokenZhuyuanTi.ttf"
	// BaotuXiaobaiFontFile 包图小白体
	BaotuXiaobaiFontFile = FontPath + "BaotuXiaobaiTi.ttf"
	// QiantuXiaotuFontFile 千图小兔体
	QiantuXiaotuFontFile = FontPath + "QiantuXiaotuTi.ttf"
	// GNUUnifontFontFile GNU Unifont https://unifoundry.com/unifont/index.html
	GNUUnifontFontFile = FontPath + "unifont-15.0.06.ttf"
	// AiralFontFile ...
	AiralFontFile = FontPath + "arial.ttf"
)

Variables

This section is empty.

Functions

func Render

func Render(text, font string, width, fontSize int) (txtPic image.Image, err error)

Render 文字转图片 width 是图片宽度

func RenderToBase64

func RenderToBase64(text, font string, width, fontSize int) (base64Bytes []byte, err error)

RenderToBase64 文字转base64

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL