⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 notefontmap.cpp

📁 LINUX下的混音软件
💻 CPP
📖 第 1 页 / 共 3 页
字号:
            m_errorString = "font-id is a required attribute of codebase";            return false;        }        fn = fontId.stripWhiteSpace().toInt(&ok);        if (!ok || fn < 0) {            m_errorString =                QString("invalid font-id attribute \"%1\" (must be integer >= 0)").                arg(fontId);            return false;        }        m_bases[fn] = bn;    } else if (lcName == "symbol") {        QString symbolName = attributes.value("name");        if (!symbolName) {            m_errorString = "name is a required attribute of symbol";            return false;        }        SymbolData symbolData;        QString src = attributes.value("src");        QString code = attributes.value("code");        QString glyph = attributes.value("glyph");        int icode = -1;        bool ok = false;        if (code) {            icode = code.stripWhiteSpace().toInt(&ok);            if (!ok || icode < 0) {                m_errorString =                    QString("invalid code attribute \"%1\" (must be integer >= 0)").                    arg(code);                return false;            }            symbolData.setCode(icode);        }        int iglyph = -1;        ok = false;        if (glyph) {            iglyph = glyph.stripWhiteSpace().toInt(&ok);            if (!ok || iglyph < 0) {                m_errorString =                    QString("invalid glyph attribute \"%1\" (must be integer >= 0)").                    arg(glyph);                return false;            }            symbolData.setGlyph(iglyph);        }        if (!src && icode < 0 && iglyph < 0) {            m_errorString = "symbol must have either src, code, or glyph attribute";            return false;        }        if (src)            symbolData.setSrc(qstrtostr(src));        QString inversionSrc = attributes.value("inversion-src");        if (inversionSrc)            symbolData.setInversionSrc(qstrtostr(inversionSrc));        QString inversionCode = attributes.value("inversion-code");        if (inversionCode) {            icode = inversionCode.stripWhiteSpace().toInt(&ok);            if (!ok || icode < 0) {                m_errorString =                    QString("invalid inversion code attribute \"%1\" (must be integer >= 0)").                    arg(inversionCode);                return false;            }            symbolData.setInversionCode(icode);        }        QString inversionGlyph = attributes.value("inversion-glyph");        if (inversionGlyph) {            iglyph = inversionGlyph.stripWhiteSpace().toInt(&ok);            if (!ok || iglyph < 0) {                m_errorString =                    QString("invalid inversion glyph attribute \"%1\" (must be integer >= 0)").                    arg(inversionGlyph);                return false;            }            symbolData.setInversionGlyph(iglyph);        }        QString fontId = attributes.value("font-id");        if (fontId) {            int n = fontId.stripWhiteSpace().toInt(&ok);            if (!ok || n < 0) {                m_errorString =                    QString("invalid font-id attribute \"%1\" (must be integer >= 0)").                    arg(fontId);                return false;            }            symbolData.setFontId(n);        }        m_data[qstrtostr(symbolName.upper())] = symbolData;    } else if (lcName == "font-hotspots") {    }    else if (lcName == "hotspot") {        QString s = attributes.value("name");        if (!s) {            m_errorString = "name is a required attribute of hotspot";            return false;        }        m_hotspotCharName = qstrtostr(s.upper());    } else if (lcName == "scaled") {        if (m_hotspotCharName == "") {            m_errorString = "scaled-element must be in hotspot-element";            return false;        }        QString s = attributes.value("x");        double x = -1.0;        if (s)            x = qstrtodouble(s);        s = attributes.value("y");        if (!s) {            m_errorString = "y is a required attribute of scaled";            return false;        }        double y = qstrtodouble(s);        HotspotDataMap::iterator i = m_hotspots.find(m_hotspotCharName);        if (i == m_hotspots.end()) {            m_hotspots[m_hotspotCharName] = HotspotData();            i = m_hotspots.find(m_hotspotCharName);        }        i->second.setScaledHotspot(x, y);    } else if (lcName == "fixed") {        if (m_hotspotCharName == "") {            m_errorString = "fixed-element must be in hotspot-element";            return false;        }        QString s = attributes.value("x");        int x = 0;        if (s)            x = s.toInt();        s = attributes.value("y");        int y = 0;        if (s)            y = s.toInt();        HotspotDataMap::iterator i = m_hotspots.find(m_hotspotCharName);        if (i == m_hotspots.end()) {            m_hotspots[m_hotspotCharName] = HotspotData();            i = m_hotspots.find(m_hotspotCharName);        }        i->second.addHotspot(0, x, y);    } else if (lcName == "when") {        if (m_hotspotCharName == "") {            m_errorString = "when-element must be in hotspot-element";            return false;        }        QString s = attributes.value("note-height");        if (!s) {            m_errorString = "note-height is a required attribute of when";            return false;        }        int noteHeight = s.toInt();        s = attributes.value("x");        int x = 0;        if (s)            x = s.toInt();        s = attributes.value("y");        if (!s) {            m_errorString = "y is a required attribute of when";            return false;        }        int y = s.toInt();        HotspotDataMap::iterator i = m_hotspots.find(m_hotspotCharName);        if (i == m_hotspots.end()) {            m_hotspots[m_hotspotCharName] = HotspotData();            i = m_hotspots.find(m_hotspotCharName);        }        i->second.addHotspot(noteHeight, x, y);    } else if (lcName == "font-requirements") {    }    else if (lcName == "font-requirement") {        QString id = attributes.value("font-id");        int n = -1;        bool ok = false;        if (id) {            n = id.stripWhiteSpace().toInt(&ok);            if (!ok) {                m_errorString =                    QString("invalid font-id attribute \"%1\" (must be integer >= 0)").                    arg(id);                return false;            }        } else {            m_errorString = "font-id is a required attribute of font-requirement";            return false;        }        QString name = attributes.value("name");        QString names = attributes.value("names");        if (name) {            if (names) {                m_errorString = "font-requirement may have name or names attribute, but not both";                return false;            }            SystemFont *font = SystemFont::loadSystemFont                               (SystemFontSpec(name, 12));            if (font) {                m_systemFontNames[n] = name;                delete font;            } else {                std::cerr << QString("Warning: Unable to load font \"%1\"").arg(name) << std::endl;                m_ok = false;            }        } else if (names) {            bool have = false;            QStringList list = QStringList::split(",", names, false);            for (QStringList::Iterator i = list.begin(); i != list.end(); ++i) {                SystemFont *font = SystemFont::loadSystemFont                                   (SystemFontSpec(*i, 12));                if (font) {                    m_systemFontNames[n] = *i;                    have = true;                    delete font;                    break;                }            }            if (!have) {                std::cerr << QString("Warning: Unable to load any of the fonts in \"%1\"").                arg(names) << std::endl;                m_ok = false;            }        } else {            m_errorString = "font-requirement must have either name or names attribute";            return false;        }        QString s = attributes.value("strategy").lower();        SystemFont::Strategy strategy = SystemFont::PreferGlyphs;        if (s) {            if (s == "prefer-glyphs")                strategy = SystemFont::PreferGlyphs;            else if (s == "prefer-codes")                strategy = SystemFont::PreferCodes;            else if (s == "only-glyphs")                strategy = SystemFont::OnlyGlyphs;            else if (s == "only-codes")                strategy = SystemFont::OnlyCodes;            else {                std::cerr << "Warning: Unknown strategy value " << s                << " (known values are prefer-glyphs, prefer-codes,"                << " only-glyphs, only-codes)" << std::endl;            }        }        m_systemFontStrategies[n] = strategy;    } else {    }    if (m_characterDestination)        *m_characterDestination = "";    return true;}boolNoteFontMap::error(const QXmlParseException& exception){    m_errorString = QString("%1 at line %2, column %3: %4")                    .arg(exception.message())                    .arg(exception.lineNumber())                    .arg(exception.columnNumber())                    .arg(m_errorString);    return QXmlDefaultHandler::error(exception);}boolNoteFontMap::fatalError(const QXmlParseException& exception){    m_errorString = QString("%1 at line %2, column %3: %4")                    .arg(exception.message())                    .arg(exception.lineNumber())                    .arg(exception.columnNumber())                    .arg(m_errorString);    return QXmlDefaultHandler::fatalError(exception);}std::set<int>NoteFontMap::getSizes() const{    std::set<int> sizes;        for (SizeDataMap::const_iterator i = m_sizes.begin();         i != m_sizes.end(); ++i) {        sizes.insert(i->first);    }        return sizes;}std::set<CharName>NoteFontMap::getCharNames() const{    std::set<CharName> names;    for (SymbolDataMap::const_iterator i = m_data.begin();         i != m_data.end(); ++i) {        names.insert(i->first);    }        return names;}boolNoteFontMap::checkFile(int size, std::string &src) const{    QString pixmapFileMixedName = QString("%1/%2/%3/%4.xpm")                                  .arg(m_fontDirectory)                                  .arg(strtoqstr(m_srcDirectory))                                  .arg(size)                                  .arg(strtoqstr(src));    QFileInfo pixmapFileMixedInfo(pixmapFileMixedName);    if (!pixmapFileMixedInfo.isReadable()) {        QString pixmapFileLowerName = QString("%1/%2/%3/%4.xpm")                                      .arg(m_fontDirectory)                                      .arg(strtoqstr(m_srcDirectory).lower())                                      .arg(size)                                      .arg(strtoqstr(src));        QFileInfo pixmapFileLowerInfo(pixmapFileLowerName);        if (!pixmapFileLowerInfo.isReadable()) {            if (pixmapFileMixedName != pixmapFileLowerName) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -