Skip to content

Commit

Permalink
Fix mangled fonts in script editors
Browse files Browse the repository at this point in the history
Don't override default font letter spacing or stretch -- it's not
safe to do because the results are very dependent on the individual
font's appearance and rendering hints.

Fixes #20349

(cherry picked from commit ea9d5bb)
  • Loading branch information
nyalldawson committed Nov 6, 2018
1 parent 34eb99d commit 4cd82a2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 0 additions & 2 deletions python/plugins/db_manager/sqledit.py
Expand Up @@ -107,8 +107,6 @@ def setCommonOptions(self):
self.defaultFont.setFixedPitch(True)
self.defaultFont.setPointSize(fontSize)
self.defaultFont.setStyleHint(QFont.TypeWriter)
self.defaultFont.setStretch(QFont.SemiCondensed)
self.defaultFont.setLetterSpacing(QFont.PercentageSpacing, 87.0)
self.defaultFont.setBold(False)

self.boldFont = QFont(self.defaultFont)
Expand Down
6 changes: 2 additions & 4 deletions python/plugins/processing/script/ScriptEdit.py
Expand Up @@ -62,7 +62,7 @@ class ScriptEdit(QsciScintilla):
FOLD_COLOR = "#efefef"

def __init__(self, parent=None):
QsciScintilla.__init__(self, parent)
super().__init__(parent)

self.lexer = None
self.api = None
Expand Down Expand Up @@ -128,7 +128,7 @@ def setCommonOptions(self):
self.setTabWidth(4)
self.setIndentationGuides(True)

# Autocomletion
# Autocompletion
self.setAutoCompletionThreshold(2)
self.setAutoCompletionSource(QsciScintilla.AcsAPIs)

Expand All @@ -145,8 +145,6 @@ def setFonts(self, size):
self.defaultFont.setFixedPitch(True)
self.defaultFont.setPointSize(fontSize)
self.defaultFont.setStyleHint(QFont.TypeWriter)
self.defaultFont.setStretch(QFont.SemiCondensed)
self.defaultFont.setLetterSpacing(QFont.PercentageSpacing, 87.0)
self.defaultFont.setBold(False)

self.boldFont = QFont(self.defaultFont)
Expand Down
2 changes: 0 additions & 2 deletions src/gui/qgscodeeditor.cpp
Expand Up @@ -178,8 +178,6 @@ QFont QgsCodeEditor::getMonospaceFont()
font.setFixedPitch( true );
font.setPointSize( fontSize );
font.setStyleHint( QFont::TypeWriter );
font.setStretch( QFont::SemiCondensed );
font.setLetterSpacing( QFont::PercentageSpacing, 87.0 );
font.setBold( false );
return font;
}

0 comments on commit 4cd82a2

Please sign in to comment.