Mercurial > hg > easyhg
changeset 682:751b21af6b6f
Work around font mis-hinting when scaled on Windows
author | Chris Cannam |
---|---|
date | Fri, 07 Dec 2018 14:29:23 +0000 |
parents | ac7b40a64109 |
children | 759b81c38bb1 |
files | src/changesetdetailitem.cpp src/changesetitem.cpp src/main.cpp src/uncommitteditem.cpp |
diffstat | 4 files changed, 27 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/changesetdetailitem.cpp Fri Dec 07 13:43:08 2018 +0000 +++ b/src/changesetdetailitem.cpp Fri Dec 07 14:29:23 2018 +0000 @@ -69,6 +69,9 @@ QWidget *) { paint->save(); + +#ifdef Q_OS_WIN32 +#endif ColourSet *colourSet = ColourSet::instance(); QColor branchColour = colourSet->getColourFor(m_changeset->branch()); @@ -76,6 +79,14 @@ QTransform t = paint->worldTransform(); float scale = std::min(t.m11(), t.m22()); +#ifdef Q_OS_WIN32 + QFont f(m_doc->defaultFont()); + f.setHintingPreference(scale != 1.0 ? + QFont::PreferVerticalHinting : + QFont::PreferDefaultHinting); + m_doc->setDefaultFont(f); +#endif + if (scale < 0.1) { paint->setPen(QPen(branchColour, 0)); } else {
--- a/src/changesetitem.cpp Fri Dec 07 13:43:08 2018 +0000 +++ b/src/changesetitem.cpp Fri Dec 07 14:29:23 2018 +0000 @@ -309,6 +309,12 @@ QTransform t = paint->worldTransform(); float scale = std::min(t.m11(), t.m22()); + if (scale > 1.0) { +#ifdef Q_OS_WIN32 + f.setHintingPreference(QFont::PreferNoHinting); +#endif + } + bool showText = (scale >= 0.2); bool showProperLines = (scale >= 0.1); @@ -504,13 +510,15 @@ userColour.setAlpha(alpha); QFont f(m_font); - QTransform t = paint->worldTransform(); float scale = std::min(t.m11(), t.m22()); if (scale > 1.0) { int ps = int((f.pixelSize() / scale) + 0.5); if (ps < 8) ps = 8; f.setPixelSize(ps); +#ifdef Q_OS_WIN32 + f.setHintingPreference(QFont::PreferNoHinting); +#endif } bool showProperLines = (scale >= 0.1);
--- a/src/main.cpp Fri Dec 07 13:43:08 2018 +0000 +++ b/src/main.cpp Fri Dec 07 14:29:23 2018 +0000 @@ -35,7 +35,7 @@ cout << "EasyMercurial v" << EASYHG_VERSION << "\n" << "Copyright (c) 2010 Jari Korhonen\n" << "Copyright (c) 2013 Chris Cannam\n" - << "Copyright (c) 2013 Queen Mary, University of London\n" + << "Copyright (c) 2013-2018 Queen Mary, University of London\n" << "This program is free software; you can redistribute it and/or\n" << "modify it under the terms of the GNU General Public License as\n" << "published by the Free Software Foundation; either version 2 of the\n"
--- a/src/uncommitteditem.cpp Fri Dec 07 13:43:08 2018 +0000 +++ b/src/uncommitteditem.cpp Fri Dec 07 14:29:23 2018 +0000 @@ -130,6 +130,9 @@ int ps = int((f.pixelSize() / scale) + 0.5); if (ps < 8) ps = 8; f.setPixelSize(ps); +#ifdef Q_OS_WIN32 + f.setHintingPreference(QFont::PreferVerticalHinting); +#endif } if (scale < 0.1) { @@ -197,6 +200,9 @@ int ps = int((f.pixelSize() / scale) + 0.5); if (ps < 8) ps = 8; f.setPixelSize(ps); +#ifdef Q_OS_WIN32 + f.setHintingPreference(QFont::PreferVerticalHinting); +#endif } if (scale < 0.1) {