Documentation
¶
Overview ¶
Package glyph gives the outlines of characters in the standard fonts, so text can be drawn as shapes - the same in every browser, whatever fonts it has.
Where the URW base-35 fonts are installed as OpenType (Debian's fonts-urw-base35, which Ghostscript needs), it uses them: the very glyphs Ghostscript embeds when epstopdf turns OneFit's EPS into its PDF, so the preview is the PDF. They are read at run time from the system, never shipped. Otherwise it uses the Liberation fonts it carries, whose advance widths are those of Helvetica, Times and Courier; the Symbol font's letters are then Liberation Serif's Greek. OFE_URW_FONTS names another directory holding the URW OpenType files. On macOS the onefite-go formula installs them in Homebrew's share/fonts/urw-base35, and the font-urw-base35 cask in ~/Library/Fonts; both are searched.
The Liberation fonts are distributed under the SIL Open Font License 1.1 (see FontLicense).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( //go:embed OFL.txt FontLicense string //go:embed go-fonts-LICENSE PackageLicense string )
The Liberation fonts' license (SIL Open Font License 1.1) and that of the go-fonts package carrying them (BSD), which must go with the fonts - they are embedded in every plot-go binary: plot-go -notices prints these.
var ( //go:embed x-image-LICENSE XImageLicense string //go:embed x-image-PATENTS XImagePatents string //go:embed x-text-LICENSE XTextLicense string //go:embed x-text-PATENTS XTextPatents string )
The licenses (BSD) and patent grants of golang.org/x/image, which reads and draws the fonts, and golang.org/x/text, which it uses: compiled into every plot-go binary, so plot-go -notices prints them too.
var SymbolGreek = map[byte]rune{
'A': 'Α', 'B': 'Β', 'C': 'Χ', 'D': 'Δ', 'E': 'Ε', 'F': 'Φ', 'G': 'Γ', 'H': 'Η',
'I': 'Ι', 'J': 'ϑ', 'K': 'Κ', 'L': 'Λ', 'M': 'Μ', 'N': 'Ν', 'O': 'Ο', 'P': 'Π',
'Q': 'Θ', 'R': 'Ρ', 'S': 'Σ', 'T': 'Τ', 'U': 'Υ', 'V': 'ς', 'W': 'Ω', 'X': 'Ξ',
'Y': 'Ψ', 'Z': 'Ζ',
'a': 'α', 'b': 'β', 'c': 'χ', 'd': 'δ', 'e': 'ε', 'f': 'φ', 'g': 'γ', 'h': 'η',
'i': 'ι', 'j': 'ϕ', 'k': 'κ', 'l': 'λ', 'm': 'μ', 'n': 'ν', 'o': 'ο', 'p': 'π',
'q': 'θ', 'r': 'ρ', 's': 'σ', 't': 'τ', 'u': 'υ', 'v': 'ϖ', 'w': 'ω', 'x': 'ξ',
'y': 'ψ', 'z': 'ζ',
}
SymbolGreek is the Symbol font's letters as the Greek characters they draw (Adobe's Symbol.afm names them: Alpha, Beta, Chi, ...; theta1, sigma1, phi1, omega1 are the variant forms).
Functions ¶
func Ink ¶ added in v0.1.6
Ink is the box of the ink str leaves in font name (whose Adobe metrics are m), in ems, the pen starting at 0: each character's box from the URW font where it is installed - gracebat lays its text out with the URW glyphs, whose ink differs from Adobe's by up to 0.02 em - else from Adobe's metrics. The advance widths are Adobe's either way (the URW fonts are metric compatible).
func Rune ¶
Rune is the character byte c draws in a standard font: Symbol letters are Greek, 39 is quoteright (gracebat's text encoding), the rest Latin-1.
func Source ¶
Source is where a standard font's outlines come from: the URW file's path, or "Liberation" (the fonts plot-go carries).
func URWInk ¶ added in v0.1.6
URWInk is the box of the ink character c leaves in a standard font, in ems, from the URW font when it is installed - the glyphs gracebat lays its text out with. ok is false without the URW font (or for a character it has no glyph for): the caller keeps Adobe's metrics then.