Mercurial > hg > easyhg
comparison src/changesetdetailitem.cpp @ 682:751b21af6b6f
Work around font mis-hinting when scaled on Windows
author | Chris Cannam |
---|---|
date | Fri, 07 Dec 2018 14:29:23 +0000 |
parents | ce29dc775650 |
children |
comparison
equal
deleted
inserted
replaced
681:ac7b40a64109 | 682:751b21af6b6f |
---|---|
67 ChangesetDetailItem::paint(QPainter *paint, | 67 ChangesetDetailItem::paint(QPainter *paint, |
68 const QStyleOptionGraphicsItem *, | 68 const QStyleOptionGraphicsItem *, |
69 QWidget *) | 69 QWidget *) |
70 { | 70 { |
71 paint->save(); | 71 paint->save(); |
72 | |
73 #ifdef Q_OS_WIN32 | |
74 #endif | |
72 | 75 |
73 ColourSet *colourSet = ColourSet::instance(); | 76 ColourSet *colourSet = ColourSet::instance(); |
74 QColor branchColour = colourSet->getColourFor(m_changeset->branch()); | 77 QColor branchColour = colourSet->getColourFor(m_changeset->branch()); |
75 | 78 |
76 QTransform t = paint->worldTransform(); | 79 QTransform t = paint->worldTransform(); |
77 float scale = std::min(t.m11(), t.m22()); | 80 float scale = std::min(t.m11(), t.m22()); |
78 | 81 |
82 #ifdef Q_OS_WIN32 | |
83 QFont f(m_doc->defaultFont()); | |
84 f.setHintingPreference(scale != 1.0 ? | |
85 QFont::PreferVerticalHinting : | |
86 QFont::PreferDefaultHinting); | |
87 m_doc->setDefaultFont(f); | |
88 #endif | |
89 | |
79 if (scale < 0.1) { | 90 if (scale < 0.1) { |
80 paint->setPen(QPen(branchColour, 0)); | 91 paint->setPen(QPen(branchColour, 0)); |
81 } else { | 92 } else { |
82 paint->setPen(QPen(branchColour, 2)); | 93 paint->setPen(QPen(branchColour, 2)); |
83 } | 94 } |