Commit 0487cafcd4457972f2cc185ae23f604b4c75ed32
1 parent
bf3ea2f8ef
Exists in
master
superscript
Showing
1 changed file
with
12 additions
and
0 deletions
Show diff stats
pdfhelper/pdf.go
... | ... | @@ -253,3 +253,15 @@ func (pdf *Helper) InsertPageNumber(x, y float64, format string) { |
253 | 253 | num := fmt.Sprintf(format, pdf.PageNo()) |
254 | 254 | pdf.Column(x, y, []FormatedCell{{10, 1, num, "DejaVuSans", "", 8, NOBORDER, LEFT}}) |
255 | 255 | } |
256 | + | |
257 | +func (pdf *Helper) WriteSuperscript( | |
258 | + txt, script string, | |
259 | + x, y float64, | |
260 | + fontFamily, fontStyle string, | |
261 | + fontSize float64) { | |
262 | + | |
263 | + scriptOffsetX := x + pdf.TextLength(txt, fontFamily, fontStyle, fontSize) | |
264 | + scriptOffsetY := y - fontSize*0.3 | |
265 | + pdf.Column(x, y, []FormatedCell{{5.0, 5.0, txt, fontFamily, fontStyle, 6, NOBORDER, LEFT}}) | |
266 | + pdf.Column(scripttxtOffset, scriptOffsetY, []FormatedCell{{5.0, 5.0, script, fontFamily, fontStyle, 6, NOBORDER, LEFT}}) | |
267 | +} | ... | ... |