def _best_fit_font_size(self, family, max_size, bold, italic, font_file): """ Return the largest integer point size not greater than *max_size* that allows all the text in this text frame to fit inside its extents when rendered using the font described by *family*, *bold*, and *italic*. If *font_file* is specified, it is used to calculate the fit, whether or not it matches *family*, *bold*, and *italic*. """ if font_file is None: font_file = FontFiles.find(family, bold, italic) return TextFitter.best_fit_font_size(self.text, self._extents, max_size, font_file)
def _best_fit_font_size(self, family, max_size, bold, italic, font_file): """ Return the largest integer point size not greater than *max_size* that allows all the text in this text frame to fit inside its extents when rendered using the font described by *family*, *bold*, and *italic*. If *font_file* is specified, it is used to calculate the fit, whether or not it matches *family*, *bold*, and *italic*. """ if font_file is None: font_file = FontFiles.find(family, bold, italic) return TextFitter.best_fit_font_size( self.text, self._extents, max_size, font_file )
def it_can_find_a_system_font_file(self, find_fixture): family_name, is_bold, is_italic, expected_path = find_fixture path = FontFiles.find(family_name, is_bold, is_italic) assert path == expected_path