[MacOS X] Export Pdf with Muse Jazz Text all garbled and unreadable if no printers are setup on a machine

• Dec 7, 2018 - 00:26
Reported version
3.0
Priority
P0 - Critical
Type
Functional
Frequency
Many
Severity
S2 - Critical
Reproducibility
Always
Status
closed
Regression
No
Workaround
Yes
Project

When exporting a .pdf file using Muse Jazz Text Font the .pdf is garbage.

Attachment Size
Dragonbird_Hummingfly_Waltz.pdf 40.73 KB
Looking_Out_a_Window.pdf 44.35 KB

Comments

Title Export Pdf with Muse Jazz Texxt all garbled and unreadable Export Pdf with Muse Jazz Text all garbled and unreadable
Status open issues needs info
Type EPIC Functional
Priority P0 - Critical

sample score please

Works for me. You don't by chance have an incompatible font with the same name installed on your system? Like maybe you at some piint downloaded and installed the MuseJazz font used in 2.x, which didn't support notation? This font should not be installed at all; MuseScore needs to be able to access its own version.

I could also believe there being an issue with Qt 5.12 which would explain why this seems macOS-specific. Could some other mac user verify the results of PDF export using "Looking"?

Latest MuseScore 3 beta (Dec. 14), MacBook Pro, macOS Mojave 10.14.1. Style: musical symbols font is MuseJazz, musical text font is MuseJazz Extended. No fonts with these names are installed anywhere on this MacBook (looked everywhere using FontBook and searched using Finder).
Pdf exported from Musescore creates the strange musical symbols. Using the Print>SaveAsPdf function on the Mac the musical symbols had the desired MuseJazz look, as expected. Score, exported pdf and printed pdf files attached.

I can't reproduce in d7232a8449 self built on Mac 10.13.4 with Qt 5.9.7.
FWIW, I tried to reproduce with Qt 5.12, just in case, and the PDF are not readable by Preview (using MuseJazz or not...)

I can reproduce in Beta (OS: macOS 10.14, Arch.: x86_64, MuseScore version (64-bit): 3.0.0.19874, revision: 59a11cd). The pdfPrinter replaces note symbols with some text symbols somehow. I'll take a look.

Also, I cannot reproduce the case when creating new score from scratch using MuseJazz font. Copy-pasting elements from the attached (LookingOutWindow-3.mscz) score to the new score also doesn't produce incorrect results.

Title Export Pdf with Muse Jazz Text all garbled and unreadable [MacOS X] Export Pdf with Muse Jazz Text all garbled and unreadable
Status active fixed

Fixed in branch master, commit 40a27b9cd7

fix #279563: Export Pdf with Muse Jazz Text all garbled and unreadable

Replace QPdfWriter with QPrinter, the last is more configurable and aligned with Print functionality.
The pearl of the fix is setting output format to QPrinter::NativeFormat. I'm not sure, but I believe this is a bug in output format processing introduced in Qt 5.12.

New interface requires creating temp file when processing JSON generation. So, I extracted a method which deals with the exporting pdf as a json routine.

I just got a new MacBook and installed Musescore 3.2. I created a new score, and the PDF parts it generates are all garbled (see attached). On my previous MacBook, the individual parts would be fine, but the "Score of the "Score and Parts" would always be garbled too.

OS: macOS Mojave (10.14), Arch.: x86_64, MuseScore version (64-bit): 3.2.0.22758, revision: 8594c8c

Attachment Size
Jo_Jo-Concert_Instruments.pdf 20.19 KB
Status closed active

Yeah! I finally reproduced the case on my machine. Only the *Score_and_parts.pdf is exported incorrectly, all parts and score are exported correctly on my machine.

Status active fixed

Fixed in branch master, commit 9bdd6ca580

_fix #279563: Score_And_Parts pdfs are garbled when using MuzeJazz font

Replace pdfWriter with QPrinter
Refactoring of the savePdf methods is needed to avoid code duplication_

In reply to by Anatoly-os

@Anatoly-os Oh, great news that you were able to reproduce the issue, and also that you already pushed a fix!

On my old MacBook, I saw the same behavior you described: The Score_and_Parts was garbled, but the individual parts were fine. On my new MacBook everything is garbled. I'm not sure why the behavior is different there... Hopefully your patch fixes all of it! Thanks again!

Hi,
I read this post but I can't understand what to do to solve my problem. Do I have to change program routines? If yes, where? Where can I find the file to edit? How to open it?
When I convert to PDF the file is corrupted: this happens only with the use of the MuseJazz font.
My installed version is 3.2.3 (the latest).
My system is MacBook Mojave 10.14.5

In addition, the Print ... function is also disabled!!! :(((

Thank you all for your help!

I tested out the new version of Musescore (version info below) and my PDFs are still garbled when using MuseJazz.

Elaborating, when exporting PDFs both the individual parts and the score-and-parts PDFs are all garbled. If I use a different font then all the issues are resolved. I wonder what's different about my system where I still see this issue... @Anatoly-os, if you have any thoughts or would like me to test anything out, please let me know.

Thanks!

OS: macOS 10.14, Arch.: x86_64, MuseScore version (64-bit): 3.2.3.22971, revision: d2d863f

In reply to by Anatoly-os

Unfortunately I don't have a real printer (I export to PDFs then take those to a store to get printed). And also no printers are installed on my MacBook.

I can print the garbled PDFs and see what happens though. Would that be helpful, or is it just the print-straight-to-a-real-printer case that is helpful?

In reply to by bpclub

No, there is no need to print garbled PDF file :) I think the absence of a real printer is a key to the complete solution of the issue. I'll experiment within a week and come back to you once I have more information.

UPD: I mean, the absence of a real printer in the printer settings on macOS, not a real device :)

Title [MacOS X] Export Pdf with Muse Jazz Text all garbled and unreadable [MacOS X] Export Pdf with Muse Jazz Text all garbled and unreadable if no printers are setup on a machine
Status closed needs info
Status needs info active

I was right, lol. The bug is reproduced if there are no printers set up in the system. Digging into the code base...

Workaround No Yes

One possible workaround certainly is to upload the score to musescore.com (preferably via File > Save online) and then download the PDF from there.

When there are no printers in the printer preferences, if a MuseJazzText character is drawn before a MuseJazz character, then the latter is corrupted, and viceversa. In the previous examples, a MuseJazzText is used for the measure numbers and thus drawn before the MuseJazz elements of the scores.
I managed to isolate the problem in a simple Qt example program, in attachment. To view it, simply open the .pro file in QtCreator and build and run it from within QtCreator.
In the example file, when there are no printers in the printer preferences, if the MuseJazz string contains characters from unicode 0000 to unicode 9FCF, then the following MuseJazzText string is not corrupted. If it contains even one character with unicode code larger or equal to 9FD0 (such as all the musical symbols and notes used in a score), then the MuseJazzText string is corrupted.
Similarly, if the painting order of the strings is reversed (i.e. MuseJazzText first and MuseJazz second), if the MuseJazz string contains characters from unicode 0000 to unicode 9FCF, then it is not corrupted. If it contains characters with unicode code larger or equal to 9FD0 (such as all the musical symbols and notes used in the score), then such characters get corrupted (and the MuseJazzText is not corrupted in both cases, if drawn first).
I don't know if it is a Qt bug, or a MuseJazz/MuseJazzText bug (or most probably a combination of both).

Attachment Size
font_musejazz_pdf.zip 216.22 KB

This is pretty amazing info! I wonder if somehow the fonts are overlapping? Like, even though their main names differ, some sort of metadata causes them to be mistaken for each other? There are a whole bunch of different names that can be set in FontForgeand MuseJazz Text used to be just called MuseJazz. Maybe we missed some metadata when we renamed it. Just browsing through the dialog, I see a field under "TTF Names" called "Compatible Full" that is set to MuseJazz. Maybe that is somehow fooling some systems into thinking it can substitute one for the other, which of course is not true?

See:
https://github.com/musescore/MuseScore/pull/5497
After some modification attempts with FontForge, I found that the font I managed to create was no more displaying the bug. So I used ttx to isolate the changes and verified one by one which was the one solving the bug.
Apparently, the simple modification of the UniqueID field in the TTF names tab was able to solve this bug, from this:
original.png
to this:
modified.png

I then re-exported the font with these options:
saving_options.png

In my system this solves the problem, but I think additional tests on other Macs displaying the problem are needed.

Edit: Jojo-Schmitz is always the fastest :-)

Well, I modified only that single line, so the font should be 100% equal to the old one.
Every other (possible) modification would come from FontForge export routines. In principle, the substitution should be harmless.
I was only not 100% sure the bug is really solved for everyone.

P.S: By the way, FontForge highlights problems in the font, such as a wrong negative number in a positive-only field for one of the glyphs (the umlaut, I think).

Fix version
3.3.3