Documentation
¶
Index ¶
- Variables
- type CheckErrFn
- type ErrGetSFNTName
- type ErrMissCodepoints
- type ErrMissingFontFaceFound
- type ErrOpenFontFace
- type ErrSubsetDataGet
- type ErrSubsetFail
- type ErrSubsetInputCreate
- type ErrUnSupportEncode
- type ErrUnsupportedID
- type ErrUnsupportedPlatform
- type FontDataBase
- func (db *FontDataBase) BuildDB(fontsDirs []string, withSystemFontPath bool, fn CheckErrFn) error
- func (db *FontDataBase) CheckGlyph(fontData []byte, source *FontFaceLocation, fontSet ass.CodepointSet, ...) error
- func (fdb *FontDataBase) Close() error
- func (db *FontDataBase) CreatSubfont(subsetFontInfo *SubsetFontInfo, fontData []byte) ([]byte, error)
- func (db *FontDataBase) FindFont(fontDesc *ass.FontDesc, fontSet ass.CodepointSet) (*FontFaceLocation, int, *ErrMissingFontFaceFound)
- func (db *FontDataBase) LoadDB(dbPath string) error
- func (db *FontDataBase) SaveDB(dbPath string) error
- func (db *FontDataBase) Subset(ap *ass.ASSParser, opts ...SubsetOption) (map[string][]byte, error)
- type FontFaceInfo
- type FontFaceLocation
- type FontName
- type FreeTypeLibrary
- type InfoMsg
- type Signed
- type SubsetFontInfo
- type SubsetOption
- type WarningMsg
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoValidFontName = errors.New("no valid font names found") ErrNoValidFontFace = errors.New("no valid font face found") ErrNoContainFace = errors.New("font contains no valid faces") ErrEmptySubsetData = errors.New("no subset font data collected") ErrNoFontFileFound = errors.New("no font files found") )
Functions ¶
This section is empty.
Types ¶
type CheckErrFn ¶
type ErrGetSFNTName ¶
type ErrGetSFNTName struct {
// contains filtered or unexported fields
}
func NewErrGetSFNTName ¶
func NewErrGetSFNTName(faceIdx uint, nameIdx uint, c int) *ErrGetSFNTName
func (*ErrGetSFNTName) Error ¶
func (e *ErrGetSFNTName) Error() string
type ErrMissCodepoints ¶
type ErrMissCodepoints struct {
// contains filtered or unexported fields
}
func NewErrMissCodepoints ¶
func NewErrMissCodepoints(fontDesc *ass.FontDesc, source *FontFaceLocation, missingCodepoints []rune) *ErrMissCodepoints
func (*ErrMissCodepoints) Error ¶
func (e *ErrMissCodepoints) Error() string
type ErrMissingFontFaceFound ¶
func NewErrMissingFontFaceFound ¶
func NewErrMissingFontFaceFound(f ass.FontDesc) *ErrMissingFontFaceFound
func (*ErrMissingFontFaceFound) Error ¶
func (e *ErrMissingFontFaceFound) Error() string
type ErrOpenFontFace ¶
type ErrOpenFontFace struct {
// contains filtered or unexported fields
}
func NewErrOpenFontFace ¶
func NewErrOpenFontFace(p string, i uint, c int) *ErrOpenFontFace
func (*ErrOpenFontFace) Error ¶
func (e *ErrOpenFontFace) Error() string
type ErrSubsetDataGet ¶
type ErrSubsetDataGet struct {
// contains filtered or unexported fields
}
func NewErrSubsetDataGet ¶
func NewErrSubsetDataGet(s *FontFaceLocation, dataLength uint) *ErrSubsetDataGet
func (*ErrSubsetDataGet) Error ¶
func (e *ErrSubsetDataGet) Error() string
type ErrSubsetFail ¶
type ErrSubsetFail struct {
// contains filtered or unexported fields
}
func NewErrSubsetFail ¶
func NewErrSubsetFail(s *FontFaceLocation, codepointCount int) *ErrSubsetFail
func (*ErrSubsetFail) Error ¶
func (e *ErrSubsetFail) Error() string
type ErrSubsetInputCreate ¶
type ErrSubsetInputCreate struct {
// contains filtered or unexported fields
}
func NewErrSubsetInputCreate ¶
func NewErrSubsetInputCreate(s *FontFaceLocation) *ErrSubsetInputCreate
func (*ErrSubsetInputCreate) Error ¶
func (e *ErrSubsetInputCreate) Error() string
type ErrUnSupportEncode ¶
type ErrUnSupportEncode string
func NewErrUnSupportEncode ¶
func NewErrUnSupportEncode(s string) *ErrUnSupportEncode
func (ErrUnSupportEncode) Error ¶
func (e ErrUnSupportEncode) Error() string
type ErrUnsupportedID ¶
type ErrUnsupportedID struct {
// contains filtered or unexported fields
}
func (*ErrUnsupportedID) Error ¶
func (e *ErrUnsupportedID) Error() string
type ErrUnsupportedPlatform ¶
type ErrUnsupportedPlatform struct {
// contains filtered or unexported fields
}
func (*ErrUnsupportedPlatform) Error ¶
func (e *ErrUnsupportedPlatform) Error() string
type FontDataBase ¶
type FontDataBase struct {
BigMemoryMode bool
// contains filtered or unexported fields
}
func NewFontDataBase ¶
func NewFontDataBase(lib *FreeTypeLibrary) (*FontDataBase, error)
创建一个新的 FontDataBase 对象 如果传入 FreeTypeLibrary 为 nil,则会创建一个内部的 FreeTypeLibrary 实例 如果传入的 FreeTypeLibrary 不为 nil,则使用该实例 注意:如果传入的 FreeTypeLibrary 是内部创建的,需要调用 Close() 方法
func (*FontDataBase) BuildDB ¶
func (db *FontDataBase) BuildDB(fontsDirs []string, withSystemFontPath bool, fn CheckErrFn) error
func (*FontDataBase) CheckGlyph ¶
func (db *FontDataBase) CheckGlyph(fontData []byte, source *FontFaceLocation, fontSet ass.CodepointSet, fontDesc *ass.FontDesc) error
func (*FontDataBase) Close ¶
func (fdb *FontDataBase) Close() error
关闭 FontDataBase 如果 FontDataBase 是内部创建的 FreeTypeLibrary 实例,则会关闭该实例 如果传入的 FreeTypeLibrary 是外部创建的,则不会关闭该实例
func (*FontDataBase) CreatSubfont ¶
func (db *FontDataBase) CreatSubfont(subsetFontInfo *SubsetFontInfo, fontData []byte) ([]byte, error)
func (*FontDataBase) FindFont ¶
func (db *FontDataBase) FindFont(fontDesc *ass.FontDesc, fontSet ass.CodepointSet) (*FontFaceLocation, int, *ErrMissingFontFaceFound)
func (*FontDataBase) SaveDB ¶
func (db *FontDataBase) SaveDB(dbPath string) error
func (*FontDataBase) Subset ¶
func (db *FontDataBase) Subset(ap *ass.ASSParser, opts ...SubsetOption) (map[string][]byte, error)
读取 ass.ASSParser 中的所有字形,在 FontDataBase 中查找对应字体的路径,通过 CreatSubfont 子集化后返回子集化后的字体文件
type FontFaceInfo ¶
type FontFaceLocation ¶
type FreeTypeLibrary ¶
type FreeTypeLibrary struct {
// contains filtered or unexported fields
}
func (*FreeTypeLibrary) ParseFont ¶
func (lib *FreeTypeLibrary) ParseFont(fontPath string, fn func(error) bool) ([]FontFaceInfo, error)
解析字体文件
type SubsetFontInfo ¶
type SubsetFontInfo struct {
FontsDesc ass.FontDesc // 字体描述列表
Codepoints ass.CodepointSet // 码点集合
Source FontFaceLocation // 字体路径及索引
}
type SubsetOption ¶
type SubsetOption func(*subsetConfig)
func WithCheckErr ¶
func WithCheckErr(fn CheckErrFn) SubsetOption
func WithCheckGlyph ¶
func WithCheckGlyph() SubsetOption
func WithConcurrent ¶
func WithConcurrent() SubsetOption
type WarningMsg ¶
type WarningMsg string
func NewWarningMsg ¶
func NewWarningMsg(format string, a ...any) *WarningMsg
func (WarningMsg) Error ¶
func (w WarningMsg) Error() string
Click to show internal directories.
Click to hide internal directories.