# HG changeset patch # User Chris Cannam # Date 1544192963 0 # Node ID 751b21af6b6f9835ac9193050982a84f5795d1e1 # Parent ac7b40a64109a9be2c6f6c7b797bf4d76b09b736 Work around font mis-hinting when scaled on Windows diff -r ac7b40a64109 -r 751b21af6b6f src/changesetdetailitem.cpp --- 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 { diff -r ac7b40a64109 -r 751b21af6b6f src/changesetitem.cpp --- 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); diff -r ac7b40a64109 -r 751b21af6b6f src/main.cpp --- 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" diff -r ac7b40a64109 -r 751b21af6b6f src/uncommitteditem.cpp --- 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) {