Documentation ¶
Overview ¶
Package type3 implements Type 3 fonts embedded into PDF files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmbedInfo ¶ added in v0.3.5
type EmbedInfo struct { Glyphs map[string]*Glyph FontMatrix [6]float64 // Encoding (a slice of length 256) is the encoding vector used by the client. // This is used to construct the `Encoding` entry of the PDF font dictionary. Encoding []string // ResName is the resource name for the font. // This is only used for PDF version 1.0. ResName pdf.Name // Resources is the resource dictionary for the font. Resources *pdf.Resources ItalicAngle float64 IsFixedPitch bool IsSerif bool IsScript bool ForceBold bool IsAllCap bool IsSmallCap bool // ToUnicode (optional) is a map from character codes to unicode strings. ToUnicode *cmap.ToUnicode }
EmbedInfo contains the information needed to embed a type 3 font into a PDF document.
type Font ¶ added in v0.3.5
type Font struct { Glyphs map[string]*Glyph FontMatrix [6]float64 Ascent funit.Int16 Descent funit.Int16 BaseLineSkip funit.Int16 ItalicAngle float64 IsFixedPitch bool IsSerif bool IsScript bool IsAllCap bool IsSmallCap bool ForceBold bool Resources *pdf.Resources NumOpen int // -1 if the font is embedded, otherwise the number of glyphs not yet closed }
Font is a PDF Type 3 font.
func New ¶
New creates a new type 3 font. Initally the font does not contain any glyphs. Use Font.AddGlyph to add glyphs to the font. Once the font is embedded the first time, no more glyphs can be added.
func (*Font) AddGlyph ¶ added in v0.3.5
func (f *Font) AddGlyph(name string, widthX funit.Int16, bbox funit.Rect16, shapeOnly bool) (*GlyphBuilder, error)
AddGlyph adds a new glyph to the type 3 font.
If shapeOnly is true, a call to the "d1" operator is added at the start of the glyph description. In this case, the glyph description may only specify the shape of the glyph, but not its color. Otherwise, a call to the "d0" operator is added at the start of the glyph description. In this case, the glyph description may specify both the shape and the color of the glyph.
type GlyphBuilder ¶ added in v0.3.5
GlyphBuilder is used to write a glyph description as described in section 9.6.5 of PDF 32000-1:2008. The .Close() method must be called after the description has been written.
func (*GlyphBuilder) Close ¶ added in v0.3.5
func (g *GlyphBuilder) Close() error
Close most be called after the glyph description has been written.