def start_pre(self, attrs): HTMLParser.start_pre(self, attrs) new_size = AS_IS width = extract_keyword('width', attrs, 0, conv=conv_integer) if width > 0: ps = self.formatter.writer.ps space_width = ps._font.text_width(' ') pagewidth = ps.get_pagewidth() required = space_width * width if required > pagewidth: factor = pagewidth / required new_size = ps.get_fontsize() * factor self.formatter.push_font((new_size, AS_IS, AS_IS, AS_IS))