Skip to content

Commit

Permalink
Adjust symbol width to actual qreal for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioBL committed May 29, 2014
1 parent 957d375 commit a92bb32
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libmscore/sym.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6078,7 +6078,9 @@ void ScoreFont::load()
_font->setHintingPreference(QFont::PreferVerticalHinting);

qreal size = 20.0 * MScore::DPI / PPI;
QFont font2(font());
_font->setPixelSize(lrint(size));
font2.setPixelSize(lrint(size)*100);

QFile fi(_fontPath + "glyphnames.json");
if (!fi.open(QIODevice::ReadOnly))
Expand All @@ -6090,6 +6092,7 @@ void ScoreFont::load()
error.offset, qPrintable(error.errorString()));

_fm = new QFontMetricsF(font());
QFontMetrics fm2(font2);
for (auto i : o.keys()) {
bool ok;
int code = o.value(i).toObject().value("codepoint").toString().mid(2).toInt(&ok, 16);
Expand All @@ -6099,7 +6102,7 @@ void ScoreFont::load()
SymId symId = Sym::lnhash.value(i);
Sym* sym = &_symbols[int(symId)];
sym->setString(codeToString(code));
sym->setWidth(_fm->width(sym->string()));
sym->setWidth((fm2.width(sym->string()))/100.0);
sym->setBbox(QRectF(_fm->tightBoundingRect(sym->string())));
}
//else
Expand Down

0 comments on commit a92bb32

Please sign in to comment.