Bug report #20426

Font will not resize in QGIS Print Layout

Added by Andrew Grogan-Kaylor over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:mac_os_specific
Affected QGIS version:3.4.0 Regression?:No
Operating System:Max OS Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:28246

Description

I, along with a number of students, are unable to resize the font of map titles in QGIS Print Layout. Can this be fixed? Thank you.

QGIS Print Layout Title Issue.png (388 KB) Andrew Grogan-Kaylor, 2018-11-11 06:15 PM

QGIS_3.4_fonts.mp4 - Screencast (4.43 MB) Jonas Küpper, 2018-11-20 03:06 PM

Associated revisions

Revision 930c56f5
Added by iona5 over 5 years ago

workaround broken QFontDialog on macOS with Qt5 (Fixes #20426)

QFontDialog using the native dialog is broken in some versions of
Qt5 on macOS, see
- https://bugreports.qt.io/browse/QTBUG-69878
- https://successfulsoftware.net/2018/11/02/qt-is-broken-on-macos-right-now/

this breaks QgsFontButton in ModeQFont. When opening the dialog it will
not change the format after accepting.

normally our code wouldn't use the native dialog on macOS anyway,
but due to using an outdated preprocessor check it was exhibiting
the broken behavior.

this patch restores the usage of a non-native font dialog on macOS.

discussions:
- https://issues.qgis.org/issues/20426
- https://github.com/qgis/QGIS/pull/8585

Revision 4ea8bc52
Added by iona5 over 5 years ago

workaround broken QFontDialog on macOS with Qt5 (Fixes #20426)

QFontDialog using the native dialog is broken in some versions of
Qt5 on macOS, see
- https://bugreports.qt.io/browse/QTBUG-69878
- https://successfulsoftware.net/2018/11/02/qt-is-broken-on-macos-right-now/

this breaks QgsFontButton in ModeQFont. When opening the dialog it will
not change the format after accepting.

normally our code wouldn't use the native dialog on macOS anyway,
but due to using an outdated preprocessor check it was exhibiting
the broken behavior.

this patch restores the usage of a non-native font dialog on macOS.

discussions:
- https://issues.qgis.org/issues/20426
- https://github.com/qgis/QGIS/pull/8585

(cherry picked from commit 930c56f5b85db0c452263225fb51f8bf9f2e003c)

History

#1 Updated by Nyall Dawson over 5 years ago

  • Status changed from Open to Feedback

More info please. Can you post a screencast showing the problem?

#2 Updated by Andrew Grogan-Kaylor over 5 years ago

Nyall Dawson wrote:

More info please. Can you post a screencast showing the problem?

I don't have screencasting software on the computer I'm using currently, but here is a screenshot of Print Layout with a title. Title can not be resized to larger font.

#3 Updated by Nyall Dawson over 5 years ago

You'll need to find a screencaster here. Currently there's nothing we can do to help with this report.

#4 Updated by Harrissou Santanna over 5 years ago

Maybe i'm wrong but if you expect a bigger font by enlarging the label item, you'll fail. Text font and item size are independent. You have to change font in the label item properties

#5 Updated by Jonas Küpper over 5 years ago

Hi,

i have the same problem (and managed to make a screencast - you can do this also with Quicktime Player).

The problem is basically that changes you make to fonts using "Text Format" dialog are not applied. Only when you use the dropdown menu, you can change font styles.

see the screencast for details.

Thanks
Jonas

#6 Updated by Andrew Grogan-Kaylor over 5 years ago

Thank you for making the screencast. Your screencast shows exactly the same issue that I am having.

Jonas Küpper wrote:

Hi,

i have the same problem (and managed to make a screencast - you can do this also with Quicktime Player).

The problem is basically that changes you make to fonts using "Text Format" dialog are not applied. Only when you use the dropdown menu, you can change font styles.

see the screencast for details.

Thanks
Jonas

#7 Updated by Nyall Dawson over 5 years ago

  • Category changed from Map Composer/Printing to mac_os_specific

Is this a Mac OS specific issue? I can't reproduce elsewhere.

#8 Updated by Andrew Grogan-Kaylor over 5 years ago

Yes. This may well be only a Mac OS issue. I have seen it on multiple computers, but all were Mac OS.

Nyall Dawson wrote:

Is this a Mac OS specific issue? I can't reproduce elsewhere.

#9 Updated by Nyall Dawson over 5 years ago

  • Assignee set to Denis Rouzaud

#10 Updated by Nyall Dawson over 5 years ago

  • Assignee deleted (Denis Rouzaud)

#11 Updated by Jonas Küpper over 5 years ago

hi again,
is the bug probably related to this in src/gui/qgsguiutils.cpp?

  QFont getFont( bool &ok, const QFont &initial, const QString &title )
  {
    // parent is intentionally not set to 'this' as
    // that would make it follow the style sheet font
    // see also #12233 and #4937
#if defined(Q_OS_MAC) && defined(QT_MAC_USE_COCOA)
    // Native Mac dialog works only for Qt Carbon
    return QFontDialog::getFont( &ok, initial, 0, title, QFontDialog::DontUseNativeDialog );
#else
    return QFontDialog::getFont( &ok, initial, nullptr, title );
#endif
  }

i actually managed to get QGIS compile on my mac (i am really neither a Qt nor a cmake developer) and the build does exhibit the same behavior.

my compiler environment actually evaluates to the #else part of the section which i guess is not intended?

if i apply the following patch i see a more "mac-ish" font dialog and the font is actually applied.

diff --git a/src/gui/qgsguiutils.cpp b/src/gui/qgsguiutils.cpp
index 1799d870a6..32a66d2a85 100644
--- a/src/gui/qgsguiutils.cpp
+++ b/src/gui/qgsguiutils.cpp
@@ -195,12 +195,8 @@ namespace QgsGuiUtils
     // parent is intentionally not set to 'this' as
     // that would make it follow the style sheet font
     // see also #12233 and #4937
-#if defined(Q_OS_MAC) && defined(QT_MAC_USE_COCOA)
     // Native Mac dialog works only for Qt Carbon
     return QFontDialog::getFont( &ok, initial, 0, title, QFontDialog::DontUseNativeDialog );
-#else
-    return QFontDialog::getFont( &ok, initial, nullptr, title );
-#endif
   }

   void saveGeometry( QWidget *widget, const QString &keyName )

as i am not familar with the build setup and not sure what the "correct" approach is i am leaving that here but i guess there may be a very easy fix of this very very annoying problem.

#12 Updated by Nyall Dawson over 5 years ago

See discussion at https://github.com/qgis/QGIS/pull/8585 -- the patch was tested but was unsuccessful in fixing the issue. Can you provide feedback there?

#13 Updated by Jonas Küpper over 5 years ago

i will.

#14 Updated by Anonymous over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from Feedback to Closed

Also available in: Atom PDF