Allow a bit more font size adjusting.
This commit is contained in:
parent
6d1014fa8f
commit
cb57bef3f0
1 changed files with 14 additions and 2 deletions
|
|
@ -169,7 +169,13 @@ bool LoadCustomFont(const QString &filePath) {
|
||||||
const auto nowHeight = metrics.height();
|
const auto nowHeight = metrics.height();
|
||||||
const auto nowCap = metrics.capHeight();
|
const auto nowCap = metrics.capHeight();
|
||||||
if (nowHeight > desiredHeight || nowCap > desiredCap) {
|
if (nowHeight > desiredHeight || nowCap > desiredCap) {
|
||||||
return (size + shift - 1);
|
const auto heightBetter = (nowHeight - desiredHeight)
|
||||||
|
< (desiredHeight - currentHeight);
|
||||||
|
const auto capBetter = (nowCap - desiredCap)
|
||||||
|
< (desiredCap - currentCap);
|
||||||
|
return (heightBetter && capBetter)
|
||||||
|
? (size + shift)
|
||||||
|
: (size + shift - 1);
|
||||||
}
|
}
|
||||||
currentHeight = nowHeight;
|
currentHeight = nowHeight;
|
||||||
currentCap = nowCap;
|
currentCap = nowCap;
|
||||||
|
|
@ -183,7 +189,13 @@ bool LoadCustomFont(const QString &filePath) {
|
||||||
const auto nowHeight = metrics.height();
|
const auto nowHeight = metrics.height();
|
||||||
const auto nowCap = metrics.capHeight();
|
const auto nowCap = metrics.capHeight();
|
||||||
if (nowHeight < desiredHeight || nowCap < desiredCap) {
|
if (nowHeight < desiredHeight || nowCap < desiredCap) {
|
||||||
return (size - shift + 1);
|
const auto heightBetter = (desiredHeight - nowHeight)
|
||||||
|
< (currentHeight - desiredHeight);
|
||||||
|
const auto capBetter = (desiredCap - nowCap)
|
||||||
|
< (currentCap - desiredCap);
|
||||||
|
return (heightBetter && capBetter)
|
||||||
|
? (size - shift)
|
||||||
|
: (size - shift + 1);
|
||||||
}
|
}
|
||||||
currentHeight = nowHeight;
|
currentHeight = nowHeight;
|
||||||
currentCap = nowCap;
|
currentCap = nowCap;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue