printing: use sensible font-size in profiles

The font-size in printed profiles is based on the size of the profile
in the main window. This makes no sense. Why should changing the
window size change the font-size on printouts?

Matter of fact, when making shrinking the height of the window to
its minimum, comical printouts are obtained (font way too big).

Therefore use an arbitrary rule: Say that profiles 600 pixels high
look reasonable and then scale up to the actual size on the printout.

This may need some tweaking for high-DPI mode. But that seems not
to be supported on desktop anyway?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-04-01 22:40:55 +02:00 committed by Dirk Hohndel
parent 56ffa95459
commit 8cd389c0af
2 changed files with 7 additions and 3 deletions

View file

@ -1,4 +1,4 @@
printing: use sensible font size even for strange window size
---
* Always add new entries at the very top of this file above other existing entries and this note.

View file

@ -150,8 +150,12 @@ void Printer::render(int pages)
QSize originalSize = profile->size();
if (collection.count() > 0) {
printFontScale = (double)collection.at(0).geometry().size().height() / (double)profile->size().height();
profile->resize(collection.at(0).geometry().size());
// A "standard" profile has about 600 pixels in height.
// Scale the fonts in the printed profile accordingly.
// This is arbitrary, but it seems to work reasonably.
QSize size = collection[0].geometry().size();
printFontScale = size.height() / 600.0;
profile->resize(size);
}
profile->setFontPrintScale(printFontScale);