htmlvg

package module
v0.0.0-...-623b241 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2020 License: BSD-2-Clause Imports: 8 Imported by: 0

README

htmlvg

Package htmlvg provides a gonum.org/v1/plot/vg HTML renderer.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CanvasWrapper

type CanvasWrapper struct {
	draw.Canvas

	At vg.Point

	// Font, BoldFont, and ItalicFont are the names of the fonts
	// to be used for regular, bold, italic, and bold-italic text, respectively.
	// The defaults are "Helvetica", "Helvetica-Bold", "Helvetica-Oblique",
	// and "Helvetica-BoldOblique", respectively.
	Font, BoldFont, ItalicFont, BoldItalicFont string

	// FontSize is the base font size. The default is 12.
	FontSize vg.Length

	// Color is the font color.
	Color color.Color

	// PMarginTop and PMarginBottom are the margins before and
	// after paragraphs. Defaults are 0 and 0.833 text height units, respectively.
	PMarginTop, PMarginBottom float64

	// H1Scale - H6Scale are font size scaling factors for headings.
	// Defaults are 2.0, 1.5, 1.25, 1, 1, and 1, respectively.
	H1Scale, H2Scale, H3Scale, H4Scale, H5Scale, H6Scale float64

	// H*PMarginTop are the margins above headings.
	// Default values are 1, 0.833, 0.75, 0.5, 0.5, and 0.5 respectively.
	H1MarginTop, H2MarginTop, H3MarginTop, H4MarginTop, H5MarginTop, H6MarginTop float64

	// H*PMarginBottom are the margins below headings.
	// Default values are 1, 0.833, 0.75, 0.5, 0.5, and 0.5 respectively.
	H1MarginBottom, H2MarginBottom, H3MarginBottom, H4MarginBottom, H5MarginBottom, H6MarginBottom float64

	// H*Bold specifies whether the headings should be bold-face.
	// The defaults are true, true, true, true, true, and false, respectively.
	H1Bold, H2Bold, H3Bold, H4Bold, H5Bold, H6Bold bool

	// SuperscriptPosition, SubscriptPosition, and SuperSubScale
	// are the relative positions and sizes of superscripts and subscripts.
	// Defaults are +0.25, -1.25, and 0.583, respectively.
	SuperscriptPosition, SubscriptPosition, SuperSubScale float64

	// HRMarginTop and Bottom specify the spacing above and below horizontal
	// rules. Defaults are 0.0 and 1.833 text height units, respectively.
	HRMarginTop, HRMarginBottom float64

	// HRScale specifies the width of horizontal rules. The
	// default is 0.1 text height units.
	HRScale float64

	// HRColor specifies the color of horizontal rules. The
	// default is black.
	HRColor color.Color

	// BreakLines specifies if the text should be wrapped to the next line
	// if it is too long. The default is true.
	WrapLines bool
	// contains filtered or unexported fields
}

CanvasWrapper wraps a vg.Canvas (through draw.Canvas) to to render HTML.

func WrapCanvas

func WrapCanvas(dc draw.Canvas) *CanvasWrapper

WrapCanvas takes a draw.Canvas and returns a vg.Canvas with the the FillString method overwritten.

func (*CanvasWrapper) FillString

func (r *CanvasWrapper) FillString(_ vg.Font, pt vg.Point, HTML string)

FillString overrides vg.Canvas.FillString to renders the HTML input.

func (*CanvasWrapper) Size

func (r *CanvasWrapper) Size() (vg.Length, vg.Length)

Size override vg.draw.Canvas.Size to match the signature of vg.Canvas.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL