Skip to content

Commit

Permalink
font: Add filename attribute to Freetype fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
benmoran56 committed Dec 20, 2022
1 parent 1489d8d commit 96195f6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pyglet/font/freetype.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def __init__(self, name, size, bold=False, italic=False, stretch=False, dpi=None
self.size = size
self.bold = bold
self.italic = italic
self.dpi = dpi or 96 # as of pyglet 1.1; pyglet 1.0 had 72.
self.dpi = dpi or 96

self._load_font_face()
self.metrics = self.face.get_font_metrics(self.size, self.dpi)
Expand Down Expand Up @@ -213,7 +213,9 @@ def _load_font_face(self):
def _load_font_face_from_system(self):
match = get_fontconfig().find_font(self._name, self.size, self.bold, self.italic)
if not match:
raise base.FontException('Could not match font "%s"' % self._name)
raise base.FontException(f"Could not match font '{self._name}'")
self.filename = match.file
print(match)
self.face = FreeTypeFace.from_fontconfig(match)

@classmethod
Expand Down

0 comments on commit 96195f6

Please sign in to comment.