wrong font spacing in QT #527

Closed
telephon opened this Issue Sep 21, 2012 · 17 comments

5 participants

@telephon
SuperCollider member

It is generally known that some fonts are spaced wrong in QT, especially relevant is Monaco 9 pt.

Maybe the following solution could be applied?
http://www.esdrasbeleza.com/2010/05/20/how-to-fix-ugly-fonts-in-qt-based-applications/

@timblechmann

can you elaborate, what is 'generally known'? i somehow doubt that this link is relevant, as it is related to fontconfig

@telephon
SuperCollider member
@timblechmann

can you try to enable/disable font antialiasing?

@telephon
SuperCollider member
@timblechmann

if you want to get your or someone wants have a closer look, i'd suggest to look into qfont's style hints and style strategy (https://qt-project.org/doc/qt-4.8/qfont.html#setStyleHint). the specific code in the ide is QFont Manager::codeFont(), in core/settings/manager.cpp. font rendering is quite platform-specific, so it may need the eyes of someone on osx

@telephon
SuperCollider member

Yes, it could indeed be a (horizontal) font hinting issue in QT (it looks the same in the help files), where QT removes the space between the letters instead of adding it (rounding down instead of up). It seems that the possible settings are the ones described here: http://qt-project.org/doc/qt-4.8/qfont.html#HintingPreference-enum

(Someone else needs to look into it, I don't understand how the documentation is applied to the code).

@danstowell
SuperCollider member

Julian, I can't look into it myself since am without mac, but it looks like the documentation referred to would suggest that it's a simple "global" system call. So I'd suggest you try adding this line somewhere in the SCIDE code, maybe somewhere in the app startup (wherever that is) or maybe in core/settings/manager.cpp as tim suggested:

     QFont::setHintingPreference ( QFont::PreferFullHinting );
@telephon
SuperCollider member
@danstowell
SuperCollider member
@telephon
SuperCollider member
@timblechmann

maybe this? http://qt-project.org/doc/qt-4.8/qfont.html#setStyleStrategy

btw, please use github's markdown formatting for pasting code, backtraces or the like

@telephon
SuperCollider member

Hm, this seems to be for a different purpose?
"The style strategy tells the font matching algorithm what type of fonts should be used to find an appropriate default family."

@jleben
SuperCollider member

Is this still an issue?

@telephon
SuperCollider member

Yes, as of now, still there.

@scztt

This issue is fixed in qt5. And, it should be noted that, OSX doesn't use hinting, so the hinting changes mentioned above are basically a no-op. In general, QT's font system is a very simplistic wrapper around pretty labyrinthine OS font systems, so many calls either map very indirectly to the underlying system, or map to nothing at all.

@telephon
SuperCollider member

good to know!

@telephon
SuperCollider member

Fixed in QT5.

@telephon telephon closed this Mar 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment