If I change the letter spacing, the result is incorrect line breaks, not at the end of the line, and the paragraph height is incorrectly calculated
Expected Behavior
Expected text to naturally within the area provided.
Actual Behavior
Steps to reproduce the behavior:
Run the provided code example
Observe the output
Attachments
Include a self-contained reproducible code snippet and PDF file that demonstrates the issue.
package main
import (
"bytes"
"github.com/unidoc/unipdf/v3/creator"
)
func main() {
c := creator.New()
c.SetPageSize(creator.PageSize{180, 90})
posX, posY := 10., 10.
p := c.NewStyledParagraph()
p.SetPos(posX, posY)
p.SetWidth(116)
chunk := p.Append("s o m e t e x t s o m e t e x t s o m e t e x t s o m e t e x t s o m e t e x t")
chunk.Style.FontSize = 6
chunk.Style.CharSpacing = 6
border := c.NewRectangle(posX, posY, p.Width(), p.Height())
border.SetBorderWidth(.3)
border.SetBorderColor(creator.ColorRed)
if err := c.Draw(border); err != nil {
panic(err)
}
if err := c.Draw(p); err != nil {
panic(err)
}
var buf bytes.Buffer
c.Write(&buf)
filestore.Save("result.pdf", &buf)
}
Description
A bug was reported via email:
Expected Behavior
Expected text to naturally within the area provided.
Actual Behavior
Steps to reproduce the behavior:
Attachments
Include a self-contained reproducible code snippet and PDF file that demonstrates the issue.
or view in the playground: https://play.unidoc.io/p/97cc1cabdc995e56