musescore / musescore/MuseScore
Mu1 import problem with frame texts, esp. multiline and formatted ones
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 15.1k
- Forks
- 3.3k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 91
Description
Issue type
Import/Export issue
Description with steps to reproduce
Just found another problem: frame text, esp Lyricist and Composer (i.e. those with a bottom alignment) have a problem on Mu1 import. when their height is less than the height of those texts. Mu3 had that problem too, so this part is not a regression. Culprit seems that texts that did fit their frame in Mu1 no longer do in Mu3 and Mu3 for reasons that are beyond me, and not importantnt in the context of this issue.
But: A text that in Mu1, Mu2 and M3 did fix a vertical frame with a height of 161sp (10pt Arial bold) in Mu4.3.2 needs 191sp, almost 20% more!?! Mu4.4 needs a bit less apparently, 'only' 184.5sp, still almost 15% more than Mu1-3.
Also Mu4.3.2 looses the boldness and makes the font FreeSerif, that seems to be the reason for the extra space it needs
4.4 'only' looses the boldness, adding that back and it needs 191sp too.
Ah, now I see: it increases the font size to 12pt, exactly those 20%.!
One particular such text looks like this in Mu1:
<Text>
<style>5</style>
<subtype>Poet</subtype>
<offset x="0.297076" y="0"/>
<pos x="0.297076" y="0.594602"/>
<frame>0</frame>
<html-data>
<html><head><meta name="qrichtext" content="1" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Times New Roman'; font-size:12pt; font-weight:400; font-style:normal;">
<table border="0" style="-qt-table-type: root; margin-top:1px; margin-bottom:1px; margin-left:1px; margin-right:1px;">
<tr>
<td style="border: none;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:10pt; font-weight:600;"> D</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:10pt; font-weight:600;">1. I have climbed the highest mountains I have run through the fields</span></p>
... more Arial 10
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:10pt; font-weight:600;">Aber ich habe immer noch nicht gefunden, wonach ich suche.</span></p></td></tr></table></body></html>
</html-data>
</Text>
</VBox>
So it seems to confuse the fonts (in 4.3, no longer in 4.4), font sizes and font weights?
Mu4(.4) generats this mess:
<VBox>
<height>161.387</height>
<boxAutoSize>0</boxAutoSize>
<eid>1391569404026</eid>
<Text>
<eid>1395864371205</eid>
<style>poet</style>
<text> D
1. I have climbed the highest mountains I have run through the fields
G D
Only to be with you only to be with you
<font size="10"/>
<font size="12"/> I have run I have crawled I have scaled these city walls
G D
These city walls only to be with you
<font size="10"/>
<font size="12"/>Chorus:
Mu3 reads it correctly as:
<VBox>
<height>161.387</height>
<leftMargin>5</leftMargin>
<rightMargin>5</rightMargin>
<topMargin>5</topMargin>
<bottomMargin>5</bottomMargin>
<boxAutoSize>0</boxAutoSize>
<Text>
<style>Lyricist</style>
<text><font size="10"/><font face="Arial"/><b> D</b>
<b>1. I have climbed the highest mountains I have run through the fields</b>
<b> G D</b>
<b> Only to be with you only to be with you</b>
<b> I have run I have crawled I have scaled these city walls</b>
<b> G D</b>
<b> These city walls only to be with you</b>
<b>Chorus:</b>
Font face, size and weight!
As far as I can tell Mu4's HtmlParser::parse reads the size only and even there screws up...
It seems Mu3's convertFromHtml() in read114.cpp does a much better job here!
Originally posted by @Jojo-Schmitz in https://github.com/musescore/MuseScore/issues/23648#issuecomment-2241741902
Supporting files, videos and screenshots
n/a
What is the latest version of MuseScore Studio where this issue is present?
all Mu4
Regression
yes, vs. Mu3
Operating system
all
Additional context
Checklist
- This report follows the guidelines for reporting bugs and issues
- I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
- I have attached all requested files and information to this report
- I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Mu4's HtmlParser::parse and compare its handling of the embedded HTML with Mu3's convertFromHtml() in read114.cpp. Trace the Mu1 import path for frame text and verify that font face, size, weight, multiline formatting, and vertical frame sizing are preserved after import. Done means the supplied Mu1 example imports without font substitutions or unnecessary height growth.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, html
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100