Use same size for styled fonts.
This commit is contained in:
parent
6e924177b7
commit
141c1b4a7e
1 changed files with 5 additions and 8 deletions
|
|
@ -251,15 +251,12 @@ struct Metrics {
|
|||
|
||||
const auto adjusted = [&](int size, const QFontMetricsF &metrics) {
|
||||
const auto full = metrics.tightBoundingRect(Full);
|
||||
const auto desiredTightAscent = -desiredFull.y();
|
||||
const auto desiredTightHeight = desiredFull.height();
|
||||
const auto ascentAdd = basicMetrics.ascent() - desiredTightAscent;
|
||||
const auto heightAdd = basicMetrics.height() - desiredTightHeight;
|
||||
const auto tightAscent = -full.y();
|
||||
const auto tightHeight = full.height();
|
||||
return Metrics{
|
||||
.pixelSize = size,
|
||||
.ascent = tightAscent + ascentAdd,
|
||||
.ascent = basicMetrics.ascent(),
|
||||
.height = tightHeight + heightAdd,
|
||||
};
|
||||
};
|
||||
|
|
@ -337,6 +334,10 @@ struct Metrics {
|
|||
}
|
||||
font.setPixelSize(size);
|
||||
|
||||
const auto adjust = (overriden && !skipSizeAdjustment);
|
||||
const auto metrics = ComputeMetrics(font, adjust);
|
||||
font.setPixelSize(metrics.pixelSize);
|
||||
|
||||
font.setWeight((flags & (FontFlag::Bold | FontFlag::Semibold))
|
||||
? QFont::DemiBold
|
||||
: QFont::Normal);
|
||||
|
|
@ -353,10 +354,6 @@ struct Metrics {
|
|||
font.setUnderline(flags & FontFlag::Underline);
|
||||
font.setStrikeOut(flags & FontFlag::StrikeOut);
|
||||
|
||||
const auto adjust = (overriden && !skipSizeAdjustment);
|
||||
const auto metrics = ComputeMetrics(font, adjust);
|
||||
font.setPixelSize(metrics.pixelSize);
|
||||
|
||||
return {
|
||||
.font = font,
|
||||
.ascent = metrics.ascent,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue