Skip to content
Permalink
Browse files

Fix mangled fonts in script editors

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 4, 2018
1 parent 34eb99d commit 4cd82a289dce57b1252c4d9d7f768dde4d1b6559
@@ -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)
@@ -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
@@ -128,7 +128,7 @@ def setCommonOptions(self):
self.setTabWidth(4)
self.setIndentationGuides(True)

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

@@ -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)
@@ -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.
You can’t perform that action at this time.