Skip to content

Commit

Permalink
Widgets: Allow to set a delta when setting size font in WebView
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Aug 28, 2024
1 parent e6597a9 commit 4022f62
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions spyder/widgets/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,20 +296,23 @@ def get_number_matches(self, pattern, source_text='', case=False,

return number_matches

def set_font(self, font, fixed_font=None):
def set_font(self, font, fixed_font=None, size_delta=0):
font = QFontInfo(font)
settings = self.page().settings()

for fontfamily in (QWebEngineSettings.FontFamily.StandardFont,
QWebEngineSettings.FontFamily.SerifFont,
QWebEngineSettings.FontFamily.SansSerifFont,
QWebEngineSettings.FontFamily.CursiveFont,
QWebEngineSettings.FontFamily.FantasyFont):
settings.setFontFamily(fontfamily, font.family())

if fixed_font is not None:
settings.setFontFamily(
QWebEngineSettings.FontFamily.FixedFont, fixed_font.family()
)
size = font.pixelSize()

size = font.pixelSize() + size_delta
settings.setFontSize(QWebEngineSettings.FontSize.DefaultFontSize, size)
settings.setFontSize(
QWebEngineSettings.FontSize.DefaultFixedFontSize, size
Expand Down

0 comments on commit 4022f62

Please sign in to comment.