Le 14/04/2016 17:18, Joel Kulesza a écrit :
On Thu, Apr 14, 2016 at 10:24 AM, Guillaume Munch <g...@lyx.org
<mailto:g...@lyx.org>> wrote:


    Can you please try the attached patch?


That patch seemed to work to correct the issue in both places (see
attached). The font seems small (I'm not sure if that's perception or
reality).  Regardless, it _is_ fixed width.  Thank you!

The font size did not change... Can you change it externally from your system settings?

Here's a cleaned-up patch that I will recommend for inclusion if successful. Can you please try it?
>From 959d6fc0a945f09fc383f86d915b2f29e5002117 Mon Sep 17 00:00:00 2001
From: Guillaume Munch <g...@lyx.org>
Date: Thu, 14 Apr 2016 15:22:26 +0100
Subject: [PATCH] Fix monospace fonts in the source panel and preamble on Mac

http://mid.gmane.org/caagogw97a-j9zxy6sdrj-g_-zewdz+fstkgudsso3udx3tp...@mail.gmail.com
---
 src/frontends/qt4/GuiDocument.cpp   | 4 ++++
 src/frontends/qt4/GuiViewSource.cpp | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp
index e4dff1d..f76c3fe 100644
--- a/src/frontends/qt4/GuiDocument.cpp
+++ b/src/frontends/qt4/GuiDocument.cpp
@@ -453,9 +453,13 @@ PreambleModule::PreambleModule() : current_id_(0)
 	// This is not a memory leak. The object will be destroyed
 	// with this.
 	(void) new LaTeXHighlighter(preambleTE->document());
+#if QT_VERSION >= 0x050200
+	QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
+#else
 	QFont font(guiApp->typewriterFontName());
 	font.setFixedPitch(true);
 	font.setStyleHint(QFont::TypeWriter);
+#endif
 	preambleTE->setFont(font);
 	preambleTE->setWordWrapMode(QTextOption::NoWrap);
 	setFocusProxy(preambleTE);
diff --git a/src/frontends/qt4/GuiViewSource.cpp b/src/frontends/qt4/GuiViewSource.cpp
index e528222..8506fb4 100644
--- a/src/frontends/qt4/GuiViewSource.cpp
+++ b/src/frontends/qt4/GuiViewSource.cpp
@@ -86,9 +86,13 @@ ViewSourceWidget::ViewSourceWidget()
 	viewSourceTV->setReadOnly(true);
 	///dialog_->viewSourceTV->setAcceptRichText(false);
 	// this is personal. I think source code should be in fixed-size font
+#if QT_VERSION >= 0x050200
+	QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
+#else
 	QFont font(guiApp->typewriterFontName());
 	font.setFixedPitch(true);
 	font.setStyleHint(QFont::TypeWriter);
+#endif
 	viewSourceTV->setFont(font);
 	// again, personal taste
 	viewSourceTV->setWordWrapMode(QTextOption::NoWrap);
-- 
2.1.4

Reply via email to