Do you think this method would be a useful addition to this library? It would allow the programmer to adjust the text underline thickness whilst still having it scale with the font size.
I'd be happy to create a PR with the following changes:
Store a new attribute on the principal struct, userUnderlineThickness, defaulting to 1.0
Create a new method named pdf.SetUnderlineThickness taking a float64. This will set f.userUnderlineThickness
Modify dounderline function on line 3477 of fpdf.go to multiply f.currentFont.Ut by f.userUnderlineThickness (line 3 below)
func (f *Fpdf) dounderline(x, y float64, txt string) string {
up := float64(f.currentFont.Up)
ut := float64(f.currentFont.Ut) * f.userUnderlineThickness // <-- this!
w := f.GetStringWidth(txt) + f.ws*float64(blankCount(txt))
return sprintf("%.2f %.2f %.2f %.2f re f", x*f.k,
(f.h-(y-up/1000*f.fontSize))*f.k, w*f.k, -ut/1000*f.fontSizePt)
}
Hiya @jung-kurt
Do you think this method would be a useful addition to this library? It would allow the programmer to adjust the text underline thickness whilst still having it scale with the font size. I'd be happy to create a PR with the following changes:
Store a new attribute on the principal struct,
userUnderlineThickness
, defaulting to1.0
Create a new method named
pdf.SetUnderlineThickness
taking afloat64
. This will setf.userUnderlineThickness
Modify
dounderline
function on line 3477 offpdf.go
to multiplyf.currentFont.Ut
byf.userUnderlineThickness
(line 3 below)Any thought, let me know. Thanks!