Documentation ¶
Index ¶
- Variables
- func Round(value float64) int
- type CmapFormat12GroupingTable
- type FontMaker
- func (f *FontMaker) FileSize(path string) (int64, error)
- func (f *FontMaker) GetInfoFromTrueType(fontpath string, fontmaps []FontMap) (TtfInfo, error)
- func (f *FontMaker) GetResults() []string
- func (f *FontMaker) GoStructName(name string) string
- func (f *FontMaker) LoadMap(encodingpath string) ([]FontMap, error)
- func (f *FontMaker) MakeDefinitionFile(gofontname string, mappath string, exportfile string, encode string, ...) (string, error)
- func (f *FontMaker) MakeFont(fontpath string, mappath string, encode string, outfolderpath string) error
- func (f *FontMaker) MakeFontDescriptor(info TtfInfo) (string, error)
- func (f *FontMaker) MakeFontEncoding(mappath string, fontmaps []FontMap) (string, error)
- func (f *FontMaker) MakeWidthArray(widths map[int]int) (string, error)
- func (f *FontMaker) MultiplyAndRound(k float64, v int) int
- func (f *FontMaker) MultiplyAndRoundWithUInt64(k float64, v uint) int
- func (f *FontMaker) Round(value float64) int
- type FontMap
- type KernMap
- type KernTable
- type KernValue
- type TTFParser
- func (t *TTFParser) ArrayPadUint(arr []uint, size uint, val uint) ([]uint, error)
- func (t *TTFParser) Ascender() int
- func (t *TTFParser) BytesToString(b []byte) string
- func (t *TTFParser) CapHeight() int
- func (t *TTFParser) Chars() map[int]uint
- func (t *TTFParser) Descender() int
- func (t *TTFParser) FTell(fd *bytes.Reader) (uint, error)
- func (t *TTFParser) Flag() int
- func (t *TTFParser) FontData() []byte
- func (t *TTFParser) GetTables() map[string]TableDirectoryEntry
- func (t *TTFParser) GroupingTables() []CmapFormat12GroupingTable
- func (t *TTFParser) ItalicAngle() int
- func (t *TTFParser) Kern() *KernTable
- func (t *TTFParser) NumGlyphs() uint
- func (t *TTFParser) NumberOfHMetrics() uint
- func (t *TTFParser) Parse(filepath string) error
- func (t *TTFParser) ParseByReader(rd io.Reader) error
- func (t *TTFParser) ParseCmap(fd *bytes.Reader) error
- func (t *TTFParser) ParseCmapFormat12(fd *bytes.Reader) (bool, error)
- func (t *TTFParser) ParseFontData(fontData []byte) error
- func (t *TTFParser) ParseHead(fd *bytes.Reader) error
- func (t *TTFParser) ParseHhea(fd *bytes.Reader) error
- func (t *TTFParser) ParseHmtx(fd *bytes.Reader) error
- func (t *TTFParser) ParseLoca(fd *bytes.Reader) error
- func (t *TTFParser) ParseMaxp(fd *bytes.Reader) error
- func (t *TTFParser) ParseName(fd *bytes.Reader) error
- func (t *TTFParser) ParseOS2(fd *bytes.Reader) error
- func (t *TTFParser) ParsePost(fd *bytes.Reader) error
- func (t *TTFParser) Parsekern(fd *bytes.Reader) error
- func (t *TTFParser) PregReplace(pattern string, replacement string, subject string) (string, error)
- func (t *TTFParser) Read(fd *bytes.Reader, length int) ([]byte, error)
- func (t *TTFParser) ReadShort(fd *bytes.Reader) (int, error)
- func (t *TTFParser) ReadShortInt16(fd *bytes.Reader) (int16, error)
- func (t *TTFParser) ReadULong(fd *bytes.Reader) (uint, error)
- func (t *TTFParser) ReadUShort(fd *bytes.Reader) (uint, error)
- func (t *TTFParser) Seek(fd *bytes.Reader, tag string) error
- func (t *TTFParser) SetUseKerning(use bool)
- func (t *TTFParser) Skip(fd *bytes.Reader, length int) error
- func (t *TTFParser) TypoAscender() int
- func (t *TTFParser) TypoDescender() int
- func (t *TTFParser) UnderlinePosition() int
- func (t *TTFParser) UnderlineThickness() int
- func (t *TTFParser) UnitsPerEm() uint
- func (t *TTFParser) Widths() []uint
- func (t *TTFParser) XHeight() int
- func (t *TTFParser) XMax() int
- func (t *TTFParser) XMin() int
- func (t *TTFParser) YMax() int
- func (t *TTFParser) YMin() int
- type TableDirectoryEntry
- type TtfInfo
- func (t TtfInfo) GetBool(key string) (bool, error)
- func (t TtfInfo) GetInt64(key string) (int, error)
- func (t TtfInfo) GetInt64s(key string) ([]int, error)
- func (t TtfInfo) GetMapIntInt64(key string) (map[int]int, error)
- func (t TtfInfo) GetString(key string) (string, error)
- func (t TtfInfo) PushBool(key string, val bool)
- func (t TtfInfo) PushBytes(key string, val []byte)
- func (t TtfInfo) PushInt(key string, val int)
- func (t TtfInfo) PushInt64(key string, val int64)
- func (t TtfInfo) PushInt64s(key string, val []int)
- func (t TtfInfo) PushMapIntInt64(key string, val map[int]int)
- func (t TtfInfo) PushString(key string, val string)
- func (t TtfInfo) PushUInt64(key string, val uint)
Constants ¶
This section is empty.
Variables ¶
var ERROR_INCORRECT_MAGIC_NUMBER = errors.New("Incorrect magic number")
var ERROR_NO_GET_WRONG_TYPE = errors.New("get wrong type")
var ERROR_NO_KEY_FOUND = errors.New("no key found")
var ERROR_NO_UNICODE_ENCODING_FOUND = errors.New("No Unicode encoding found")
var ERROR_POSTSCRIPT_NAME_NOT_FOUND = errors.New("PostScript name not found")
var ERROR_UNEXPECTED_SUBTABLE_FORMAT = errors.New("Unexpected subtable format")
var ErrFontLicenseDoesNotAllowEmbedding = errors.New("Font license does not allow embedding")
ErrFontLicenseDoesNotAllowEmbedding Font license does not allow embedding
var ErrTableNotFound = errors.New("table not found")
ErrTableNotFound error table not found
var Nonsymbolic = (1 << 5)
var Symbolic = 1 << 2
Functions ¶
Types ¶
type CmapFormat12GroupingTable ¶
type CmapFormat12GroupingTable struct {
StartCharCode, EndCharCode, GlyphID uint
}
type FontMaker ¶
type FontMaker struct {
// contains filtered or unexported fields
}
FontMaker font maker
func (*FontMaker) GetInfoFromTrueType ¶
func (*FontMaker) GoStructName ¶
func (*FontMaker) MakeDefinitionFile ¶
func (*FontMaker) MakeFontDescriptor ¶
func (*FontMaker) MakeFontEncoding ¶
func (*FontMaker) MakeWidthArray ¶
func (*FontMaker) MultiplyAndRoundWithUInt64 ¶
type KernTable ¶
KernTable https://www.microsoft.com/typography/otspec/kern.htm
type TTFParser ¶
type TTFParser struct { Embeddable bool Bold bool //cmap IsShortIndex bool LocaTable []uint SegCount uint StartCount []uint EndCount []uint IdRangeOffset []uint IdDelta []uint GlyphIdArray []uint // contains filtered or unexported fields }
TTFParser true type font parser
func (*TTFParser) ArrayPadUint ¶
func (*TTFParser) BytesToString ¶
BytesToString convert bytes to string
func (*TTFParser) CapHeight ¶
CapHeight https://en.wikipedia.org/wiki/Cap_height
func (*TTFParser) GetTables ¶
func (t *TTFParser) GetTables() map[string]TableDirectoryEntry
func (*TTFParser) GroupingTables ¶
func (t *TTFParser) GroupingTables() []CmapFormat12GroupingTable
GroupingTables get cmap format12 grouping table
func (*TTFParser) ItalicAngle ¶
func (*TTFParser) NumberOfHMetrics ¶
func (*TTFParser) ParseByReader ¶
ParseByReader parse by io.reader
func (*TTFParser) ParseCmap ¶
ParseCmap parse cmap table format 4 https://www.microsoft.com/typography/otspec/cmap.htm
func (*TTFParser) ParseCmapFormat12 ¶
ParseCmapFormat12 parse cmap table format 12 https://www.microsoft.com/typography/otspec/cmap.htm
func (*TTFParser) ParseFontData ¶ added in v0.18.1
ParseFontData parses font data.
func (*TTFParser) ParseHead ¶
ParseHead parse head table https://www.microsoft.com/typography/otspec/Head.htm
func (*TTFParser) ParseHhea ¶
ParseHhea parse hhea table https://www.microsoft.com/typography/otspec/hhea.htm
func (*TTFParser) ParseHmtx ¶
ParseHmtx parse hmtx table https://www.microsoft.com/typography/otspec/hmtx.htm
func (*TTFParser) ParseLoca ¶
ParseLoca parse loca table https://www.microsoft.com/typography/otspec/loca.htm
func (*TTFParser) ParseMaxp ¶
ParseMaxp parse maxp table https://www.microsoft.com/typography/otspec/Maxp.htm
func (*TTFParser) ParseName ¶
ParseName parse name table https://www.microsoft.com/typography/otspec/name.htm
func (*TTFParser) ParseOS2 ¶
ParseOS2 parse OS2 table https://www.microsoft.com/typography/otspec/OS2.htm
func (*TTFParser) ParsePost ¶
ParsePost parse post table https://www.microsoft.com/typography/otspec/post.htm
func (*TTFParser) Parsekern ¶
Parsekern parse kerning table https://www.microsoft.com/typography/otspec/kern.htm
func (*TTFParser) PregReplace ¶
func (*TTFParser) ReadShortInt16 ¶
ReadShortInt16 read short return int16
func (*TTFParser) ReadUShort ¶
ReadUShort read ushort
func (*TTFParser) SetUseKerning ¶
SetUseKerning set useKerning must set before Parse
func (*TTFParser) TypoAscender ¶
func (*TTFParser) TypoDescender ¶
func (*TTFParser) UnderlinePosition ¶
UnderlinePosition postion of underline
func (*TTFParser) UnderlineThickness ¶
UnderlineThickness thickness of underline
func (*TTFParser) UnitsPerEm ¶
type TableDirectoryEntry ¶
func (TableDirectoryEntry) PaddedLength ¶
func (t TableDirectoryEntry) PaddedLength() int
type TtfInfo ¶
type TtfInfo map[string]interface{}
func NewTtfInfo ¶
func NewTtfInfo() TtfInfo