config

package
v0.0.80 Latest Latest
Warning

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

Go to latest
Published: May 10, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package config contains configuration structures for docpdf.

Index

Constants

This section is empty.

Variables

View Source
var FontStyleBold = FontStyle{/* contains filtered or unexported fields */}

Bold font style (000010)

View Source
var FontStyleItalic = FontStyle{/* contains filtered or unexported fields */}

Italic font style (000001)

View Source
var FontStyleRegular = FontStyle{/* contains filtered or unexported fields */}

Regular font style (000000)

View Source
var FontStyleUnderline = FontStyle{/* contains filtered or unexported fields */}

Underline font style (000011)

Functions

This section is empty.

Types

type Alignment

type Alignment int

position representa una posición o alineación en el documento

const (
	// Left representa alineación a la izquierda
	Left Alignment = 8 //001000
	// Top representa alineación superior
	Top Alignment = 4 //000100
	// Right representa alineación a la derecha
	Right Alignment = 2 //000010
	// Bottom representa alineación inferior
	Bottom Alignment = 1 //000001
	// Center representa alineación al centro
	Center Alignment = 16 //010000
	// Middle representa alineación al medio
	Middle Alignment = 32 //100000
	// Justify representa texto justificado
	Justify Alignment = 64 //1000000
	// AllBorders representa todos los bordes
	AllBorders Alignment = 15 //001111
)

type FontFamily

type FontFamily struct {
	// Regular specifies the filename for the regular font style.
	// It's recommended to name this file "regular.ttf".
	Regular string
	// Bold specifies the filename for the bold font style.
	// It's recommended to name this file "bold.ttf".
	Bold string
	// Italic specifies the filename for the italic font style.
	// It's recommended to name this file "italic.ttf".
	Italic string
	// Underline specifies the filename for the underline font style.
	// It's recommended to name this file "underline.ttf".
	Underline string
	// Path specifies the base directory where the font files are located.
	// Defaults to "fonts/".
	Path string // Base path for fonts defaults to "fonts/"
}

FontFamily represents font files for different styles It contains the regular, bold, italic, and other styles.

type FontStyle added in v0.0.80

type FontStyle struct {
	// contains filtered or unexported fields
}

FontStyle represents a complete font configuration with styling, size, color, and family This is the unified font structure for the entire docpdf project

func GetCompleteFont added in v0.0.80

func GetCompleteFont(styleStr string, size float64, color style.Color, family string) FontStyle

GetCompleteFont creates a FontStyle with all properties specified Use this to create a complete font definition with style, size, color and family

func GetFontStyle added in v0.0.80

func GetFontStyle(fontStyleStr string) FontStyle

GetFontStyle converts a string font style to its FontStyle representation eg: "B" => FontStyleBold, "I" => FontStyleItalic, "U" => FontStyleUnderline defaults to FontStyleRegular if no valid style is found

func GetFontStyleInIntFormat

func GetFontStyleInIntFormat(fontStyle string) FontStyle

GetFontStyleInIntFormat converts a string font style to its integer representation Kept for backward compatibility, but uses the new FontStyle struct internally eg: "B" => FontStyleBold, "I" => FontStyleItalic, "U" => FontStyleUnderline defaults to FontStyleRegular if no valid style is found

func NewFontStyle added in v0.0.80

func NewFontStyle(name string, size float64, color ...style.Color) FontStyle

NewFontStyle creates a new FontStyle with the given properties name: The font style name (e.g., "regular", "bold", "italic", "underline") size: Font size in points color: Optional color parameter. If not provided, defaults to black (0,0,0,255)

func (FontStyle) AndNot added in v0.0.80

func (fs FontStyle) AndNot(other FontStyle) FontStyle

Bitwise operations for FontStyle

func (FontStyle) BitwiseAnd added in v0.0.80

func (fs FontStyle) BitwiseAnd(other FontStyle) FontStyle

BitwiseAnd implements the & operator for FontStyle

func (FontStyle) Equals added in v0.0.80

func (fs FontStyle) Equals(other FontStyle) bool

Equals checks if two FontStyle values are equal based on their intStyle

func (FontStyle) GetColor added in v0.0.80

func (fs FontStyle) GetColor() style.Color

GetColor returns the font color

func (FontStyle) GetFamily added in v0.0.80

func (fs FontStyle) GetFamily() string

GetFamily returns the font family name

func (FontStyle) GetIntStyle added in v0.0.80

func (fs FontStyle) GetIntStyle() int

GetIntStyle returns the integer style value

func (FontStyle) GetName added in v0.0.80

func (fs FontStyle) GetName() string

GetName returns the name of the font style

func (FontStyle) GetSize added in v0.0.80

func (fs FontStyle) GetSize() float64

GetSize returns the font size

func (*FontStyle) SetColor added in v0.0.80

func (fs *FontStyle) SetColor(color style.Color)

SetColor sets the font color

func (*FontStyle) SetFamily added in v0.0.80

func (fs *FontStyle) SetFamily(family string)

SetFamily sets the font family name

func (*FontStyle) SetIntStyle added in v0.0.80

func (fs *FontStyle) SetIntStyle(intStyle int)

SetIntStyle sets the integer style value

func (*FontStyle) SetName added in v0.0.80

func (fs *FontStyle) SetName(name string)

SetName sets the name of the font style

func (*FontStyle) SetSize added in v0.0.80

func (fs *FontStyle) SetSize(size float64)

SetSize sets the font size

func (FontStyle) WithColor added in v0.0.80

func (fs FontStyle) WithColor(color style.Color) FontStyle

WithColor returns a copy of this style with the specified color

func (FontStyle) WithSize added in v0.0.80

func (fs FontStyle) WithSize(size float64) FontStyle

WithSize returns a copy of this style with the specified size

type TextStyle

type TextStyle struct {
	// contains filtered or unexported fields
}

TextStyle defines the style configuration for different text sections

func NewTextStyle added in v0.0.80

func NewTextStyle(fontStyle FontStyle, lineSpacing float64, alignment Alignment, spaceBefore, spaceAfter float64) TextStyle

NewTextStyle creates a new TextStyle with all properties

func (TextStyle) GetAlignment added in v0.0.80

func (ts TextStyle) GetAlignment() Alignment

GetAlignment returns the text alignment

func (TextStyle) GetFontStyle added in v0.0.80

func (ts TextStyle) GetFontStyle() FontStyle

GetFontStyle returns the FontStyle

func (TextStyle) GetLineSpacing added in v0.0.80

func (ts TextStyle) GetLineSpacing() float64

GetLineSpacing returns the line spacing

func (TextStyle) GetSpaceAfter added in v0.0.80

func (ts TextStyle) GetSpaceAfter() float64

GetSpaceAfter returns the space after the text

func (TextStyle) GetSpaceBefore added in v0.0.80

func (ts TextStyle) GetSpaceBefore() float64

GetSpaceBefore returns the space before the text

func (*TextStyle) SetAlignment added in v0.0.80

func (ts *TextStyle) SetAlignment(alignment Alignment)

SetAlignment sets the text alignment

func (*TextStyle) SetFontStyle added in v0.0.80

func (ts *TextStyle) SetFontStyle(fontStyle FontStyle)

SetFontStyle sets the FontStyle

func (*TextStyle) SetLineSpacing added in v0.0.80

func (ts *TextStyle) SetLineSpacing(lineSpacing float64)

SetLineSpacing sets the line spacing

func (*TextStyle) SetSpaceAfter added in v0.0.80

func (ts *TextStyle) SetSpaceAfter(spaceAfter float64)

SetSpaceAfter sets the space after the text

func (*TextStyle) SetSpaceBefore added in v0.0.80

func (ts *TextStyle) SetSpaceBefore(spaceBefore float64)

SetSpaceBefore sets the space before the text

type TextStyles

type TextStyles struct {
	// contains filtered or unexported fields
}

TextStyles represents different font configurations for document sections. This was previously named FontConfig in docFont.go.

func DefaultTextConfig added in v0.0.79

func DefaultTextConfig() TextStyles

DefaultTextStyles returns word-processor like defaults

func (*TextStyles) GetChartAxisLabel added in v0.0.79

func (ts *TextStyles) GetChartAxisLabel() TextStyle

GetChartAxisLabel returns the chart axis label text style

func (*TextStyles) GetChartLabel added in v0.0.79

func (ts *TextStyles) GetChartLabel() TextStyle

GetChartLabel returns the chart label text style

func (*TextStyles) GetFontFamily added in v0.0.79

func (ts *TextStyles) GetFontFamily() FontFamily

GetFontFamily returns the font family configuration

func (*TextStyles) GetFootnote added in v0.0.79

func (ts *TextStyles) GetFootnote() TextStyle

GetFootnote returns the footnote text style

func (*TextStyles) GetHeader1 added in v0.0.79

func (ts *TextStyles) GetHeader1() TextStyle

GetHeader1 returns the header1 text style

func (*TextStyles) GetHeader2 added in v0.0.79

func (ts *TextStyles) GetHeader2() TextStyle

GetHeader2 returns the header2 text style

func (*TextStyles) GetHeader3 added in v0.0.79

func (ts *TextStyles) GetHeader3() TextStyle

GetHeader3 returns the header3 text style

func (*TextStyles) GetNormal added in v0.0.79

func (ts *TextStyles) GetNormal() TextStyle

GetNormal returns the normal text style

func (*TextStyles) GetPageFooter added in v0.0.79

func (ts *TextStyles) GetPageFooter() TextStyle

GetPageFooter returns the page footer text style

func (*TextStyles) GetPageHeader added in v0.0.79

func (ts *TextStyles) GetPageHeader() TextStyle

GetPageHeader returns the page header text style

func (*TextStyles) LoadFonts added in v0.0.79

func (ts *TextStyles) LoadFonts(pdf pdfEngine) error

LoadFonts prepares and loads the font family using the provided engine. This method centralizes font loading logic within TextStyles.

func (*TextStyles) SetChartAxisLabel added in v0.0.79

func (ts *TextStyles) SetChartAxisLabel(style TextStyle)

SetChartAxisLabel sets the chart axis label text style

func (*TextStyles) SetChartLabel added in v0.0.79

func (ts *TextStyles) SetChartLabel(style TextStyle)

SetChartLabel sets the chart label text style

func (*TextStyles) SetDefaultTextConfig added in v0.0.79

func (ts *TextStyles) SetDefaultTextConfig(pdf pdfEngine)

SetDefaultTextConfig applies the normal text style

func (*TextStyles) SetFontFamily added in v0.0.79

func (ts *TextStyles) SetFontFamily(fontFamily FontFamily)

SetFontFamily sets the font family configuration

func (*TextStyles) SetFootnote added in v0.0.79

func (ts *TextStyles) SetFootnote(style TextStyle)

SetFootnote sets the footnote text style

func (*TextStyles) SetHeader1 added in v0.0.79

func (ts *TextStyles) SetHeader1(style TextStyle)

SetHeader1 sets the header1 text style

func (*TextStyles) SetHeader2 added in v0.0.79

func (ts *TextStyles) SetHeader2(style TextStyle)

SetHeader2 sets the header2 text style

func (*TextStyles) SetHeader3 added in v0.0.79

func (ts *TextStyles) SetHeader3(style TextStyle)

SetHeader3 sets the header3 text style

func (*TextStyles) SetNormal added in v0.0.79

func (ts *TextStyles) SetNormal(style TextStyle)

SetNormal sets the normal text style

func (*TextStyles) SetPageFooter added in v0.0.79

func (ts *TextStyles) SetPageFooter(style TextStyle)

SetPageFooter sets the page footer text style

func (*TextStyles) SetPageHeader added in v0.0.79

func (ts *TextStyles) SetPageHeader(style TextStyle)

SetPageHeader sets the page header text style

Jump to

Keyboard shortcuts

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