# HG changeset patch # User John W. Eaton # Date 1404244560 14400 # Tue Jul 01 15:56:00 2014 -0400 # Branch stable # Node ID 7675988a8485ac2aa41c0cd7078f1278b2bbed22 # Parent ed41db0317524c7c45e12dfde8827cf40dca6555 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. diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/libgui/qterminal/libqterminal/unix/TerminalView.cpp b/libgui/qterminal/libqterminal/unix/TerminalView.cpp --- a/libgui/qterminal/libqterminal/unix/TerminalView.cpp +++ b/libgui/qterminal/libqterminal/unix/TerminalView.cpp @@ -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); diff --git a/m4/acinclude.m4 b/m4/acinclude.m4 --- a/m4/acinclude.m4 +++ b/m4/acinclude.m4 @@ -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::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?