diff --git a/CHANGELOG.md b/CHANGELOG.md index eb2d3c1a4..cc1ed5b51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ - Fix map description issues in concurrent settings - Added a Helper to create geojson strings from GeoJsonPoints +## Version 2.0.6 (10.04.2024) +- log exception when a font can not be loaded + ## Version 2.0.5 (08.04.2024) - Expose thread_pool_callbacks in scheduler interface - call onRemoved on layerInterface before the mapScene is destroyed diff --git a/shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSymbolObject.cpp b/shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSymbolObject.cpp index 6c75efe81..c15e1294d 100644 --- a/shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSymbolObject.cpp +++ b/shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSymbolObject.cpp @@ -18,6 +18,7 @@ #include "Tiled2dMapSource.h" #include "Tiled2dMapVectorStyleParser.h" #include "CollisionUtil.h" +#include "ExceptionLogger.h" Tiled2dMapVectorSymbolObject::Tiled2dMapVectorSymbolObject(const std::weak_ptr &mapInterface, const std::shared_ptr &layerConfig, @@ -106,7 +107,7 @@ Tiled2dMapVectorSymbolObject::Tiled2dMapVectorSymbolObject(const std::weak_ptr fontResult; + std::shared_ptr fontResult = nullptr; for (const auto &font: fontList) { // try to load a font until we succeed @@ -124,26 +125,35 @@ Tiled2dMapVectorSymbolObject::Tiled2dMapVectorSymbolObject(const std::weak_ptrstyle.getTextOffset(evalContext); - const auto textRadialOffset = description->style.getTextRadialOffset(evalContext); - const auto letterSpacing = description->style.getTextLetterSpacing(evalContext); - - SymbolAlignment labelRotationAlignment = description->style.getTextRotationAlignment(evalContext); - boundingBoxRotationAlignment = labelRotationAlignment; - labelObject = std::make_shared(converter, featureContext, description, text, fullText, - coordinate, lineCoordinates, textAnchor, angle, - textJustify, fontResult, textOffset, textRadialOffset, - description->style.getTextLineHeight(evalContext), - letterSpacing, - description->style.getTextMaxWidth(evalContext), - description->style.getTextMaxAngle(evalContext), - labelRotationAlignment, textSymbolPlacement, - animationCoordinator, featureStateManager, - dpFactor); - - instanceCounts.textCharacters = labelObject->getCharacterCount(); - + if (fontResult) { + auto textOffset = description->style.getTextOffset(evalContext); + const auto textRadialOffset = description->style.getTextRadialOffset(evalContext); + const auto letterSpacing = description->style.getTextLetterSpacing(evalContext); + + SymbolAlignment labelRotationAlignment = description->style.getTextRotationAlignment(evalContext); + boundingBoxRotationAlignment = labelRotationAlignment; + labelObject = std::make_shared(converter, featureContext, description, text, fullText, + coordinate, lineCoordinates, textAnchor, angle, + textJustify, fontResult, textOffset, textRadialOffset, + description->style.getTextLineHeight(evalContext), + letterSpacing, + description->style.getTextMaxWidth(evalContext), + description->style.getTextMaxAngle(evalContext), + labelRotationAlignment, textSymbolPlacement, + animationCoordinator, featureStateManager, + dpFactor); + + instanceCounts.textCharacters = labelObject->getCharacterCount(); + } else { + // font could not be loaded + std::string fontString; + for (const auto &font: fontList) { + fontString.append(font + ","); + } + fontString.pop_back(); + ExceptionLogger::instance().logMessage("map-core:Tiled2dMapVectorSymbolObject", 0, "font (" + fontString + ") could not be loaded"); + LogError << "font (" << fontString <<=") could not be loaded"; + } } else { boundingBoxRotationAlignment = iconRotationAlignment; }