Documentation ¶
Overview ¶
Package fontforge provides go bindings for Python fontforge module.
Index ¶
- Constants
- Variables
- func AddContextualLookupSubtable(font *Font, lookupName string, lookupSubtableName string, ...)
- func AddLookup(font *Font, lookupName string, lookupType LookupType, lookupFlags LookupFlags, ...)
- func AddLookupSubtable(font *Font, lookupName string, lookupSubtableName string)
- func AddPositionSubstitutionVariant(glyph *Glyph, subtableName string, variant string)
- func CopyGlyph(font *Font, glyph string) error
- func Generate(font *Font, path string) error
- func PasteGlyph(font *Font, glyph string) error
- type Font
- func (f *Font) AsObject() *python3.Object
- func (f *Font) Close() error
- func (f *Font) Copyright() string
- func (f *Font) CreateGlyph(glyph string) error
- func (f *Font) DecRef()
- func (f *Font) Em() int
- func (f *Font) FamilyName() string
- func (f *Font) FontName() string
- func (f *Font) FullName() string
- func (f *Font) Glyph(glyph any) *Glyph
- func (f *Font) HasGlyph(glyph any) bool
- func (f *Font) Path() string
- func (f *Font) SFNTNames() SFNTNames
- func (f *Font) SetCopyright(copyright string)
- func (f *Font) SetEm(em int)
- func (f *Font) SetFamilyName(name string)
- func (f *Font) SetFontName(name string)
- func (f *Font) SetFullName(name string)
- func (f *Font) SetSFNTNames(keyAndValues ...string)
- func (f *Font) SetUnderlinePosition(pos float64)
- func (f *Font) SetUnderlineWith(with float64)
- func (f *Font) SetVersion(version semver.Version)
- func (f *Font) UnderlinePosition() float64
- func (f *Font) UnderlineWith() float64
- func (f *Font) Version() *semver.Version
- type Glyph
- func (g *Glyph) AsObject() *python3.Object
- func (g *Glyph) Close() error
- func (g *Glyph) DecRef()
- func (g *Glyph) GlyphName() string
- func (g *Glyph) LeftSideBearing() float64
- func (g *Glyph) RightSideBearing() float64
- func (g *Glyph) SetGlyphName(name string)
- func (g *Glyph) SetLeftSideBearing(bearing float64)
- func (g *Glyph) SetRightSideBearing(bearing float64)
- func (g *Glyph) SetWidth(width int)
- func (g *Glyph) Transform(matrix []float64)
- func (g *Glyph) Width() int
- type LookupFeature
- type LookupFeatureScript
- type LookupFeatureScriptLanguage
- type LookupFeatureScriptTag
- type LookupFeatureTag
- type LookupFeatures
- type LookupFlag
- type LookupFlags
- type LookupType
- type SFNTName
- type SFNTNames
Constants ¶
const ( LookupTypeGSubSingle = LookupType("gsub_single") LookupTypeGSubContextChain = LookupType("gsub_contextchain") )
Lookup types.
const ( LookupFlagRightToLeft = LookupFlag("right_to_left") LookupFlagIgnoreBases = LookupFlag("ignore_bases") LookupFlagIgnoreLigatures = LookupFlag("ignore_ligatures") LookupFlagIgnoreMarks = LookupFlag("ignore_marks") )
Lookup flags.
Variables ¶
var ErrFileNotFound = os.ErrNotExist
ErrFileNotFound indicates that a file was not found.
Functions ¶
func AddContextualLookupSubtable ¶
func AddContextualLookupSubtable(font *Font, lookupName string, lookupSubtableName string, lookupType, lookupRule string)
AddContextualLookupSubtable creates a new subtable within the specified contextual lookup (contextual, contextual chaining, or reverse contextual chaining). The lookup name should be a string specifying an existing lookup. The subtable name should also be a string and should not match any currently existing subtable in the lookup.
func AddLookup ¶
func AddLookup(font *Font, lookupName string, lookupType LookupType, lookupFlags LookupFlags, lookupFeatures LookupFeatures)
AddLookup creates a new lookup with the given name, type and flags. It will tag it with any indicated features.
func AddLookupSubtable ¶
AddLookupSubtable creates a new subtable within the specified lookup. The lookup name should be a string specifying an existing lookup. The subtable name should also be a string and should not match any currently existing subtable in the lookup.
func AddPositionSubstitutionVariant ¶
AddPositionSubstitutionVariant adds position/substitution data to the glyph. The number and type of the arguments vary according to the type of the lookup containing the subtable.
func PasteGlyph ¶
PasteGlyph pastes the contents of (FontForge's internal) clipboard into the selected glyphs – and removes what was there before.
Types ¶
type Font ¶
type Font struct {
// contains filtered or unexported fields
}
Font is a wrapper around a Python object.
func (*Font) CreateGlyph ¶
CreateGlyph creates a new glyph.
func (*Font) FamilyName ¶
FamilyName returns the family name of the font.
func (*Font) SetCopyright ¶
SetCopyright sets the copyright.
func (*Font) SetFamilyName ¶
SetFamilyName sets the family name of the font.
func (*Font) SetFontName ¶
SetFontName sets the font name of the font.
func (*Font) SetFullName ¶
SetFullName sets the full name of the font.
func (*Font) SetSFNTNames ¶
SetSFNTNames sets the SFNT names.
func (*Font) SetUnderlinePosition ¶
SetUnderlinePosition sets the underline position of the font.
func (*Font) SetUnderlineWith ¶
SetUnderlineWith sets the underline with of the font.
func (*Font) SetVersion ¶
func (f *Font) SetVersion(version semver.Version)
SetVersion sets the version of the font.
func (*Font) UnderlinePosition ¶
UnderlinePosition returns the underline position of the font.
func (*Font) UnderlineWith ¶
UnderlineWith returns the underline with of the font.
type Glyph ¶
type Glyph struct {
// contains filtered or unexported fields
}
Glyph is a font glyph.
func (*Glyph) LeftSideBearing ¶
LeftSideBearing returns the left side bearing of the glyph.
func (*Glyph) RightSideBearing ¶
RightSideBearing returns the right side bearing of the glyph.
func (*Glyph) SetGlyphName ¶
SetGlyphName sets the name of the glyph.
func (*Glyph) SetLeftSideBearing ¶
SetLeftSideBearing sets the left side bearing of the glyph.
func (*Glyph) SetRightSideBearing ¶
SetRightSideBearing sets the right side bearing of the glyph.
type LookupFeature ¶
type LookupFeature struct { TagName LookupFeatureTag Scripts []LookupFeatureScript }
LookupFeature is a font lookup feature.
func NewLookupFeature ¶
func NewLookupFeature(tag string) LookupFeature
NewLookupFeature creates a new lookup feature.
func (LookupFeature) MarshalPyObject ¶
func (f LookupFeature) MarshalPyObject() *python3.Object
MarshalPyObject returns the underlying Object.
func (LookupFeature) WithScript ¶
func (f LookupFeature) WithScript(scriptTag LookupFeatureScriptTag, scriptLanguages ...LookupFeatureScriptLanguage) LookupFeature
WithScript adds a script to the lookup feature.
type LookupFeatureScript ¶
type LookupFeatureScript struct { Tag LookupFeatureScriptTag Languages []LookupFeatureScriptLanguage }
LookupFeatureScript is a font lookup feature script.
func (LookupFeatureScript) MarshalPyObject ¶
func (s LookupFeatureScript) MarshalPyObject() *python3.Object
MarshalPyObject returns the underlying Object.
type LookupFeatureScriptLanguage ¶
type LookupFeatureScriptLanguage string
LookupFeatureScriptLanguage is a font lookup feature script language.
func (LookupFeatureScriptLanguage) MarshalPyObject ¶
func (l LookupFeatureScriptLanguage) MarshalPyObject() *python3.Object
MarshalPyObject returns the underlying Object.
type LookupFeatureScriptTag ¶
type LookupFeatureScriptTag string
LookupFeatureScriptTag is a font lookup feature script tag.
func (LookupFeatureScriptTag) MarshalPyObject ¶
func (t LookupFeatureScriptTag) MarshalPyObject() *python3.Object
MarshalPyObject returns the underlying Object.
type LookupFeatureTag ¶
type LookupFeatureTag string
LookupFeatureTag is a font lookup feature tag.
func (LookupFeatureTag) MarshalPyObject ¶
func (t LookupFeatureTag) MarshalPyObject() *python3.Object
MarshalPyObject returns the underlying Object.
type LookupFeatures ¶
type LookupFeatures []LookupFeature
LookupFeatures are font lookup features.
func (LookupFeatures) MarshalPyObject ¶
func (s LookupFeatures) MarshalPyObject() *python3.Object
MarshalPyObject returns the underlying Object.
type LookupFlag ¶
type LookupFlag string
LookupFlag is a font lookup flag.
func (LookupFlag) MarshalPyObject ¶
func (f LookupFlag) MarshalPyObject() *python3.Object
MarshalPyObject returns the underlying Object.
type LookupFlags ¶
type LookupFlags []LookupFlag
LookupFlags are font lookup flags.
func (LookupFlags) MarshalPyObject ¶
func (f LookupFlags) MarshalPyObject() *python3.Object
MarshalPyObject returns the underlying Object.
type LookupType ¶
type LookupType string
LookupType is a font lookup type.
func (LookupType) MarshalPyObject ¶
func (t LookupType) MarshalPyObject() *python3.Object
MarshalPyObject returns the underlying PyObject.
type SFNTName ¶
SFNTName is a SFNT name.
func (SFNTName) MarshalPyObject ¶
MarshalPyObject marshals a SFNTName to a python3.Object.
type SFNTNames ¶
type SFNTNames []SFNTName
SFNTNames is a list of SFNTName.
func (SFNTNames) MarshalPyObject ¶
MarshalPyObject marshals a SFNTName to a python3.Object.