Documentation
¶
Index ¶
- Variables
- func NewTtfInfo() ttfInfo
- type FontEngine
- func (f *FontEngine) GetInfoFromTrueType(fontpath string, fontmaps []fontMap) (ttfInfo, error)
- func (f *FontEngine) GetResults() []string
- func (f *FontEngine) GoStructName(name string) string
- func (f *FontEngine) LoadMap(encodingpath string) ([]fontMap, error)
- func (f *FontEngine) MakeDefinitionFile(gofontname string, mappath string, exportfile string, encode string, ...) (string, error)
- func (f *FontEngine) MakeFont(fontpath string, mappath string, encode string, outfolderpath string) error
- func (f *FontEngine) MakeFontDescriptor(info ttfInfo) (string, error)
- func (f *FontEngine) MakeFontEncoding(mappath string, fontmaps []fontMap) (string, error)
- func (f *FontEngine) MakeWidthArray(widths map[int]int) (string, error)
- func (f *FontEngine) MultiplyAndRound(k float64, v int) int
- func (f *FontEngine) MultiplyAndRoundWithUInt64(k float64, v uint) int
- func (f *FontEngine) Round(value float64) int
- type FontProvider
- 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
Constants ¶
This section is empty.
Variables ¶
var ErrTableNotFound = errs.New("table not found")
ErrTableNotFound error table not found
var Nonsymbolic = (1 << 5)
var Symbolic = 1 << 2
Functions ¶
func NewTtfInfo ¶
func NewTtfInfo() ttfInfo
Types ¶
type FontEngine ¶
type FontEngine struct {
// contains filtered or unexported fields
}
FontEngine font maker
func (*FontEngine) GetInfoFromTrueType ¶
func (f *FontEngine) GetInfoFromTrueType(fontpath string, fontmaps []fontMap) (ttfInfo, error)
func (*FontEngine) GoStructName ¶
func (f *FontEngine) GoStructName(name string) string
func (*FontEngine) LoadMap ¶
func (f *FontEngine) LoadMap(encodingpath string) ([]fontMap, error)
func (*FontEngine) MakeDefinitionFile ¶
func (*FontEngine) MakeFontDescriptor ¶
func (f *FontEngine) MakeFontDescriptor(info ttfInfo) (string, error)
func (*FontEngine) MakeFontEncoding ¶
func (f *FontEngine) MakeFontEncoding(mappath string, fontmaps []fontMap) (string, error)
func (*FontEngine) MakeWidthArray ¶
func (f *FontEngine) MakeWidthArray(widths map[int]int) (string, error)
func (*FontEngine) MultiplyAndRound ¶
func (f *FontEngine) MultiplyAndRound(k float64, v int) int
func (*FontEngine) MultiplyAndRoundWithUInt64 ¶
func (f *FontEngine) MultiplyAndRoundWithUInt64(k float64, v uint) int
func (*FontEngine) Round ¶
func (f *FontEngine) Round(value float64) int
type FontProvider ¶ added in v0.0.72
type FontProvider interface {
// Identificación de la fuente
Name() string // Nombre de la fuente
Family() string // Familia de la fuente
// Propiedades de estilo
Weight() string // Peso: regular, bold, etc.
Style() string // Estilo: normal, italic, etc.
// Propiedades para renderizado SVG
SVGFontID() string // ID para referenciar en SVG
// Opcionalmente, para sistemas que necesiten la ruta al archivo
Path() string // Ruta al archivo de la fuente
}
FontProvider es una interfaz que abstrae las propiedades necesarias de una fuente para que el renderizador pueda trabajar con ella independientemente de su implementación
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 ¶
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 config.Alignment of underline
func (*TTFParser) UnderlineThickness ¶
UnderlineThickness thickness of underline
func (*TTFParser) UnitsPerEm ¶
type TableDirectoryEntry ¶ added in v0.0.68
func (TableDirectoryEntry) PaddedLength ¶ added in v0.0.68
func (t TableDirectoryEntry) PaddedLength() int