텍스트

자간

양수 값으로 넓은 간격, 음수 값으로 좁은 간격을 설정하여 문자 간 간격을 제어합니다.

doc := template.New(
    template.WithPageSize(document.A4),
    template.WithMargins(document.UniformEdges(document.Mm(20))),
)

page := doc.AddPage()
page.AutoRow(func(r *template.RowBuilder) {
    r.Col(12, func(c *template.ColBuilder) {
        c.Text("Letter Spacing Demo", template.FontSize(20), template.Bold())
        c.Spacer(document.Mm(8))

        c.Text("Normal spacing (0pt)")
        c.Spacer(document.Mm(3))

        c.Text("Letter spacing 1pt", template.LetterSpacing(1))
        c.Spacer(document.Mm(3))

        c.Text("Letter spacing 3pt", template.LetterSpacing(3))
        c.Spacer(document.Mm(3))

        c.Text("WIDE HEADER", template.FontSize(16), template.Bold(),
            template.LetterSpacing(5))
        c.Spacer(document.Mm(3))

        c.Text("Tight spacing -0.5pt", template.LetterSpacing(-0.5))
    })
})

텍스트 장식

밑줄, 취소선, 조합 장식.

doc := template.New(
    template.WithPageSize(document.A4),
    template.WithMargins(document.UniformEdges(document.Mm(20))),
)

page := doc.AddPage()
page.AutoRow(func(r *template.RowBuilder) {
    r.Col(12, func(c *template.ColBuilder) {
        c.Text("Text Decoration Demo", template.FontSize(20), template.Bold())
        c.Spacer(document.Mm(8))

        c.Text("Normal text without decoration")
        c.Spacer(document.Mm(4))

        c.Text("Underlined text for emphasis", template.Underline())
        c.Spacer(document.Mm(4))

        c.Text("Strikethrough text for deletions", template.Strikethrough())
        c.Spacer(document.Mm(4))

        c.Text("Combined underline and strikethrough",
            template.Underline(), template.Strikethrough())
        c.Spacer(document.Mm(4))

        c.Text("Colored underlined text",
            template.Underline(),
            template.TextColor(pdf.RGBHex(0x1565C0)),
            template.FontSize(14))
        c.Spacer(document.Mm(4))

        c.Text("Bold underlined heading",
            template.Bold(), template.Underline(), template.FontSize(16))
    })
})