Skip to content
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

[MU4 Issue] MuseJazz bold renders poorly in some situations #14435

Open
MarcSabatella opened this issue Nov 9, 2022 · 6 comments · May be fixed by #17997
Open

[MU4 Issue] MuseJazz bold renders poorly in some situations #14435

MarcSabatella opened this issue Nov 9, 2022 · 6 comments · May be fixed by #17997
Labels
P3 Priority: Low text Any issues to do with text or fonts

Comments

@MarcSabatella
Copy link
Contributor

Describe the bug
MuseJazz renders poorly in bold in some situations

To Reproduce
Steps to reproduce the behavior:

  1. Create a score using jazz lead sheet template
  2. Add a tempo marking and "swing" text (both will be bold by default)
  3. Save
  4. Go to Home tab (may need to quit/restart first so it appears)
  5. See error: bad rendering of the tempo/swing text in the thumbnail

Expected behavior
MuseJazz bold should render normally

Screenshots
image

Platform information

  • OS: Linux

Additional context
This is one way to see the issue. But it also happens directly within MuseScore on some platforms if you try underlining the text, or if you try downsizing it. This has been an issue on and off in the past and apparently still is in at least this case. I can't reproduce any other effects on my current system with MU4 but I've seen it in the past and there is a current report of this in MU4(#12714). I believe the issue is probably bad metrics on the font, or bad options generating the OTF or TTF file, or bad choice of rendering library, or something specific to the way font scaling is performed within MuseScore.

@Tantacrul Tantacrul added the P3 Priority: Low label Nov 22, 2022
@Tantacrul
Copy link
Contributor

@oktophonie - have you even the slightest idea why this might be happening? 😄

@oktophonie
Copy link
Contributor

None whatsoever!

@MarcSabatella
Copy link
Contributor Author

I remember that there were similar issues in the past so I did a little digging and have at least some idea of what is happening.

Because MuseJazz doesn't have a true bold variant, it relies on "synthetic" boldening done in the rendering engine. This has been a problem for a long time, not just with MuseJazz, but other fonts. See https://musescore.org/en/node/284218 and https://musescore.org/en/node/281601. Apparently, there is some sort of bug in Qt and/or the FreeType rendering engine causing this. In the past, a hack was found to work around the problem, resulting in #5794, which allowed MU3 to work.

Whatever is responsible for generating those previews probably needs to deal with this as well. The thing is, the Qt bug this was working around was supposedly fixed in Qt 5.12, so it shouldn't still be affecting us. But maybe we are applying it somewhere we shouldn't be?

Anyhow, the relevant code in MU4 seems to be

void TextBase::drawTextWorkaround(mu::draw::Painter* p, mu::draw::Font& f, const mu::PointF& pos, const String& text)
. Either this function isn't doing what it needs to be doing here, or it isn't being called at all, or it's being called when it shouldn't be.

@AntonioBL
Copy link
Contributor

AntonioBL commented Nov 23, 2022

Ciao.
If I remember correctly, it should be solved in Qt 5.12 if we set an environment variable before (or maybe during?) the initialization to avoid font caching (and we use the normal painting method instead of the hack).
See #5794 (comment)
and here
(and this should solve also issue #12714 which is actually caused by a special case outside the workaround otherwise there were problems with the underline)

@AntonioBL
Copy link
Contributor

I think the main problem is the fact that the diagonal memeber of the painter matrix are not always 1.0, i.e. we scale the coordinate system instead of the elements when doing the zoom.
When the diagonal elements are 1.0 (i.e. no coordinate system scale) there is no bad font rendering.

AntonioBL added a commit to AntonioBL/MuseScore that referenced this issue Jun 14, 2023
…t workaround for artificially emboldened text
AntonioBL added a commit to AntonioBL/MuseScore that referenced this issue Jun 14, 2023
…t workaround for artificially emboldened text
AntonioBL added a commit to AntonioBL/MuseScore that referenced this issue Jun 15, 2023
…t workaround for artificially emboldened text
AntonioBL added a commit to AntonioBL/MuseScore that referenced this issue Jun 15, 2023
…t workaround for artificially emboldened text
@AntonioBL AntonioBL linked a pull request Jun 15, 2023 that will close this issue
8 tasks
@Jojo-Schmitz
Copy link
Contributor

FWIW: same issue with 3.x and its startcenter

AntonioBL added a commit to AntonioBL/MuseScore that referenced this issue Jul 3, 2023
…t workaround for artificially emboldened text
@oktophonie oktophonie added the text Any issues to do with text or fonts label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Priority: Low text Any issues to do with text or fonts
Projects
Status: Already in progress
Development

Successfully merging a pull request may close this issue.

5 participants