From f962253f4e0f895d16e1cbd985741a9605b3a288 Mon Sep 17 00:00:00 2001 From: Robert Richer Date: Sun, 8 Jan 2023 13:43:10 +0100 Subject: [PATCH] updated docstring --- fau_colors/__init__.py | 2 +- fau_colors/fonts.py | 8 +++++++- pyproject.toml | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fau_colors/__init__.py b/fau_colors/__init__.py index c1b49be..b30ab26 100644 --- a/fau_colors/__init__.py +++ b/fau_colors/__init__.py @@ -1,4 +1,4 @@ -__version__ = "1.4.2" +__version__ = "1.4.3" from fau_colors._utils import export_as_gpl from fau_colors.fonts import register_fausans_font diff --git a/fau_colors/fonts.py b/fau_colors/fonts.py index 57e196f..913feff 100644 --- a/fau_colors/fonts.py +++ b/fau_colors/fonts.py @@ -1,6 +1,7 @@ from pathlib import Path from matplotlib import font_manager +from matplotlib import pyplot as plt def register_fausans_font(): @@ -28,11 +29,16 @@ def register_fausans_font(): ] for path in possible_paths: if path.exists(): + # check if font is already registered + if "FAUSans Office" in font_manager.fontManager.get_font_names(): + plt.rcParams["font.family"] = "sans-serif" + plt.rcParams["font.sans-serif"] = "FAUSans Office" + return font_manager.fontManager.addfont(path) print( "Successfully registered FAU Sans font. " "You can now use it in matplotlib by adding the following lines to your code:\n\n" - 'plt.rcParams["font.family"] = "sans-serif"' + 'plt.rcParams["font.family"] = "sans-serif"\n' 'plt.rcParams["font.sans-serif"] = "FAUSans Office"' ) return diff --git a/pyproject.toml b/pyproject.toml index 9708d7a..9549141 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "fau_colors" -version = "1.4.2" +version = "1.4.3" description = "The official colors of FAU as matplotlib/seaborn colormaps" authors = [ "Robert Richer ",