bitedbuild

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package bitedbuild is the backing library for bited-build.

Index

Constants

This section is empty.

Variables

View Source
var DUnit = Unit{
	SrcForm:     SrcForm{SrcT},
	OutDir:      "out",
	XForm:       XForm{XFormT},
	VecSuffix:   " Vec",
	OTBSuffix:   "",
	DFONTSuffix: "",
	PCFSuffix:   " PCF",
	SFNTLang:    "English (US)",
}

DUnit specifies default values for Unit.

View Source
var SrcT = template.Must(template.New("").Parse("src/{{ .Name }}.bdf"))

SrcT is the default value for Unit SrcForm.

View Source
var XFormT = template.Must(template.New("").Parse("{{ .Name }}{{ .X }}x"))

XFormT is the default value for Unit XForm.

Functions

This section is empty.

Types

type SrcForm

type SrcForm struct{ *template.Template }

SrcForm is a wrapper type to enable koanf to unmarshal strings into template.Template for Unit SrcForm.

func (*SrcForm) UnmarshalText

func (src *SrcForm) UnmarshalText(text []byte) error

type SrcFormPat

type SrcFormPat struct {
	// Name is the font's family name.
	Name string
}

A SrcFormPat specifies fields passed to Unit SrcForm templates.

type Unit

type Unit struct {
	// Src is the processed path to the source bited BDF.
	// Derived from SrcForm.
	Src string `koanf:"-"`
	// Nerd determines whether to compile Nerd Fonts variants.
	Nerd bool `koanf:"-"`
	// TTF is the path to the output TTF.
	TTF string `koanf:"-"`
	// TTFix is a processed string of custom Python code to be injected when
	// building via Fontforge.
	// Derived from TTFixPre.
	TTFix string `koanf:"-"`
	// Xs is a processed list of integer scales to build.
	// Derived from XsPre.
	Xs []int `koanf:"-"`
	// FontSize is the base font size of the font.
	FontSize int `koanf:"-"`
	// Widths maps glyph names defined in Src to glyph widths.
	Widths map[string]int `koanf:"-"`

	// Name is the font's family name.
	Name string `koanf:"name"`
	// SrcForm is the template for Src.
	SrcForm SrcForm `koanf:"src"`
	// OutDir is the output directory for generated images.
	OutDir string `koanf:"out_dir"`
	// VecSuffix is the suffix for vector format names.
	VecSuffix string `koanf:"vec_suffix"`
	// OTBSuffix is the suffix for OTB format names.
	OTBSuffix string `koanf:"otb_suffix"`
	// DFONTSuffix is the suffix for DFONT format names.
	DFONTSuffix string `koanf:"dfont_suffix"`
	// PCFSuffix is the template for PCF format names.
	PCFSuffix string `koanf:"pcf_suffix"`
	// Xs is an unprocessed list of integer scales to build.
	XsPre []int `koanf:"xs"`
	// XForm is the template for each scaled font's name.
	XForm XForm `koanf:"x_format"`
	// SFNTLang is the language to use for SFNT table data.
	SFNTLang string `koanf:"sfnt_lang"`
	// TTFix is an unprocessed string of custom Python code to be injected when
	// building via Fontforge.
	TTFixPre string `koanf:"ttfix"`
	// SFNT represents user-defined key-value pairings for the font's SFNT table.
	SFNT map[string]string `koanf:"sfnt"`
}

A Unit holds the data necessary to build a single font.

func NewUnit

func NewUnit(cfg *koanf.Koanf, nerd bool) (Unit, error)

NewUnit creates a full-fledged Unit from a single-font config and populates it with the necessary data for building.

func (*Unit) Build

func (unit *Unit) Build() error

Build builds bitmap/vector formats from a Unit for single font.

type XForm

type XForm struct{ *template.Template }

XForm is a wrapper type to enable koanf to unmarshal strings into template.Template for Unit XForm.

func (*XForm) UnmarshalText

func (xf *XForm) UnmarshalText(text []byte) error

type XFormPat

type XFormPat struct {
	// Name is the font's family name.
	Name string
	// X is the scale.
	X int
}

XFormPat specifies fields passed to Unit XForm templates.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL