Skip to content

Commit e08441c

Browse files
committed
Set internal unit to 1/100 of millimetre
In theory, this unit is entirely arbitrary, so we could also set it to 1mm (that would make debugging nicer, cause every number we see represents millimetres). However, that corresponds to a very low DPI value (25.4), which doesn't work nicely with QFontMetrics, and very small scaled point sizes when drawing, which doesn't work nicely with QPainter. This seems the better compromise.
1 parent 37f53a8 commit e08441c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/engraving/dom/mscore.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,11 @@ static constexpr int MAX_FOOTERS = 3;
6767
static constexpr double INCH = 25.4; // millimitres per inch
6868
static constexpr double PPI = 72.0; // typographical points per inch
6969

70-
static constexpr double DPI = 1200;
71-
static constexpr double DPMM = DPI / INCH;
70+
// INTERNAL DRAWING UNITS
71+
// Given that it's ultimately arbitrary, we may as well set our internal units to
72+
// something that makes them easier to read when debugging, e.g. 1/100 of millimitre.
73+
static constexpr double DPMM = 100;
74+
static constexpr double DPI = INCH * DPMM;
7275

7376
// NOTE: the SMuFL default is actually 20pt. We use 10 for historical reasons
7477
// and back-compatibility, but this will be multiplied x2 during layout.

src/framework/draw/internal/qfontprovider.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <QFontMetricsF>
2828
#include <QRawFont>
2929

30-
#include "log.h"
30+
#include "engraving/dom/mscore.h"
3131

3232
using namespace muse;
3333
using namespace muse::draw;
@@ -45,7 +45,7 @@ class FontPaintDevice : public QPaintDevice
4545
{
4646
switch (m) {
4747
case QPaintDevice::PdmDpiY:
48-
return 1200; // Must be equal to mu::engraving::DPI
48+
return mu::engraving::DPI;
4949
default:
5050
return 1;
5151
}

0 commit comments

Comments
 (0)