void GlyphPBF::parse(GlyphStore* store, const std::string& fontStack, const GlyphRange& glyphRange) { assert(data); if (data->empty()) { // If there is no data, this means we either haven't // received any data. return; } try { parseGlyphPBF(**store->getFontStack(fontStack), *data); } catch (...) { observer->onGlyphsError(fontStack, glyphRange, std::current_exception()); return; } parsed = true; observer->onGlyphsLoaded(fontStack, glyphRange); }
void GlyphPBF::parse(GlyphStore* store, const std::string& fontStack, const std::string& url) { assert(data); if (data->empty()) { // If there is no data, this means we either haven't // received any data. return; } try { parseGlyphPBF(**store->getFontStack(fontStack), *data); } catch (const std::exception& ex) { std::stringstream message; message << "Failed to parse [" << url << "]: " << ex.what(); emitGlyphPBFLoadingFailed(message.str()); return; } parsed = true; emitGlyphPBFLoaded(); }