Skip to content

Commit

Permalink
Merge fix utf8 text wrapping jung-kurt#279 by seletskiy
Browse files Browse the repository at this point in the history
  • Loading branch information
jung-kurt committed Jul 18, 2019
1 parent f58a9cb commit 6ba2518
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fpdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -2800,8 +2800,8 @@ func (f *Fpdf) WriteLinkID(h float64, displayStr string, linkID int) {
func (f *Fpdf) WriteAligned(width, lineHeight float64, textStr, alignStr string) {
lMargin, _, rMargin, _ := f.GetMargins()

pageWidth, _ := f.GetPageSize()
if width == 0 {
pageWidth, _ := f.GetPageSize()
width = pageWidth - (lMargin + rMargin)
}

Expand All @@ -2819,6 +2819,7 @@ func (f *Fpdf) WriteAligned(width, lineHeight float64, textStr, alignStr string)
lineStr := string(lineBt)
lineWidth := f.GetStringWidth(lineStr)

f.SetLeftMargin(lMargin + (width - lineWidth) - 2.01*f.cMargin)
switch alignStr {
case "C":
f.SetLeftMargin(lMargin + ((width - lineWidth) / 2))
Expand All @@ -2831,6 +2832,7 @@ func (f *Fpdf) WriteAligned(width, lineHeight float64, textStr, alignStr string)
default:
f.Write(lineHeight, lineStr)
}
f.SetRightMargin(rMargin)
}
}

Expand Down

0 comments on commit 6ba2518

Please sign in to comment.