Documentation
¶
Overview ¶
Package config contains configuration structures for docpdf.
Index ¶
- Constants
- type Alignment
- type FontFamily
- type FontIntStyle
- type TextStyle
- type TextStyles
- func (ts *TextStyles) GetChartAxisLabel() TextStyle
- func (ts *TextStyles) GetChartLabel() TextStyle
- func (ts *TextStyles) GetFontFamily() FontFamily
- func (ts *TextStyles) GetFootnote() TextStyle
- func (ts *TextStyles) GetHeader1() TextStyle
- func (ts *TextStyles) GetHeader2() TextStyle
- func (ts *TextStyles) GetHeader3() TextStyle
- func (ts *TextStyles) GetNormal() TextStyle
- func (ts *TextStyles) GetPageFooter() TextStyle
- func (ts *TextStyles) GetPageHeader() TextStyle
- func (ts *TextStyles) LoadFonts(pdf pdfEngine) error
- func (ts *TextStyles) SetChartAxisLabel(style TextStyle)
- func (ts *TextStyles) SetChartLabel(style TextStyle)
- func (ts *TextStyles) SetDefaultTextConfig(pdf pdfEngine)
- func (ts *TextStyles) SetFontFamily(fontFamily FontFamily)
- func (ts *TextStyles) SetFootnote(style TextStyle)
- func (ts *TextStyles) SetHeader1(style TextStyle)
- func (ts *TextStyles) SetHeader2(style TextStyle)
- func (ts *TextStyles) SetHeader3(style TextStyle)
- func (ts *TextStyles) SetNormal(style TextStyle)
- func (ts *TextStyles) SetPageFooter(style TextStyle)
- func (ts *TextStyles) SetPageHeader(style TextStyle)
Constants ¶
const ( FontRegular = "regular" FontBold = "bold" FontItalic = "italic" FontUnderline = "underline" )
Variables ¶
This section is empty.
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 FontIntStyle ¶
type FontIntStyle int
FontIntStyle represents font styles as integer constants This was previously named FontStyle in docFont.go. eg: FontStyleBold = 2 (000010), FontStyleItalic = 1 (000001), etc.
const FontStyleBold FontIntStyle = 2 //000010
Bold - font style bold
const FontStyleItalic FontIntStyle = 1 //000001
Italic - font style italic
const FontStyleRegular FontIntStyle = 0 //000000
regular - font style regular
const FontStyleUnderline FontIntStyle = 3 //000011
Underline - font style underline
func GetFontStyleInIntFormat ¶
func GetFontStyleInIntFormat(fontStyle string) (style FontIntStyle)
GetFontStyleInIntFormat converts a string font style to its integer representation eg: "B" => FontStyleBold, "I" => FontStyleItalic, "U" => FontStyleUnderline defaults to FontStyleRegular if no valid style is found
type TextStyle ¶
type TextStyle struct {
Size float64
Color style.Color
LineSpacing float64
Alignment Alignment
SpaceBefore float64
SpaceAfter float64
FontStyle FontIntStyle // Renamed from Style for clarity
}
TextStyle defines the style configuration for different text sections
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