comparison src/changesetitem.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 759b81c38bb1
comparison
equal deleted inserted replaced
681:ac7b40a64109 682:751b21af6b6f
307 QFont f(m_font); 307 QFont f(m_font);
308 308
309 QTransform t = paint->worldTransform(); 309 QTransform t = paint->worldTransform();
310 float scale = std::min(t.m11(), t.m22()); 310 float scale = std::min(t.m11(), t.m22());
311 311
312 if (scale > 1.0) {
313 #ifdef Q_OS_WIN32
314 f.setHintingPreference(QFont::PreferNoHinting);
315 #endif
316 }
317
312 bool showText = (scale >= 0.2); 318 bool showText = (scale >= 0.2);
313 bool showProperLines = (scale >= 0.1); 319 bool showProperLines = (scale >= 0.1);
314 320
315 if (m_searchText != "") { 321 if (m_searchText != "") {
316 if (m_searchMatches) { 322 if (m_searchMatches) {
502 508
503 branchColour.setAlpha(alpha); 509 branchColour.setAlpha(alpha);
504 userColour.setAlpha(alpha); 510 userColour.setAlpha(alpha);
505 511
506 QFont f(m_font); 512 QFont f(m_font);
507
508 QTransform t = paint->worldTransform(); 513 QTransform t = paint->worldTransform();
509 float scale = std::min(t.m11(), t.m22()); 514 float scale = std::min(t.m11(), t.m22());
510 if (scale > 1.0) { 515 if (scale > 1.0) {
511 int ps = int((f.pixelSize() / scale) + 0.5); 516 int ps = int((f.pixelSize() / scale) + 0.5);
512 if (ps < 8) ps = 8; 517 if (ps < 8) ps = 8;
513 f.setPixelSize(ps); 518 f.setPixelSize(ps);
519 #ifdef Q_OS_WIN32
520 f.setHintingPreference(QFont::PreferNoHinting);
521 #endif
514 } 522 }
515 523
516 bool showProperLines = (scale >= 0.1); 524 bool showProperLines = (scale >= 0.1);
517 525
518 if (!showProperLines) { 526 if (!showProperLines) {