Documentation ¶
Index ¶
- func RenderPage(ops *op.Ops, page pdf.Page) error
- type Canvas
- func (c *Canvas) BeginText()
- func (c *Canvas) Clip()
- func (c *Canvas) CloseAndStroke()
- func (c *Canvas) CloseFillAndStroke()
- func (c *Canvas) EndText()
- func (c *Canvas) Fill()
- func (c *Canvas) FillAndStroke()
- func (c *Canvas) Image(img image.Image)
- func (c *Canvas) Kern(amount float32)
- func (c *Canvas) NoOpPaint()
- func (c *Canvas) Restore()
- func (c *Canvas) Save()
- func (s *Canvas) SetDash(lengths []float32, phase float32)
- func (s *Canvas) SetFillAlpha(alpha float32)
- func (s *Canvas) SetFillGray(g float32)
- func (s *Canvas) SetFont(f Font, size float32)
- func (s *Canvas) SetHScale(scale float32)
- func (s *Canvas) SetLineCap(c int)
- func (s *Canvas) SetLineJoin(j int)
- func (s *Canvas) SetLineWidth(w float32)
- func (s *Canvas) SetMiterLimit(m float32)
- func (s *Canvas) SetRGBFillColor(r, g, b float32)
- func (s *Canvas) SetRGBStrokeColor(r, g, b float32)
- func (s *Canvas) SetStrokeAlpha(alpha float32)
- func (s *Canvas) SetStrokeGray(g float32)
- func (s *Canvas) SetTextMatrix(a, b, c, d, e, f float32)
- func (s *Canvas) SetTextRendering(mode int)
- func (c *Canvas) ShowText(s string)
- func (c *Canvas) Stroke()
- func (s *Canvas) TextMove(x, y float32)
- func (ca *Canvas) Transform(a, b, c, d, e, f float32)
- type Font
- type Glyph
- type PathBuilder
- func (p *PathBuilder) ClosePath()
- func (p *PathBuilder) CurveTo(x1, y1, x2, y2, x3, y3 float32)
- func (p *PathBuilder) CurveV(x2, y2, x3, y3 float32)
- func (p *PathBuilder) CurveY(x1, y1, x3, y3 float32)
- func (p *PathBuilder) LineTo(x, y float32)
- func (p *PathBuilder) MoveTo(x, y float32)
- func (p *PathBuilder) QuadraticCurveTo(x1, y1, x2, y2 float32)
- func (p *PathBuilder) Rectangle(x, y, width, height float32)
- type PathElement
- type SimpleFont
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderPage ¶
RenderPage draws the contents of a PDF page to ops. The caller should do the appropriate transformation and scaling to ensure that the content is not rendered upside down. (The PDF coordinate system starts in the lower left, not in the upper left like Gio's.)
Types ¶
type Canvas ¶
type Canvas struct { PathBuilder // contains filtered or unexported fields }
A Canvas implements the PDF imaging model, drawing to a Gio operations list. Most of its methods correspond directly to PDF page description operators.
func (*Canvas) BeginText ¶
func (c *Canvas) BeginText()
BeginText starts a text object, setting the text matrix and text line matrix to the identity matrix.
func (*Canvas) Clip ¶
func (c *Canvas) Clip()
Clip causes the current path to be added to the clipping path after it is painted.
func (*Canvas) CloseAndStroke ¶
func (c *Canvas) CloseAndStroke()
CloseAndStroke closes the current path before stroking it it.
func (*Canvas) CloseFillAndStroke ¶
func (c *Canvas) CloseFillAndStroke()
CloseFillAndStroke closes the current path before filling and stroking it.
func (*Canvas) FillAndStroke ¶
func (c *Canvas) FillAndStroke()
FillAndStroke fills the current path and then strokes (outlines) it.
func (*Canvas) Image ¶
Image draws an image. The image is placed in the unit square of the user coordinate system.
func (*Canvas) Kern ¶
Kern moves the next text character to the left the specified amount. The distance is in units of 1/1000 of an em.
func (*Canvas) NoOpPaint ¶
func (c *Canvas) NoOpPaint()
NoOpPaint finishes the current path without filling or stroking it. It is normally used to apply a clipping path after calling Clip.
func (*Canvas) Restore ¶
func (c *Canvas) Restore()
Restore restores the graphics state, popping it off the stack.
func (*Canvas) Save ¶
func (c *Canvas) Save()
Save pushes a copy of the current graphics state onto the state stack.
func (*Canvas) SetFillAlpha ¶
func (s *Canvas) SetFillAlpha(alpha float32)
SetFillAlpha sets the opacity for filling paths.
func (*Canvas) SetFillGray ¶
func (s *Canvas) SetFillGray(g float32)
SetFillGray sets the fill color to a gray in the range from 0 (black) to 1 (white).
func (*Canvas) SetHScale ¶
func (s *Canvas) SetHScale(scale float32)
SetHScale sets the horizontal scaling percent for text.
func (*Canvas) SetLineCap ¶
func (s *Canvas) SetLineCap(c int)
SetLineCap sets the style for the caps at the end of lines: 0 (butt cap), 1 (round cap), or 2 (square cap).
func (*Canvas) SetLineJoin ¶
func (s *Canvas) SetLineJoin(j int)
SetLineJoin sets the style for the joins at corners of stroked paths: 0 (miter join), 1 (round join), or 2 (bevel join).
func (*Canvas) SetLineWidth ¶
func (s *Canvas) SetLineWidth(w float32)
SetLineWidth sets the width of the lines to use for stroking (outlining) shapes.
func (*Canvas) SetMiterLimit ¶
func (s *Canvas) SetMiterLimit(m float32)
SetMiterLimit sets the limit for the length of a mitered join.
func (*Canvas) SetRGBFillColor ¶
func (s *Canvas) SetRGBFillColor(r, g, b float32)
SetRGBStrokeColor sets the color to be used for filling shapes. The RGB values must be in the range from 0 to 1.
func (*Canvas) SetRGBStrokeColor ¶
func (s *Canvas) SetRGBStrokeColor(r, g, b float32)
SetRGBStrokeColor sets the color to be used for stroking (outlining) shapes. The RGB values must be in the range from 0 to 1.
func (*Canvas) SetStrokeAlpha ¶
func (s *Canvas) SetStrokeAlpha(alpha float32)
SetStrokeAlpha sets the opacity for stroking paths.
func (*Canvas) SetStrokeGray ¶
func (s *Canvas) SetStrokeGray(g float32)
SetStrokeGray sets the stroke color to a gray in the range from 0 (black) to 1 (white).
func (*Canvas) SetTextMatrix ¶
func (s *Canvas) SetTextMatrix(a, b, c, d, e, f float32)
SetTextMatrix sets the text matrix and the text line matrix.
func (*Canvas) SetTextRendering ¶
func (s *Canvas) SetTextRendering(mode int)
SetTextRendering sets the text rendering mode.
type Glyph ¶
type Glyph struct { Outlines []PathElement Width float32 }
A Glyph represents a character from a font. It uses a coordinate system where the origin is at the left end of the baseline of the glyph, y increases vertically, and the font size is one unit.
type PathBuilder ¶
type PathBuilder struct { Path []PathElement // contains filtered or unexported fields }
func (*PathBuilder) ClosePath ¶
func (p *PathBuilder) ClosePath()
ClosePath closes the path, ensuring that it ends at the same point where it began.
func (*PathBuilder) CurveTo ¶
func (p *PathBuilder) CurveTo(x1, y1, x2, y2, x3, y3 float32)
CurveTo adds a cubic Bezier curve to the path. It ends at (x3, y3) and has (x1, y1) and (x2, y2) for control points.
func (*PathBuilder) CurveV ¶
func (p *PathBuilder) CurveV(x2, y2, x3, y3 float32)
CurveV adds a cubic Bezier curve to the path. It ends at (x3, y3) and has the current point and (x2, y2) for control points.
func (*PathBuilder) CurveY ¶
func (p *PathBuilder) CurveY(x1, y1, x3, y3 float32)
CurveY adds a cubic Bezier curve to the path. It ends at (x3, y3) and has (x1, y1) and (x3, y3) for control points.
func (*PathBuilder) LineTo ¶
func (p *PathBuilder) LineTo(x, y float32)
LineTo adds a line segment to the path, ending at (x, y).
func (*PathBuilder) MoveTo ¶
func (p *PathBuilder) MoveTo(x, y float32)
MoveTo starts a new subpath at (x, y).
func (*PathBuilder) QuadraticCurveTo ¶
func (p *PathBuilder) QuadraticCurveTo(x1, y1, x2, y2 float32)
QuadraticCurveTo adds a quadratic Bezier curve to the path. It ends at (x2, y2) and has (x1, y1) for its control point.
func (*PathBuilder) Rectangle ¶
func (p *PathBuilder) Rectangle(x, y, width, height float32)
Rectangle creates a new subpath containing a rectangle of the specified dimensions.
type PathElement ¶
type PathElement struct { // Op is the PDF path construction operator corresponding to this // PathElement. Possible values are: // // m moveto // l lineto // c curveto // h closepath Op byte // CP1 and CP2 are the control points for a bezier curve segment ('c'). CP1, CP2 f32.Point End f32.Point }
A PathElement represents a segement of a path.
type SimpleFont ¶
type SimpleFont struct {
Glyphs [256]Glyph
}
A SimpleFont is a font with a simple 8-bit encoding.
func SimpleFontFromCFF ¶
func SimpleFontFromCFF(data []byte, enc simpleencodings.Encoding) (*SimpleFont, error)
SimpleFontFromCFF converts a CFF font to a SimpleFont, using the encoding provided.
func SimpleFontFromSFNT ¶
func SimpleFontFromSFNT(data []byte, enc simpleencodings.Encoding) (*SimpleFont, error)
SimpleFontFromSFNT converts an SFNT (TrueType or OpenType) font to a SimpleFont with the specified encoding.
func SimpleFontFromType1 ¶
func SimpleFontFromType1(data []byte, enc simpleencodings.Encoding) (*SimpleFont, error)
SimpleFontFromType1 converts a Type 1 font to a SimpleFont, using the encoding provided.
func (*SimpleFont) ToGlyphs ¶
func (f *SimpleFont) ToGlyphs(s string) []Glyph
Directories ¶
Path | Synopsis |
---|---|
Package cff provides a parser for the CFF font format defined at https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5176.CFF.pdf.
|
Package cff provides a parser for the CFF font format defined at https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5176.CFF.pdf. |
Package pdf implements reading of PDF files.
|
Package pdf implements reading of PDF files. |