changeset 18973:625e3bb65885 stable

don't require Qt 4.7 (bug #42657) * acinclude.m4 (OCTAVE_CHECK_QFONT_FORCE_INTEGER_METRICS): New macro. * configure.ac: Use it. * unix/TerminalView.cpp (TerminalView::setVTFont): Only use QFont::ForceIntegerMetrics if it is available.
author John W. Eaton <jwe@octave.org>
date Tue, 01 Jul 2014 15:56:00 -0400
parents a5add7b660ac
children d8abf813c69f
files configure.ac libgui/qterminal/libqterminal/unix/TerminalView.cpp m4/acinclude.m4
diffstat 3 files changed, 30 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Sat Jul 26 07:50:38 2014 -0700
+++ b/configure.ac	Tue Jul 01 15:56:00 2014 -0400
@@ -2768,6 +2768,7 @@
 
   if test $build_gui = yes; then
     OCTAVE_CHECK_QFONT_MONOSPACE
+    OCTAVE_CHECK_QFONT_FORCE_INTEGER_METRICS
     OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT
   fi
 
--- a/libgui/qterminal/libqterminal/unix/TerminalView.cpp	Sat Jul 26 07:50:38 2014 -0700
+++ b/libgui/qterminal/libqterminal/unix/TerminalView.cpp	Tue Jul 01 15:56:00 2014 -0400
@@ -212,8 +212,11 @@
       // Disabling kerning saves some computation when rendering text.
       // font.setKerning(false);
 
-      font.setStyleStrategy (  QFont::StyleStrategy(font.styleStrategy()
-                             | QFont::ForceIntegerMetrics)  );
+      QFont::StyleStrategy strategy = font.styleStrategy();
+#if defined (HAVE_QFONT_FORCE_INTEGER_METRICS)
+      strategy |= QFont::ForceIntegerMetrics;
+#endif
+      font.setStyleStrategy(QFont::StyleStrategy(strategy));
 
       QWidget::setFont(font);
       fontChange(font);
--- a/m4/acinclude.m4	Sat Jul 26 07:50:38 2014 -0700
+++ b/m4/acinclude.m4	Tue Jul 01 15:56:00 2014 -0400
@@ -383,6 +383,30 @@
   fi
 ])
 dnl
+dnl Check whether Qt provides QFont::ForceIntegerMetrics
+dnl
+AC_DEFUN([OCTAVE_CHECK_QFONT_FORCE_INTEGER_METRICS], [
+  AC_CACHE_CHECK([whether Qt provides QFont::ForceIntegerMetrics],
+    [octave_cv_decl_qfont_force_integer_metrics],
+    [AC_LANG_PUSH(C++)
+    ac_octave_save_CPPFLAGS="$CPPFLAGS"
+    CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+        #include <QFont>
+        ]], [[
+        QFont::StyleStrategy strategy = QFont::ForceIntegerMetrics;
+        ]])],
+      octave_cv_decl_qfont_force_integer_metrics=yes,
+      octave_cv_decl_qfont_force_integer_metrics=no)
+    CPPFLAGS="$ac_octave_save_CPPFLAGS"
+    AC_LANG_POP(C++)
+  ])
+  if test $octave_cv_decl_qfont_force_integer_metrics = yes; then
+    AC_DEFINE(HAVE_QFONT_FORCE_INTEGER_METRICS, 1,
+      [Define to 1 if Qt provides QFont::ForceIntegerMetrics.])
+  fi
+])
+dnl
 dnl Check whether Qscintilla SetPlaceholderText function exists.
 dnl FIXME: This test uses a version number.  It potentially could
 dnl        be re-written to actually call the function, but is it worth it?