From 5050243a8fdfd7329d6413b856d7e557e9ffbf3d Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Tue, 18 Jun 2019 15:46:40 +0300 Subject: WriteAligned: use SplitText for UTF-8 --- fpdf.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fpdf.go b/fpdf.go index 3e4188c..4f562ae 100644 --- a/fpdf.go +++ b/fpdf.go @@ -2802,7 +2802,15 @@ func (f *Fpdf) WriteAligned(width, lineHeight float64, textStr, alignStr string) width = pageWidth - (lMargin + rMargin) } - lines := f.SplitLines([]byte(textStr), width) + var lines []string + + if f.isCurrentUTF8 { + lines = f.SplitText(textStr, width) + } else { + for _, line := range f.SplitLines([]byte(textStr), width) { + lines = append(lines, string(line)) + } + } for _, lineBt := range lines { lineStr := string(lineBt) -- cgit v1.2.1-24-ge1ad