Documentation
¶
Overview ¶
Package type1 implements a parser for Adobe Type1 fonts, defined by .afm files (https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5004.AFM_Spec.pdf) and .pdf files (https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/T1_SPEC.pdf)
Index ¶
Constants ¶
const (
CHARSTRING_KEY = 4330
)
const Notdef = ".notdef"
Variables ¶
This section is empty.
Functions ¶
func ParseEncoding ¶
func ParseEncoding(pfb *bytes.Reader) (*simpleencodings.Encoding, error)
Parse parses an Adobe Type 1 (.pfb) font file, extracting its builtin encoding.
Types ¶
type AFMFont ¶
type AFMFont struct { // Represents the section CharMetrics in the AFM file. // The key is the name of the char. // Even not encoded chars are present CharMetrics map[string]CharMetric CharCodeToCharName [256]string // encoded chars KernPairs map[string][]KernPair // the character set of the font. CharacterSet string FontName string // Postscript font name. FullName string // full name of the font. FamilyName string // family name of the font. Version string // font program version identifier (optional) Notice string // font name trademark or copyright notice (optional) Weight string // Weight of the font: normal, bold, etc. ItalicAngle int // italic angle of the font, usually 0. or negative. IsFixedPitch bool // true if all the characters have the same width. UnderlinePosition int UnderlineThickness int Ascender Fl CapHeight Fl Descender Fl Llx Fl // the llx of the FontBox Lly Fl // the lly of the FontBox Urx Fl // the urx of the FontBox Ury Fl // the ury of the FontBox XHeight int StdHw int StdVw int // contains filtered or unexported fields }
AFMFont represents a type1 font as found in a .afm file.
func ParseAFMFile ¶
ParseAFMFile read a .afm file and return the associated font.
func (AFMFont) CharSet ¶
CharSet returns a string listing the character names defined in the font subset. The names in this string shall be in PDF syntax—that is, each name preceded by a slash (/). The names may appear in any order. The name .notdef shall be omitted; it shall exist in the font subset.
type CharMetric ¶
type KernPair ¶
type KernPair struct { SndChar string // glyph name // KerningDistance is expressed in glyph units. // It is most often negative, // that is, a negative value indicates that chars // should be closer. KerningDistance int }
KernPair represents a kerning pair, from an implicit first first glyph.