summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Seletskiy <s.seletskiy@gmail.com>2019-06-18 15:46:40 +0300
committerStanislav Seletskiy <s.seletskiy@gmail.com>2019-06-18 15:46:40 +0300
commit5050243a8fdfd7329d6413b856d7e557e9ffbf3d (patch)
tree8a71b94fa96002576e5f3beb0e57a105cd419557
parent8060f8371088d63b5935a6eeb617328705387ace (diff)
WriteAligned: use SplitText for UTF-8
-rw-r--r--fpdf.go10
1 files changed, 9 insertions, 1 deletions
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)