Documentation ¶
Index ¶
- Variables
- func BeginLineNone() func(first bool) string
- func BeginLineNumber() func(first bool) string
- type Builder
- func (b *Builder) AddLine(line string)
- func (b *Builder) AddLines(lines ...string)
- func (b *Builder) CommitLine()
- func (b *Builder) Map(r rune)
- func (b *Builder) NewLine()
- func (b *Builder) UncheckedRunes() []rune
- func (b *Builder) Write(text []byte) (int, error)
- func (b *Builder) WriteString(text string)
- type Config
- type Generator
Constants ¶
This section is empty.
Variables ¶
View Source
var DejaVuSansMono = Config{ TabLen: 4, LineLen: 75, PageLen: 53, Font: dejaVuSansMonoFont, FontSize: 12, FontName: "DejaVuSansMono", RuneReplace: '�', LineBreak: 0.49, MarginH: 0.9, MarginV: 2.0, HeadRune: '━', BeginLine: BeginLineNone, }
A Generator with the font DejaVu Sans Mono.
Functions ¶
func BeginLineNumber ¶
Write the line number or a ' if it's a multiple line.
Types ¶
type Builder ¶
type Builder struct { Lines []string // Config TabLen int // width of a tabulation LineLen int // max line size PageLen int // The number of line into a page // Return true if the rune is invalid (For example: the rune desn't have // a glyph in the font). Can be nil. RuneCheck func(rune) bool // The rune to replace unchecked rune RuneReplace rune // Add a string at the begin of each line. BeginLine func(first bool) string // contains filtered or unexported fields }
A buffer to split a text into several lines. TabLen and LineLen must be set before use. Do not use it in concurence.
func (*Builder) CommitLine ¶
func (b *Builder) CommitLine()
Commit the word and create a new line if not empty
func (*Builder) UncheckedRunes ¶
func (*Builder) WriteString ¶
Add the text to the buffer. No new line at the end. If it's the last line of the document, call Builder.CommitLine()
type Config ¶
type Config struct { Font []byte FontSize int FontName string RuneReplace rune TabLen int // width of a tabulation LineLen int // max line size PageLen int // The number of line into a page LineBreak float64 // Line size HeadRune rune // The rune line to separate head and body. // The margins MarginH, MarginV float64 // This function it's called in CreatePDF() and the result at each line // begin. BeginLine func() func(first bool) string // contains filtered or unexported fields }
All Public fields are required.
Click to show internal directories.
Click to hide internal directories.