summaryrefslogtreecommitdiff
path: root/fpdf.go
diff options
context:
space:
mode:
Diffstat (limited to 'fpdf.go')
-rw-r--r--fpdf.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/fpdf.go b/fpdf.go
index da5ddec..cc1aff3 100644
--- a/fpdf.go
+++ b/fpdf.go
@@ -666,16 +666,11 @@ func (f *Fpdf) GetStringWidth(s string) float64 {
return 0
}
w := 0
- count := rune(len(f.currentFont.Cw))
- for _, ch := range s {
- if ch < count {
- w += f.currentFont.Cw[ch]
- } else {
- if f.err == nil {
- f.err = fmt.Errorf("Unicode strings not supported")
- }
- return 0
+ for _, ch := range []byte(s) {
+ if ch == 0 {
+ break
}
+ w += f.currentFont.Cw[ch]
}
return float64(w) * f.fontSize / 1000
}