From cca9d81ee75bc045e8fa790822b7a1ec83b3dbaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 28 May 2014 15:51:09 +0200 Subject: [PATCH] add debug warnings --- include/llmr/util/constants.hpp | 5 +++++ src/map/tile_parser.cpp | 7 ++++++- src/renderer/text_bucket.cpp | 7 +++++++ src/util/constants.cpp | 5 +++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/include/llmr/util/constants.hpp b/include/llmr/util/constants.hpp index 70befcb37..f315e5171 100644 --- a/include/llmr/util/constants.hpp +++ b/include/llmr/util/constants.hpp @@ -19,6 +19,11 @@ extern const bool styleParseWarnings; extern const bool spriteWarnings; extern const bool renderWarnings; extern const bool renderTree; +extern const bool labelTextMissingWarning; +extern const bool missingFontStackWarning; +extern const bool missingFontFaceWarning; +extern const bool glyphWarning; +extern const bool shapingWarning; } diff --git a/src/map/tile_parser.cpp b/src/map/tile_parser.cpp index 49444428a..434372944 100644 --- a/src/map/tile_parser.cpp +++ b/src/map/tile_parser.cpp @@ -163,9 +163,11 @@ std::unique_ptr TileParser::createIconBucket(const VectorTileLayer& laye } std::unique_ptr TileParser::createTextBucket(const VectorTileLayer& layer, const BucketDescription& bucket_desc) { - // Determine the correct text stack. if (!layer.shaping.size()) { + if (debug::missingFontStackWarning) { + fprintf(stderr, "[WARNING] missing font stack '%s'\n", bucket_desc.geometry.font.c_str()); + } return nullptr; } @@ -179,6 +181,9 @@ std::unique_ptr TileParser::createTextBucket(const VectorTileLayer& laye auto it = const_faces.find(face); if (it == const_faces.end()) { // This layer references an unknown face. + if (debug::missingFontFaceWarning) { + fprintf(stderr, "[WARNING] missing font face '%s'\n", face.c_str()); + } return nullptr; } faces.push_back(&it->second); diff --git a/src/renderer/text_bucket.cpp b/src/renderer/text_bucket.cpp index 0fd351343..310baf374 100644 --- a/src/renderer/text_bucket.cpp +++ b/src/renderer/text_bucket.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -103,12 +104,18 @@ void TextBucket::addFeature(const VectorTileFeature &feature, auto it_prop = feature.properties.find(geom_desc.field); if (it_prop == feature.properties.end()) { // feature does not have the correct property + if (debug::labelTextMissingWarning) { + fprintf(stderr, "[WARNING] feature doesn't have property '%s' required for labelling\n", geom_desc.field.c_str()); + } return; } const Value &value = it_prop->second; auto it_shaping = shapings.find(value); if (it_shaping == shapings.end()) { + if (debug::shapingWarning) { + fprintf(stderr, "[WARNING] missing shaping for '%s'\n", toString(value).c_str()); + } // we lack shaping information for this label return; } diff --git a/src/util/constants.cpp b/src/util/constants.cpp index 2a4ecd374..f67464926 100644 --- a/src/util/constants.cpp +++ b/src/util/constants.cpp @@ -7,3 +7,8 @@ const bool llmr::debug::styleParseWarnings = false; const bool llmr::debug::spriteWarnings = false; const bool llmr::debug::renderWarnings = false; const bool llmr::debug::renderTree = false; +const bool llmr::debug::labelTextMissingWarning = true; +const bool llmr::debug::missingFontStackWarning = true; +const bool llmr::debug::missingFontFaceWarning = true; +const bool llmr::debug::glyphWarning = true; +const bool llmr::debug::shapingWarning = true;