Skip to content

Commit

Permalink
Fix for Social plugin crashes when font autoloading is disabled (squi…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvoss committed Apr 28, 2024
1 parent 360bacc commit e833f63
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions material/plugins/social/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,17 @@ def _load_logo_svg(self, path, fill = None):
svg2png(bytestring = data, write_to = file, scale = 10)
return Image.open(file)

# Retrieve font
# Retrieve font either from the card layout option or from the Material
# font defintion. If no font is defined for Material or font is False
# then choose a default.
def _load_font(self, config):
name = self.config.cards_layout_options.get("font_family")
if not name:
name = config.theme.get("font", {}).get("text", "Roboto")
material_name = config.theme.get("font", False)
if material_name is False:
name = "Roboto"
else:
name = material_name.get("text", "Roboto")

# Resolve relevant fonts
font = {}
Expand Down
10 changes: 8 additions & 2 deletions src/plugins/social/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,17 @@ def _load_logo_svg(self, path, fill = None):
svg2png(bytestring = data, write_to = file, scale = 10)
return Image.open(file)

# Retrieve font
# Retrieve font either from the card layout option or from the Material
# font defintion. If no font is defined for Material or font is False
# then choose a default.
def _load_font(self, config):
name = self.config.cards_layout_options.get("font_family")
if not name:
name = config.theme.get("font", {}).get("text", "Roboto")
material_name = config.theme.get("font", False)
if material_name is False:
name = "Roboto"
else:
name = material_name.get("text", "Roboto")

# Resolve relevant fonts
font = {}
Expand Down

0 comments on commit e833f63

Please sign in to comment.