From f571d089196f3a7d908a890ba30472b6373b7c8b Mon Sep 17 00:00:00 2001 From: Piotr Date: Fri, 8 Mar 2024 10:43:47 +0100 Subject: [PATCH] set sans font in report (#714) --- supervised/base_automl.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/supervised/base_automl.py b/supervised/base_automl.py index da473d32..e06d15c1 100644 --- a/supervised/base_automl.py +++ b/supervised/base_automl.py @@ -47,17 +47,6 @@ from supervised.utils.metric import Metric, UserDefinedEvalMetric from supervised.utils.utils import dump_data, load_data -try: - import matplotlib.font_manager as font_manager - - # Get a list of all font families available on the system - font_families = font_manager.findSystemFonts() - - # Load the font file for the first font family in the list and get the name of the first font family - REPORT_FONT = font_manager.FontProperties(fname=font_families[0]).get_name() -except Exception: - REPORT_FONT = "Arial" - logger = logging.getLogger(__name__) logger.setLevel(LOG_LEVEL) @@ -2281,7 +2270,7 @@ def from_json(self, json_data): .styled-table {{ border-collapse: collapse; font-size: 0.9em; - font-family:Courier New; + font-family: Courier New; }} .styled-table td, .styled-table th {{ @@ -2302,8 +2291,7 @@ def from_json(self, json_data): }} body {{ - font-family: {REPORT_FONT}; - font-size: 1.0em; + font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; background-color: rgba(236, 243, 249, 0.15); }} @@ -2404,7 +2392,7 @@ def _md_to_html(self, md_fname, page_type, dir_path, me=None): beginning = "" - if page_type == "main": + if page_type == "automl-report-main": beginning += """\n\n""" if os.path.exists(os.path.join(self._results_path, "optuna/README.md")):