summaryrefslogtreecommitdiff
path: root/fpdf.go
diff options
context:
space:
mode:
authorKurt <kurt.w.jung@gmail.com>2019-08-23 07:14:13 -0400
committerKurt <kurt.w.jung@gmail.com>2019-08-23 07:14:13 -0400
commit5336f2c016d4b1b5e9399a84aa4657d374dd5cb3 (patch)
tree371d268f5da02f5072942155c1eba9c60aaed25d /fpdf.go
parented240cb3be2b6e232a4944f9ae13cc762735e86c (diff)
parent1566d943c0e8df226a04d454b19c56832d8fdc4e (diff)
Merge branch 'joewestcott-underline'
Diffstat (limited to 'fpdf.go')
-rw-r--r--fpdf.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/fpdf.go b/fpdf.go
index d64a324..f77717f 100644
--- a/fpdf.go
+++ b/fpdf.go
@@ -202,6 +202,7 @@ func fpdfNew(orientationStr, unitStr, sizeStr, fontDirStr string, size SizeType)
f.layerInit()
f.catalogSort = gl.catalogSort
f.creationDate = gl.creationDate
+ f.userUnderlineThickness = 1
return
}
@@ -3538,10 +3539,16 @@ func blankCount(str string) (count int) {
return
}
+// SetUnderlineThickness accepts a multiplier for adjusting the text underline
+// thickness, defaulting to 1. See SetUnderlineThickness example.
+func (f *Fpdf) SetUnderlineThickness(thickness float64) {
+ f.userUnderlineThickness = thickness
+}
+
// Underline text
func (f *Fpdf) dounderline(x, y float64, txt string) string {
up := float64(f.currentFont.Up)
- ut := float64(f.currentFont.Ut)
+ ut := float64(f.currentFont.Ut) * f.userUnderlineThickness
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)