text

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

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"
)

Variables

This section is empty.

Functions

func RenderToBase64

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

RenderToBase64 文字转base64

Types

type Text

type Text struct {
	// contains filtered or unexported fields
}

Text gg canvas

func Render

func Render(text, font string, width, fontSize int) (txtc Text, err error)

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

func (Text) Image

func (txtc Text) Image() image.Image

Image ...

Jump to

Keyboard shortcuts

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