Skip to content

Commit

Permalink
Use Python editor font and size for code editor
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Feb 5, 2015
1 parent 9de6ae9 commit f6d6c69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
29 changes: 10 additions & 19 deletions src/gui/qgscodeeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,16 @@ bool QgsCodeEditor::isFixedPitch( const QFont& font )

QFont QgsCodeEditor::getMonospaceFont()
{
QFont font( "monospace" );
if ( isFixedPitch( font ) )
{
return font;
}
font.setStyleHint( QFont::Monospace );
if ( isFixedPitch( font ) )
{
return font;
}
QSettings settings;
QString loadFont = settings.value( "pythonConsole/fontfamilytextEditor", "Monospace" ).toString();
int fontSize = settings.value( "pythonConsole/fontsizeEditor", 10 ).toInt();

QFont font( loadFont );
font.setFixedPitch( true );
font.setPointSize( fontSize );
font.setStyleHint( QFont::TypeWriter );
if ( isFixedPitch( font ) )
{
return font;
}
font.setFamily( "courier" );
if ( isFixedPitch( font ) )
{
return font;
}
font.setStretch( QFont::SemiCondensed );
font.setLetterSpacing( QFont::PercentageSpacing, 87.0 );
font.setBold( false );
return font;
}
1 change: 0 additions & 1 deletion src/gui/qgscodeeditorpython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ void QgsCodeEditorPython::setSciLexerPython()
setWhitespaceVisibility( QsciScintilla::WsVisibleAfterIndent );

QFont font = getMonospaceFont();
font.setPointSize( 10 );

QsciLexerPython* pyLexer = new QsciLexerPython();
pyLexer->setDefaultFont( font );
Expand Down

0 comments on commit f6d6c69

Please sign in to comment.