Documentation
¶
Overview ¶
Package type3 provides support for embedding type 3 fonts into PDF documents.
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 // TODO(voss): include the individual fields instead 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 *tounicode.Info }
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 Ascent funit.Int16 Descent funit.Int16 BaseLineSkip funit.Int16 UnderlinePosition funit.Float64 UnderlineThickness funit.Float64 ItalicAngle float64 IsFixedPitch bool IsSerif bool IsScript bool IsItalic bool IsAllCap bool IsSmallCap bool ForceBold bool FontMatrix [6]float64 Resources *pdf.Resources CMap map[rune]glyph.ID // contains filtered or unexported fields }
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.
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.
func (*Font) GetGeometry ¶ added in v0.3.5
GetGeometry implements the font.Font interface.
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.