Skip to content

Commit

Permalink
Merge pull request #34 from joshy/patch-1
Browse files Browse the repository at this point in the history
Change font url for default plot because of 404
  • Loading branch information
ColCarroll authored Nov 29, 2023
2 parents e149b90 + eb14e88 commit f0e1a47
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ridge_map/ridge_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class FontManager:

def __init__(
self,
github_url="https://github.com/google/fonts/blob/main/ofl/cinzel/static/Cinzel-Regular.ttf?raw=true", # pylint: disable=line-too-long
github_url="https://github.com/NDISCOVER/Cinzel/blob/master/fonts/ttf/Cinzel-Regular.ttf?raw=true", # pylint: disable=line-too-long
):
"""
Lazily download a font.
Expand All @@ -38,7 +38,7 @@ def __init__(
----------
github_url : str
Can really be any .ttf file, but probably looks like
"https://github.com/google/fonts/blob/main/ofl/cinzel/static/Cinzel-Regular.ttf?raw=true" # pylint: disable=line-too-long
"https://github.com/google/fonts/blob/5c3d8ef085f3084db38936d0dcd39a567dbc1e01/ofl/cinzel/static/Cinzel-Regular.ttf?raw=true" # pylint: disable=line-too-long
"""
self.github_url = github_url
self._prop = None
Expand All @@ -48,6 +48,7 @@ def prop(self):
"""Get matplotlib.font_manager.FontProperties object that sets the custom font."""
if self._prop is None:
with NamedTemporaryFile(delete=False, suffix=".ttf") as temp_file:
# pylint: disable=consider-using-with
temp_file.write(urlopen(self.github_url).read())
self._prop = fm.FontProperties(fname=temp_file.name)
return self._prop
Expand Down

0 comments on commit f0e1a47

Please sign in to comment.