def stringWidth(self, s, font=None): "Return the logical width of the string if it were drawn \ in the current font (defaults to self.font)." if not font: font = self.defaultFont fontname = self._findPostScriptFontName(font) return pdfmetrics.stringwidth(s, fontname) * font.size * 0.001
def stringWidth(self, text, fontname, fontsize): "gets width of a string in the given font and size" return pdfmetrics.stringwidth(text, fontname) * 0.001 * fontsize