summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdf.go12
-rw-r--r--fpdf_test.go2
2 files changed, 7 insertions, 7 deletions
diff --git a/fpdf.go b/fpdf.go
index ceb6beb..7859467 100644
--- a/fpdf.go
+++ b/fpdf.go
@@ -2107,7 +2107,7 @@ func (f *Fpdf) Text(x, y float64, txtStr string) {
var txt2 string
if f.isCurrentUTF8 {
if f.isRTL {
- txtStr = revertText(txtStr)
+ txtStr = reverseText(txtStr)
x -= f.GetStringWidth(txtStr)
}
txt2 = f.escape(utf8toutf16(txtStr, false))
@@ -2299,7 +2299,7 @@ func (f *Fpdf) CellFormat(w, h float64, txtStr, borderStr string, ln int,
//If multibyte, Tw has no effect - do word spacing using an adjustment before each space
if (f.ws != 0 || alignStr == "J") && f.isCurrentUTF8 { // && f.ws != 0
if f.isRTL {
- txtStr = revertText(txtStr)
+ txtStr = reverseText(txtStr)
}
wmax := int(math.Ceil((w - 2*f.cMargin) * 1000 / f.fontSize))
for _, uni := range []rune(txtStr) {
@@ -2324,7 +2324,7 @@ func (f *Fpdf) CellFormat(w, h float64, txtStr, borderStr string, ln int,
var txt2 string
if f.isCurrentUTF8 {
if f.isRTL {
- txtStr = revertText(txtStr)
+ txtStr = reverseText(txtStr)
}
txt2 = f.escape(utf8toutf16(txtStr, false))
for _, uni := range []rune(txtStr) {
@@ -2370,12 +2370,12 @@ func (f *Fpdf) CellFormat(w, h float64, txtStr, borderStr string, ln int,
}
// Revert string to use in RTL languages
-func revertText(text string) string {
+func reverseText(text string) string {
oldText := []rune(text)
newText := make([]rune, len(oldText))
- lenght := len(oldText) - 1
+ length := len(oldText) - 1
for i, r := range oldText {
- newText[lenght-i] = r
+ newText[length-i] = r
}
return string(newText)
}
diff --git a/fpdf_test.go b/fpdf_test.go
index 6042fab..4c1fc05 100644
--- a/fpdf_test.go
+++ b/fpdf_test.go
@@ -2389,7 +2389,7 @@ func ExampleFpdf_SubWrite() {
// ExampleFpdf_SetPage demomstrates the SetPage() method, allowing content
// generation to be deferred until all pages have been added.
func ExampleFpdf_SetPage() {
- rnd := rand.New(rand.NewSource(0)) // Make reproducable documents
+ rnd := rand.New(rand.NewSource(0)) // Make reproducible documents
pdf := gofpdf.New("L", "cm", "A4", "")
pdf.SetFont("Times", "", 12)