props

package
v2.0.0-alpha.29 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: MIT Imports: 8 Imported by: 26

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 (b *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.

func (*Barcode) ToRectProp

func (b *Barcode) ToRectProp() *Rect

type Cell

type Cell struct {
	BackgroundColor *Color
	BorderColor     *Color
	BorderType      border.Type
	BorderThickness float64
	LineStyle       linestyle.Type
}

type Color

type Color struct {
	// Red is the amount of red
	Red int
	// Green is the amount of red
	Green int
	// Blue is the amount of red
	Blue int
}

Color represents a color in the RGB (Red, Green, Blue) space, is possible mix values, when all values are 0 the result color is black when all values are 255 the result color is white.

func NewBlack

func NewBlack() *Color

NewBlack return a Color with all components (red, green and blue) as 0.

func NewWhite

func NewWhite() *Color

NewWhite return a Color with all components (red, green and blue) as 255.

func (*Color) IsWhite

func (s *Color) IsWhite() bool

IsWhite from Color will return true if all components of color. are in the maximum value.

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 fontstyle.Type
	// Size of the text.
	Size float64
	// Color define the fontstyle 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 align.Type, top float64, verticalPadding float64) *Text

ToTextProp from Font return a Text based on Font.

type Line

type Line struct {
	// Color define the line color.
	Color Color
	// Style define the line style (solid, dashed or dotted).
	Style         linestyle.Type
	Thickness     float64
	Orientation   orientation.Type
	OffsetPercent float64
	SizePercent   float64
}

Line represents properties from a Line inside a cell.

func (*Line) MakeValid

func (s *Line) MakeValid()

MakeValid from Line define default values for a Line.

type Page

type Page struct {
	Pattern string
	Place   Place
	Family  string
	Style   fontstyle.Type
	Size    float64
	Color   *Color
}

func (*Page) GetNumberTextProp

func (p *Page) GetNumberTextProp(height float64) *Text

func (*Page) GetPageString

func (p *Page) GetPageString(current, total int) string

type Place

type Place string
const (
	NorthWest Place = "north_west"
	North     Place = "north"
	NorthEast Place = "north_east"
	SouthWest Place = "south_west"
	South     Place = "south"
	SouthEast Place = "south_east"
)

func (Place) IsValid

func (p Place) IsValid() bool

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 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 fontstyle.Type
	// Size of the text.
	Size float64
	// Align of the text.
	Align             align.Type
	BreakLineStrategy breakline.Strategy
	// VerticalPadding define an additional space between lines.
	VerticalPadding float64
	// Color define the fontstyle color.
	Color *Color
}

Text represents properties from a Text inside a cell.

func (*Text) MakeValid

func (s *Text) MakeValid(font *Font)

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