aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-04-01 22:40:55 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-04-02 08:22:00 -0700
commit8cd389c0afb422011e150ce8b72857ecdb19aa65 (patch)
tree5f8d158d6398a52a44034a2d765836e219c03c19 /desktop-widgets
parent56ffa95459b74e2f28c277d5b6d9b004ef26b240 (diff)
downloadsubsurface-8cd389c0afb422011e150ce8b72857ecdb19aa65.tar.gz
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>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/printer.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/desktop-widgets/printer.cpp b/desktop-widgets/printer.cpp
index ff5a65b93..49135d79c 100644
--- a/desktop-widgets/printer.cpp
+++ b/desktop-widgets/printer.cpp
@@ -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);