props

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: MIT Imports: 2 Imported by: 105 modules, 119 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Barcode

type Barcode struct {
	// Left is the space between the left cell boundary to the barcode, if center is false.
	Left float64
	// Top is space between the upper cell limit to the barcode, if center is false.
	Top float64
	// Percent is how much the barcode will occupy the cell,
	// ex 100%: The barcode will fulfill the entire cell
	// ex 50%: The greater side from the barcode will have half the size of the cell.
	Percent float64
	// Proportion is the proportion between size of the barcode.
	// Ex: 16x9, 4x3...
	Proportion Proportion
	// Center define that the barcode will be vertically and horizontally centralized.
	Center bool
}

Barcode represents properties from a barcode inside a cell.

func (*Barcode) MakeValid

func (s *Barcode) MakeValid()

MakeValid from Barcode will make the properties from a barcode reliable to fit inside a cell and define default values for a barcode.

type Font

type Font struct {
	// Family of the text, ex: consts.Arial, helvetica and etc.
	Family string
	// Style of the text, ex: consts.Normal, bold and etc.
	Style consts.Style
	// Size of the text.
	Size float64
	// Color define the font color.
	Color color.Color
}

Font represents properties from a text.

func (*Font) MakeValid

func (s *Font) MakeValid(defaultFamily string)

MakeValid from Font define default values for a Signature.

func (*Font) ToTextProp

func (s *Font) ToTextProp(align consts.Align, top float64, extrapolate bool, verticalPadding float64) Text

ToTextProp from Font return a Text based on Font.

type Line added in v0.35.0

type Line struct {
	// Color define the line color.
	Color color.Color
	// Style define the line style (solid, dashed or dotted).
	Style consts.LineStyle
	// Width define the line width (it cannot be greater than line height)
	Width float64
}

Line represents properties from a Line inside a cell.

func (*Line) MakeValid added in v0.36.0

func (s *Line) MakeValid(spaceHeight float64)

MakeValid from Line define default values for a Line.

type Proportion

type Proportion struct {
	// Width from the rectangle: Barcode, image and etc.
	Width float64
	// Height from the rectangle: Barcode, image and etc.
	Height float64
}

Proportion represents a proportion from a rectangle, example: 16x9, 4x3...

type Rect

type Rect struct {
	// Left is the space between the left cell boundary to the rectangle, if center is false.
	Left float64
	// Top is space between the upper cell limit to the barcode, if center is false.
	Top float64
	// Percent is how much the rectangle will occupy the cell,
	// ex 100%: The rectangle will fulfill the entire cell
	// ex 50%: The greater side from the rectangle will have half the size of the cell.
	Percent float64
	// Center define that the barcode will be vertically and horizontally centralized.
	Center bool
}

Rect represents properties from a rectangle (Image, QrCode or Barcode) inside a cell.

func (*Rect) MakeValid

func (s *Rect) MakeValid()

MakeValid from Rect will make the properties from a rectangle reliable to fit inside a cell and define default values for a rectangle.

type TableList

type TableList struct {
	// HeaderProp is the custom properties of the text inside
	// the headers.
	HeaderProp TableListContent
	// ContentProp is the custom properties of the text inside
	// the contents.
	ContentProp TableListContent
	// Align is the align of the text (header and content) inside the columns.
	Align consts.Align
	// AlternatedBackground define the background color from even rows
	// i.e rows with index (0, 2, 4, ..., N) will have background colorized,
	// rows with index (1, 3, 5, ..., N) will not.
	AlternatedBackground *color.Color
	// HeaderContentSpace is the space between the header and the contents.
	HeaderContentSpace float64
	// VerticalContentPadding define the space between lines in content.
	VerticalContentPadding float64
	// Line adds a line after every content-row to separate rows. The line's spaceHeight is set to 1.0.
	Line bool
	// LineProp is the custom properties of the line separating the rows
	LineProp Line
	// MaxGridSum of a TableList
	MaxGridSum float64
}

TableList represents properties from a TableList.

func (*TableList) MakeValid

func (s *TableList) MakeValid(header []string, defaultFamily string)

MakeValid from TableList define default values for a TableList.

type TableListContent added in v0.25.0

type TableListContent struct {
	// Family of the text, ex: consts.Arial, helvetica and etc.
	Family string
	// Style of the text, ex: consts.Normal, bold and etc.
	Style consts.Style
	// Size of the text.
	Size float64
	// Color define the font color.
	Color color.Color
	// GridSizes is the custom properties of the size of the grid
	// the sum of the values cannot be greater than 12, if this
	// value is not provided the width of all columns will be the
	// same.
	GridSizes []uint
	// CellTextColorChangerFunc is a custom function that will be called
	// before the cell is created and will change the text color
	// following the logic inside the function
	CellTextColorChangerFunc func(cellValue string) color.Color
	// CellTextColorChangerColumnIndex will be used to only run the
	// function ChangeCellTextColor when the column index matches the
	// desired index
	// Must start at 0
	CellTextColorChangerColumnIndex int
}

TableListContent represents properties from a line (header/content) from a TableList.

func (*TableListContent) ToTextProp added in v0.25.0

func (s *TableListContent) ToTextProp(align consts.Align, top float64, extrapolate bool, verticalPadding float64) Text

ToTextProp from Font return a TableListContent based on Font.

type Text

type Text struct {
	// Top is the amount of space between the upper cell limit and the text.
	Top float64
	// Left is the minimal amount of space between the left cell boundary and the text.
	Left float64
	// Right is the minimal amount of space between the right cell boundary and the text.
	Right float64
	// Family of the text, ex: consts.Arial, helvetica and etc.
	Family string
	// Style of the text, ex: consts.Normal, bold and etc.
	Style consts.Style
	// Size of the text.
	Size float64
	// Align of the text.
	Align consts.Align
	// Extrapolate define if the text will automatically add a new line when.
	// text reach the right cell boundary.
	Extrapolate bool
	// VerticalPadding define an additional space between lines.
	VerticalPadding float64
	// Color define the font color.
	Color color.Color
}

Text represents properties from a Text inside a cell.

func (*Text) MakeValid

func (s *Text) MakeValid(defaultFamily string)

MakeValid from Text define default values for a Text.

Jump to

Keyboard shortcuts

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