Documentation ¶
Index ¶
- Constants
- type IFont
- func (f *IFont) AdjustFontSizeToFitImage(imgWidth, imgHeight int, text string) (attr *ParseTextItem, err error)
- func (f *IFont) CenterWH(text string, face font.Face) (width, height int)
- func (f *IFont) DrawText(text string, colorHex string) (err error)
- func (f *IFont) ImageDrawText(text string, color color.Color, textX, textY int, textAttr *ParseTextItem)
- func (f *IFont) ImgWH() (width, height int)
- func (f *IFont) LoadFont(path string) (err error)
- func (f *IFont) MetricsTextWH(text string, face font.Face) (width, height int)
- func (f *IFont) Open(path string)
- func (f *IFont) ParseHexColor(colorHex string) (color.Color, error)
- func (f *IFont) Save(filename string) error
- func (f *IFont) SetBgkImage(img image.Image)
- func (f *IFont) SetFaceOptions(faceOptions *opentype.FaceOptions)
- func (f *IFont) SetFontItem(ft IFont)
- func (f *IFont) SetIsSep(isSep bool)
- func (f *IFont) SetOpenFont(openFont *opentype.Font)
- func (f *IFont) SetPoints(point image.Point)
- func (f *IFont) SetSep(sep string)
- func (f *IFont) TextXY(textW, textH int) (x, y int)
- type ParseTextItem
Constants ¶
View Source
const ( FaceDPIDefault = 72 // 默认分辨率 FontSizeDefault = 24 // 默认字体大小 FontSizeScaleRatio = 1.5 // 字体尺寸缩放比例 TextSepIvX = 6 // 分割文本X坐标偏移量 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IFont ¶
type IFont struct { BgkImage image.Image // 图片内容 OpenFont *opentype.Font // 解析字体内容 Point image.Point // 字体位置坐标 FaceOptions *opentype.FaceOptions // 字体属性 IsSep bool // 文本是否分割:false否,true分割 Sep string // 分割符 }
IFont 字体信息
func (*IFont) AdjustFontSizeToFitImage ¶
func (f *IFont) AdjustFontSizeToFitImage(imgWidth, imgHeight int, text string) (attr *ParseTextItem, err error)
AdjustFontSizeToFitImage 根据图片尺寸调整字体大小以适应文本
func (*IFont) ImageDrawText ¶
func (f *IFont) ImageDrawText(text string, color color.Color, textX, textY int, textAttr *ParseTextItem)
ImageDrawText 图片绘制文本
func (*IFont) MetricsTextWH ¶
MetricsTextWH 通过字体度面量获取字体高宽度
func (*IFont) ParseHexColor ¶
ParseHexColor 解析二进制颜色值
func (*IFont) SetFaceOptions ¶
func (f *IFont) SetFaceOptions(faceOptions *opentype.FaceOptions)
SetFaceOptions 设置字体字面属性
func (*IFont) SetOpenFont ¶
SetOpenFont 设置加载的字体内容
Click to show internal directories.
Click to hide internal directories.