# HG changeset patch # User John W. Eaton # Date 1404244560 14400 # Node ID 625e3bb65885db18b1821b8b6c2c0e46409b3c05 # Parent a5add7b660acd575fb204161c9993daa9abd3e34 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 -r a5add7b660ac -r 625e3bb65885 configure.ac --- 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 diff -r a5add7b660ac -r 625e3bb65885 libgui/qterminal/libqterminal/unix/TerminalView.cpp --- 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); diff -r a5add7b660ac -r 625e3bb65885 m4/acinclude.m4 --- 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::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?