fix font cache

This commit is contained in:
ws 2015-05-06 13:38:28 +02:00
parent 72ec3dc12b
commit 59d0e82e37
3 changed files with 19 additions and 4 deletions

View file

@ -5244,9 +5244,10 @@ void ScoreFont::draw(SymId id, QPainter* painter, qreal mag, const QPointF& _pos
_pm.setDevicePixelRatio(pixelRatio); // needed?
pm = new GlyphPixmap;
pm->pm = _pm;
pm->yo = gb->top;
pm->xo = gb->left;
cache->insert(gk, pm);
pm->yo = gb->top * pixelRatio;
pm->xo = gb->left * pixelRatio;
if (!cache->insert(gk, pm))
qDebug("cannot cache glyph");
FT_Done_Glyph(glyph);
}
painter->setWorldMatrixEnabled(false);
@ -5672,6 +5673,19 @@ qreal ScoreFont::width(const QList<SymId>& s, qreal mag) const
// ScoreFont
//---------------------------------------------------------
ScoreFont::ScoreFont(const ScoreFont& f)
{
face = 0;
_symbols = f._symbols;
_name = f._name;
_family = f._family;
_fontPath = f._fontPath;
_filename = f._filename;
// fontImage;
cache = 0;
}
ScoreFont::~ScoreFont()
{
delete cache;

View file

@ -2575,6 +2575,7 @@ class ScoreFont {
public:
ScoreFont() {}
ScoreFont(const ScoreFont&);
ScoreFont(const char* n, const char* f, const char* p, const char* fn)
: _name(n), _family(f), _fontPath(p), _filename(fn) {
_symbols = QVector<Sym>(int(SymId::lastSym) + 1);

View file

@ -723,7 +723,7 @@ void EditStyle::setValues()
QString mfont(lstyle.value(StyleIdx::MusicalSymbolFont).toString());
int idx = 0;
for (auto i : ScoreFont::scoreFonts()) {
for (const auto& i : ScoreFont::scoreFonts()) {
if (i.name().toLower() == mfont.toLower()) {
musicalSymbolFont->setCurrentIndex(idx);
break;