-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First attempt to correct kerning under Windows #3298
Conversation
This is a Work In Progress. I tried to increase the dpi for the texts. I still have problems with some texts, for example the fretboard diagrams inside the palette. However I have no clue on how to solve this problem. I didn't check if there are other texts problems introduced by this PR (staff/system texts, figured bass, tempo texts seem ok). I quickly tried pdf and svg export and they seem ok, but more tests are needed. |
libmscore/mscore.h
Outdated
@@ -70,7 +70,12 @@ static const int MAX_TAGS = 32; | |||
static constexpr qreal INCH = 25.4; | |||
static constexpr qreal PPI = 72.0; // printer points per inch | |||
static constexpr qreal SPATIUM20 = 5.0; | |||
static constexpr qreal DPI = 72.0; | |||
#ifdef Q_OS_WIN | |||
static constexpr qreal DPIFACTOR = 10.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in master at this spot we see DPI_F = 5 and for all platforms.
It is only used here and in sym.cpp, not in those other files you use DPI_FACTOR in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but in master also SPATIUM20 is modified by DPI_F.
See 4ac407d
I didn't want to change the code too much for fear of unexpected regressions.
If I change only mscore.h by adding a DPIFACTOR also to SPATIUM20, all score objects get reduced by a factor DPIFACTOR.
By the way, I noticed that the exported svg seems right, but the page is scaled up by a factor DPIFACTOR (the page size of the exported pdf on the other hand looks correct).
I think that the new implementation I pushed today solves the fretboard scaling in the palette, and also the svg export scaling. |
I already discovered a residual problem with fretboard diagrams (when adding one if the global scale was changed resulted in a different font size). Now it should be correct. |
For some strange reason Travis CI didn't run against your latest commit?!? |
Maybe @sidewayss wants to check the SVG stuff here? |
SVG scales. That's the whole point. So initial size is relatively unimportant, it's the relative sizes of all the elements that matters. That said, it's also important to have a default size that looks reasonable when you double-click on an SVG file and open it in your browser - or however you open/embed the file. I assume that this change is intended to provide a better default size for the exported SVG files. Is that the case? If that is so, I suggest the primary concern should be that size itself - how does it compare to the size of the same score inside MuseScore? I had made an attempt to neutralize all the different unit conversions, but that PR never got merged, and then Werner added an additional scaling factor, and now it seems that this PR is adding another scaling factor that is 10 for Windows OS. I still think there are too many unit conversions going on in MuseScore, and there are efficiencies to be gained. But if all this does to the existing code is create a more acceptable initial size for the SVG exports, then I have no objections. |
@wschweer's added scaling is in master only, this here for 2.2 only, and the purpose is to get kerning on PDFs right for Windows only. It only touches SVG, to compensate for that scaling |
OK, I understand. So this is for PDF but it's touching SVG code? Regardless, I understand the change to file.cpp, and I would simply validate that the exports look good. The result is to make the SVG 10 times smaller on Windows, right? I have no idea why that's necessary, but if the result is good, then go with it. |
My understand is that this doesn't change the size of SVGs at all, in the saveSVG it just compensates for an increase does earlier. But I'd better let @AntonioBL comment on this |
This PR is trying to correct kerning problems appearing only under Windows in all graphical representations of scores in MuseScore (main program window, pdf, svg, png, etc...). This problem appears much more evident for small font sizes since it is caused by an integer- vs real-value representation of character dimensions. Under Windows, Qt QFontMetricsF gives only integer values (unless DirectWrite is used), see http://doc.qt.io/qt-5/qfont.html#HintingPreference-enum (the note at the end of the paragraph, after the two tables). However, I found additional problems with this high DPI patch, for example a wrong horizontal spacing in the case of an end repeat barline at the end of a system, or a crash with the snapshot tool. I will push the updated PR in a few minutes. As an additional note: I tried the same trick of scaling the font also under Linux (i.e. using a DPIFACTOR larger than 1 also under Linux), but for small values of zoom (i.e. score zoomed out) I was obtaining drawing artifacts: the text was appearing huge, but then when zooming in, after a certain zoom value (depending on text size) the text was appearing correct, also for larger zoom values. |
@@ -198,8 +198,14 @@ bool TextFragment::operator ==(const TextFragment& f) const | |||
|
|||
void TextFragment::draw(QPainter* p, const Text* t) const | |||
{ | |||
p->setFont(font(t)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I will add a #ifdef Q_OS_WIN here. It seems a pity to do all the following if DPIFACTOR is 1.0. Otherwise, I don't see any artefact on MacOS. So I'll merge this so we can get more testers.
No description provided.