static void addSymbolToText(const SymCode& s, QTextCursor* cur) { QTextCharFormat oFormat = cur->charFormat(); if (s.fontId >= 0) { QTextCharFormat oFormat = cur->charFormat(); QTextCharFormat nFormat(oFormat); nFormat.setFontFamily(fontId2font(s.fontId).family()); cur->setCharFormat(nFormat); cur->insertText(QChar(s.code)); cur->setCharFormat(oFormat); } else cur->insertText(QChar(s.code)); }
void Text::addSymbol(const SymCode& s, QTextCursor* cur) { if (cur == 0) cur = _cursor; if (s.fontId >= 0) { QTextCharFormat nFormat(cur->charFormat()); nFormat.setFontFamily(fontId2font(s.fontId).family()); QString ss; if (s.code >= 0x10000) { ss = QChar(QChar::highSurrogate(s.code)); ss += QChar(QChar::lowSurrogate(s.code)); } else ss = QChar(s.code); cur->insertText(ss, nFormat); } else cur->insertText(QChar(s.code)); score()->setLayoutAll(true); score()->end(); }
void Text::addSymbol(const SymCode& s) { if (styled()) { SimpleText::addSymbol(s); return; } if (s.fontId >= 0) { QTextCharFormat nFormat(_cursor->charFormat()); nFormat.setFontFamily(fontId2font(s.fontId).family()); QString ss; if (s.code >= 0x10000) { ss = QChar(QChar::highSurrogate(s.code)); ss += QChar(QChar::lowSurrogate(s.code)); } else ss = QChar(s.code); _cursor->insertText(ss, nFormat); } else _cursor->insertText(QChar(s.code)); score()->setLayoutAll(true); score()->end(); }