Opened 11 years ago

Closed 9 years ago

#1752 closed bug (fixed)

Font label settings not working on OS X

Reported by: jctull Owned by: telwertowski
Priority: major: does not work as expected Milestone: Version 1.6.0
Component: Symbology Version: Trunk
Keywords: font label symbology Cc:
Must Fix for Release: Yes Platform: OS X
Platform Version: 10.5+ Awaiting user input: no


When changing the font settings for labels in the properties dialog for a vector layer, the font selector is brought up but changes to the fonts make no effect on the label display. Looking at the qgs file, the fonts stay on their default of Lucinda Grande 12.

Attachments (2)

qgscomposerlegendwidget.cpp (9.9 KB) - added by jctull 11 years ago.
qgscomposerlegendwidget.cpp font dialog
qgscomposerlabelwidget.cpp (2.6 KB) - added by jctull 11 years ago.
qgscomposerlabelwidget.cpp mac font dialog

Download all attachments as: .zip

Change History (21)

comment:1 Changed 11 years ago by kyngchaos

Hmm, works for me. My 1.1.0 build.

I tested with OTF, TTF (flat), PostScript? (resource fork), and dfont fonts. And both activated by placement in standard font folders and by a font manager (Linotype Fontexplorer (free)).

comment:2 Changed 11 years ago by jctull

It still is not working for me regardless of a cmake or xcode build. I am using qt-4.5.2, so I am thinking it might have something to do with Qt. Which qt are you using?

comment:3 Changed 11 years ago by kyngchaos

4.4.something. I've been holding off on 4.5 until I hear more about whether Qgis is supposed to be compatible with 4.5, or just "it should be, but...". So far I'm just hearing about issues like this one.

Are you using the standard version or the Cocoa version?

comment:4 Changed 11 years ago by jctull

I am using the carbon version. The Cocoa version had different problems that I could not get past with qgis.

comment:5 Changed 11 years ago by kyngchaos

Ah, after updating to Qt 4.5(.2), font selection now does not work for me either.

comment:6 Changed 11 years ago by jctull

Unfortunately, r11264 did not fix this problem.

comment:7 Changed 11 years ago by kyngchaos

Here's a possibility: the font selection now uses the system font dialog:


On Mac, native dialogs are now used when calling show, open, or exec on a QFileDialog, QColorDialog, QPrintDialog, or QFontDialog (i.e not only when using the static functions)

Maybe it's returning the font specification in a Mac-specific form that Qgis doesn't understand?

comment:8 Changed 11 years ago by telwertowski

Owner: changed from nobody to telwertowski

This appears to be a Qt bug. The new native Mac font dialog seems to work (for some fonts) only in 64-bit builds. The workaround is to used the old non-native font dialog for 32-bit builds.

Fixed by r11280 (workaround).

Changed 11 years ago by jctull

Attachment: qgscomposerlegendwidget.cpp added

qgscomposerlegendwidget.cpp font dialog

comment:9 Changed 11 years ago by jctull

Great work, Tom. This does get around the issue. I agree that it is probably a qt bug, which has been my hunch. I could not find anything about this on their mail lists.

The same problem exists in the map composer. I've attached the two cpp files with the necessary edits. Not sure how to create the patch file.

I was close to finding this workaround today, but gave up. I was unclear on how to call the DoNotUseNativeDialog? option and gave up. Glad to see your still keeping an eye on mac-related issues. I will look into qt-64 bit, although I hit some other problems when I tried that a month or so back that I cannot recall now.

Changed 11 years ago by jctull

Attachment: qgscomposerlabelwidget.cpp added

qgscomposerlabelwidget.cpp mac font dialog

comment:10 Changed 11 years ago by telwertowski

Attached map composer fixes submitted as r11287.

comment:11 in reply to:  9 Changed 11 years ago by jef

Resolution: fixed
Status: newclosed

Replying to jctull:

The same problem exists in the map composer. I've attached the two cpp files with the necessary edits. Not sure how to create the patch file.

svn diff >1752_osx_fontsel_composer.diff

comment:12 Changed 9 years ago by kyngchaos

Component: VectorsSymbology
Keywords: symbology added; vector removed
Milestone: Version 1.2.0Version 1.6.0
Platform Version: 10.5.710.5+
Resolution: fixed
Status: closedreopened
Summary: Vector font label settings not sticking on OS XFont label settings not working on OS X

Either it wasn't really fixed, or it's back. Reported in #3105. It goes beyond vectors (maybe this originally did, but noone noticed) -- all layout and map composer font selection seems to be affected.

Now with Qgis 1.5, Qt 4.6 Cocoa, both OSX 10.5 and 10.6.

OSX 10.6 64bit: some fonts work, some fonts snap to another when selected and/or don't display the correct font. I don't see any pattern of kinds of fonts (PS, OTF, TT, Mac) or whether they are loaded directly by the system from standard font folders or from a font manager.

OSX 10.5 32bit: same behavior as this original bug - font is selected in the font dialog, but display doesn't change and font snaps back to Lucida Grande. Though it looks like Qt 4.6 Cocoa now forces the Mac font dialog, whether or not the program asks for it (ie from r11287).

comment:13 Changed 9 years ago by kyngchaos


Also happens with trunk, OSX 10.6.

OSX 10.5 PPC Qt 4.6 Carbon: uses Qgis/Qt? font dialog and font selection seems to work.

comment:14 Changed 9 years ago by CK

Resolution: worksforme
Status: reopenedclosed

Hi, I had this and other problems after upgrading to Snow Leopard. Problem is now solved following a 'clean install' of SL. CK

comment:15 Changed 9 years ago by kyngchaos

Resolution: worksforme
Status: closedreopened

Reinstalling the system is too general, and I've tried it on a clean system.

comment:16 Changed 9 years ago by kyngchaos

I've been meaning to poke at this, so here's some more test results. I changed the dialog code to force non-native for all Cocoa Qt, then tried some fonts.

  • At any time, when a font manager is used (the pro kind that enables fonts in-place instead of copying to standard font folders), Qt ignores the DontUseNativeDialog? flag and shows the native font dialog, with all its problems. Otherwise,
  • Initially, the Qt font dialog is shown. Font selections don't snap back to other fonts, BUT some fonts still don't work, ie they display as Helvetica.

Once a font is selected and OK'd (back to the map display, but not back to the labeling dialog), one of two things may happen the next time the font dialog is shown:

  • If the font selected previously was a working font, the Qt font dialog is shown again,
  • If the font selected previously was not working (displays as Helvetica), the native Mac font dialog is shown.

comment:17 Changed 9 years ago by kyngchaos

Looking into this some more, checking things I should have... There is a Qt bug for 4.6.3 for the problem where it sometimes ignores DontUseNativeDialog?. Fixed in 4.7.1.

A couple hits for the selection issue in native dialogs.

One Qt bug seems to be similar, but it's only fixed for Qt 4.8.

Another suggests that if the initial font specified in getFont() is invalid, the dialog always returns the default font, which was the original problem of this Qgis bug report.

I guess I need to look at Qt 4.7 again, I had other issues with that but forgot to write anything down.

comment:18 Changed 9 years ago by jctull

This problem persists on OS X. - bug update for 1.7 release

comment:19 Changed 9 years ago by kyngchaos

Resolution: fixed
Status: reopenedclosed

Verified that the DontUseNativeDialog? Qt bug is fixed in 4.7.1, so Qgis can force the Qt font dialog starting with Qt 4.7.1. r15323 forces the Qt font dialog for Qt Cocoa. With Qt 4.5-4.6 it will try, though generally fail, to do so, but that's all it can do.

Font selection is still problematic, though it's also probably a Qt bug. But I think I now have the pattern for what fonts can't be used. Although all fonts can be selected in the Qt font dialog, some display with the default font (ie Helvetica). These include all non-roman OTF fonts, like CJK and symbol fonts. some examples:

  • Hiragino family (system), Japanese
  • Wingdings family (system), symbol
  • any of the CJK OTF fonts bundled with Adobe software

CJK/symbol fonts that work because they're TT or PS fonts:

  • Carta PS
  • Osaka (system), Japanese
  • other CJK TT fonts from the system
  • other language fonts in the system (Cyrillic, ...)
  • ESRI symbol fonts

Closing as fixed, though it's only fixed as far as it can be within QGIS (dialog only for Qt 4.7.1+, font display works within limits).

Note: See TracTickets for help on using tickets.