src/reportlab/lib/rl_accel.py
branchpy33
changeset 3873 73d4262b7edd
parent 3872 9ee4c5e02995
child 3879 991bbd763dbc
--- a/src/reportlab/lib/rl_accel.py	Mon Dec 02 10:42:16 2013 +0000
+++ b/src/reportlab/lib/rl_accel.py	Mon Dec 02 12:15:00 2013 +0000
@@ -109,8 +109,8 @@
 if 'instanceStringWidthTTF' in _py_funcs:
     def instanceStringWidthTTF(self, text, size, encoding='utf-8'):
         "Calculate text width"
-        if not isinstance(text,str):
-            text = str(text, encoding or 'utf-8')   # encoding defaults to utf-8
+        if not isUnicode(text):
+            text = text.decode(encoding or 'utf-8')
         g = self.face.charWidths.get
         dw = self.face.defaultWidth
         return 0.001*size*sum([g(ord(u),dw) for u in text])