Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FontLoader ¶
A FontLoader can load fonts, in case fonts are not embedded in the PDF file. Every FontLoader contains the 14 standard fonts required by the PDF specification. Other external fonts can be added using AddFontMap and AddFont.
It is safe to use a FontLoader concurrently from multiple goroutines.
func NewFontLoader ¶
func NewFontLoader() *FontLoader
NewFontLoader creates a new font loader. The loader is initialized with the 14 standard fonts required by the PDF specification.
func (*FontLoader) AddFont ¶
func (l *FontLoader) AddFont(postscriptName string, tp FontType, fname string)
AddFont adds a font to the loader. Any previous mapping for the same PostScript name and font type is overwritten.
func (*FontLoader) AddFontMap ¶
func (l *FontLoader) AddFontMap(r io.Reader) error
AddFontMap reads a font map from r and adds it to the loader. A font map consists of lines of the form
<name> <type> <path>
where <name> is the PostScript name of the font, <type> is either "type1", "afm" or "sfnt", and <path> is the path to the font file. The fields must be separated by single spaces. Lines starting with '#' or '%' are ignored.
Any previous mapping for (<name>, <type>) is overwritten.
func (*FontLoader) Open ¶
func (l *FontLoader) Open(postscriptName string, tp FontType) (io.ReadCloser, error)
Open opens the font with the given PostScript name. The returned io.ReadCloser must be closed by the caller.