Skip to content

Commit ac39238

Browse files
committed
Remove parentheses after cut and common time from MuseJazz and add them programmatically in older scores.
1 parent 554ea6c commit ac39238

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

fonts/musejazz/MuseJazz.otf

-200 Bytes
Binary file not shown.

libmscore/timesig.cpp

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ void TimeSig::write(XmlWriter& xml) const
167167

168168
void TimeSig::read(XmlReader& e)
169169
{
170-
int n=0, z1=0, z2=0, z3=0, z4=0;
170+
int n = 0, z1 = 0, z2 = 0, z3 = 0, z4 = 0;
171171
bool old = false;
172172

173173
while (e.readNextStartElement()) {
@@ -235,9 +235,9 @@ void TimeSig::read(XmlReader& e)
235235
_sig.set(z1+z2+z3+z4, n);
236236
}
237237
_stretch.reduce();
238-
238+
239239
// Read and Write num/den strings into parserString for backwards compatibility
240-
if ( _timeSigType == TimeSigType::NORMAL && parserString().isEmpty()
240+
if ( _timeSigType == TimeSigType::NORMAL && parserString().isEmpty()
241241
&& (!numeratorString().isEmpty() || !denominatorString().isEmpty())) {
242242
setParserString(numeratorString());
243243
if (!denominatorString().isEmpty())
@@ -257,6 +257,20 @@ void TimeSig::read(XmlReader& e)
257257
setDenominatorString(QString::number(_sig.denominator()));
258258
}
259259
}
260+
261+
if (old) {
262+
// Musejazz had by default a closing parenthesis after cut and common time signatures
263+
if (masterScore()->scoreFont()->name() == "MuseJazz") {
264+
if (_timeSigType == TimeSigType::ALLA_BREVE) {
265+
_timeSigType = TimeSigType::NORMAL;
266+
setParserString("C)");
267+
}
268+
else if (_timeSigType == TimeSigType::FOUR_FOUR) {
269+
_timeSigType = TimeSigType::NORMAL;
270+
setParserString("¢)");
271+
}
272+
}
273+
}
260274
}
261275

262276
//---------------------------------------------------------
@@ -363,15 +377,15 @@ void TimeSig::layout()
363377
pString.replace(QRegExp("\\)([ +=x\\*\\-]+)"),")|\\1"); // insert separator between ')' and '+x=-'
364378
pString.replace(QRegExp("(\\|[ +=x\\*\\-]+)"),"\\1|"); // then after isolated '+x-='
365379
pString.replace(" ","| |"); // split spaces
366-
// add separator after '(' with no matching ')' inside numerators (which include numbers, '+' and fractions)
380+
// add separator after '(' with no matching ')' inside numerators (which include numbers, '+' and fractions)
367381
pString.replace(QRegExp("\\(([0-9+\\xE097\\xE098\\xE099\\xE09A\\xE09B]+[\\/])+"), "(|\\1");
368382

369383
qDebug("---pString after %s", qPrintable(pString));
370384

371385
// Create list of time signature blocks ('numerator/denominator', or just 'numerator' for center drawn glyphs like 'C', '+' or '(' )
372386
QStringList sList = pString.split("|", QString::SkipEmptyParts);
373387

374-
// LOOP thru the sList and create the numerator and denominator strings and positions
388+
// LOOP thru the sList and create the numerator and denominator strings and positions
375389
ns.clear();
376390
ds.clear();
377391
pns.clear();
@@ -418,7 +432,7 @@ void TimeSig::layout()
418432
//else {
419433
// ns = { toTimeSigString(_numeratorString, largeTimeSig(), false) };
420434
// ds = { toTimeSigString(_denominatorString, largeTimeSig(), false) };
421-
// }
435+
// }
422436
}
423437

424438
ScoreFont* font = score()->scoreFont();
@@ -439,13 +453,13 @@ void TimeSig::layout()
439453
// Handle special cases here:
440454
// SymId::space doesn't have a bbox, so add ::space _advance value (10.0) to the rect width
441455
if (ns[i].size() && ns[i][0] == SymId::space)
442-
nRect.adjust(0, 0, 10.0 * mag.width(), 0);
456+
nRect.adjust(0, 0, 10.0 * mag.width(), 0);
443457
// else if ... (other special cases):
444458
// TO DO:... "Emmentaler" parentheses have bad bboxes
445-
// TO DO:... "Gonville" doesn't have big parentheses.
459+
// TO DO:... "Gonville" doesn't have big parentheses.
446460
// TO DO: * Both cases are problems with the font. It's better to fix the glyphs there
447461
// Adjust note symbols' bboxes in denominator so the glyphs are draw at a correct vertical pos. in the staff
448-
if (ds[i].size() && (ds[i][0] == SymId::metNoteQuarterDown || ds[i][0] == SymId::metNote8thDown
462+
if (ds[i].size() && (ds[i][0] == SymId::metNoteQuarterDown || ds[i][0] == SymId::metNote8thDown
449463
|| ds[i][0] == SymId::metNoteHalfDown || ds[i][0] == SymId::metNote16thDown)) {
450464
dRect.adjust(0, 53 * mag.height(), 0, 0);
451465
if (ds[i].size() > 1 || ds[i][1] == SymId::metAugmentationDot)
@@ -503,7 +517,7 @@ void TimeSig::draw(QPainter* painter) const
503517
return;
504518
painter->setPen(curColor());
505519

506-
// loop and draw t/s blocks
520+
// loop and draw t/s blocks
507521
for (int i = 0; i < ns.size(); i++) {
508522
drawSymbols(ns[i], painter, pns[i], _scale);
509523
drawSymbols(ds[i], painter, pds[i], _scale);
@@ -716,4 +730,3 @@ bool TimeSig::operator==(const TimeSig& ts) const
716730
}
717731

718732
}
719-

0 commit comments

Comments
 (0)