From 56c55d0b0288a3ab57a95d2b3851a2a39c734e71 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 29 May 2014 02:36:47 +0000 Subject: [PATCH 1/9] add include needed for std::replace on linux --- src/text/glyph_store.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/text/glyph_store.cpp b/src/text/glyph_store.cpp index a355b28f2..95b295a79 100644 --- a/src/text/glyph_store.cpp +++ b/src/text/glyph_store.cpp @@ -5,6 +5,7 @@ #include #include #include +#include namespace llmr { From c85a0c3da2f296e8c78aa58a01e2bf83259a421d Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 28 May 2014 19:44:11 -0700 Subject: [PATCH 2/9] comment unfinished FontStack code --- src/map/tile_parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map/tile_parser.cpp b/src/map/tile_parser.cpp index f097913cc..7d8323960 100644 --- a/src/map/tile_parser.cpp +++ b/src/map/tile_parser.cpp @@ -206,7 +206,7 @@ std::unique_ptr TileParser::createTextBucket(const VectorTileLayer& laye } // Create a copy! - const FontStack fontStack = glyphStore.getFontStack(bucket_desc.geometry.font); + //const FontStack fontStack = glyphStore.getFontStack(bucket_desc.geometry.font); // Shape and place all labels. { From 5c46bef7176b6d8c784516eff6cc1915cf9b28a1 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 28 May 2014 19:57:01 -0700 Subject: [PATCH 3/9] fallback to boost::locale on linux --- include/llmr/util/utf.hpp | 44 +++++++++++++++++++++++++++++++++++++++ src/map/tile_parser.cpp | 11 ++++------ 2 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 include/llmr/util/utf.hpp diff --git a/include/llmr/util/utf.hpp b/include/llmr/util/utf.hpp new file mode 100644 index 000000000..fb9ab2048 --- /dev/null +++ b/include/llmr/util/utf.hpp @@ -0,0 +1,44 @@ +#ifndef LLMR_UTIL_UTF +#define LLMR_UTIL_UTF + +#include + +// g++/libstdc++ is missing c++11 codecvt support +#ifdef __linux__ +#include +#else +#include +#endif + +namespace llmr { + +namespace util { + +#ifdef __linux__ + +class utf8_to_utf32 { + public: + explicit utf8_to_utf32() + : utf32conv_() {} + std::u32string convert(std::string const& utf8) { + return boost::locale::conv::utf_to_utf(utf8) + } +}; +#else + +class utf8_to_utf32 { + public: + explicit utf8_to_utf32() + : utf32conv_() {} + std::u32string convert(std::string const& utf8) { + return utf32conv_.from_bytes(utf8); + } + private: + std::wstring_convert, char32_t> utf32conv_; +}; + +#endif + +}} + +#endif diff --git a/src/map/tile_parser.cpp b/src/map/tile_parser.cpp index 7d8323960..70085b309 100644 --- a/src/map/tile_parser.cpp +++ b/src/map/tile_parser.cpp @@ -12,8 +12,7 @@ #include #include - -#include +#include using namespace llmr; @@ -172,9 +171,7 @@ std::unique_ptr TileParser::createTextBucket(const VectorTileLayer& laye std::unique_ptr bucket = std::make_unique( tile.textVertexBuffer, tile.triangleElementsBuffer, bucket_desc, placement); - - std::wstring_convert, char32_t> ucs4conv; - + util::utf8_to_utf32 ucs4conv; // Determine and load glyph ranges { @@ -194,7 +191,7 @@ std::unique_ptr TileParser::createTextBucket(const VectorTileLayer& laye continue; } - const std::u32string string = ucs4conv.from_bytes(toString(it_prop->second)); + const std::u32string string = ucs4conv.convert(toString(it_prop->second)); // Loop through all characters of this text and collect unique codepoints. for (uint32_t chr : string) { @@ -224,7 +221,7 @@ std::unique_ptr TileParser::createTextBucket(const VectorTileLayer& laye continue; } - const std::u32string string = ucs4conv.from_bytes(toString(it_prop->second)); + const std::u32string string = ucs4conv.convert(toString(it_prop->second)); // TODO: Shape label // TODO: Place label From 97683460c18fe714a6a0f29f81b66739de893f91 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 28 May 2014 19:57:26 -0700 Subject: [PATCH 4/9] fix compile of glyph_store.cpp --- src/text/glyph_store.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text/glyph_store.cpp b/src/text/glyph_store.cpp index 95b295a79..459c2d971 100644 --- a/src/text/glyph_store.cpp +++ b/src/text/glyph_store.cpp @@ -92,7 +92,7 @@ void GlyphPBF::parse(FontStack &stack) { } } - stack.insert(id, glyph); + stack.insert(id, glyph.metrics, glyph.bitmap); } else { fontstack_pbf.skip(); } From 6b0465448d324888e7c484ae66a40aca1f71d5d6 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 28 May 2014 20:04:40 -0700 Subject: [PATCH 5/9] fix utf.hpp linux compile --- include/llmr/util/utf.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/llmr/util/utf.hpp b/include/llmr/util/utf.hpp index fb9ab2048..f23f616f8 100644 --- a/include/llmr/util/utf.hpp +++ b/include/llmr/util/utf.hpp @@ -18,12 +18,12 @@ namespace util { class utf8_to_utf32 { public: - explicit utf8_to_utf32() - : utf32conv_() {} + explicit utf8_to_utf32() {} std::u32string convert(std::string const& utf8) { return boost::locale::conv::utf_to_utf(utf8) } }; + #else class utf8_to_utf32 { From da0d436572fbf75bb5c0ba19e4cf4e2299696202 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 28 May 2014 20:28:37 -0700 Subject: [PATCH 6/9] missing semicolon --- include/llmr/util/utf.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/llmr/util/utf.hpp b/include/llmr/util/utf.hpp index f23f616f8..8aa85a90a 100644 --- a/include/llmr/util/utf.hpp +++ b/include/llmr/util/utf.hpp @@ -20,7 +20,7 @@ class utf8_to_utf32 { public: explicit utf8_to_utf32() {} std::u32string convert(std::string const& utf8) { - return boost::locale::conv::utf_to_utf(utf8) + return boost::locale::conv::utf_to_utf(utf8); } }; From d702152068affd0792fb6e4588559efafbcedcdf Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 28 May 2014 20:34:34 -0700 Subject: [PATCH 7/9] temporarily remove directory caching --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9dde1b9bb..3a3a66e52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,6 @@ compiler: cache: - apt -- directories: - - mapnik-packaging before_install: - sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test From cbd881c020549bcb8b6dcf633ff500e45e90c54b Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 28 May 2014 20:34:48 -0700 Subject: [PATCH 8/9] Revert "temporarily remove directory caching" This reverts commit d702152068affd0792fb6e4588559efafbcedcdf. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3a3a66e52..9dde1b9bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,8 @@ compiler: cache: - apt +- directories: + - mapnik-packaging before_install: - sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test From 6e5ff8c1226965a31a22d5097d4a7de48f6dd6e1 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 28 May 2014 21:00:34 -0700 Subject: [PATCH 9/9] also find boost headers in include --- setup-libraries.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup-libraries.sh b/setup-libraries.sh index d43461111..fca19fd9c 100755 --- a/setup-libraries.sh +++ b/setup-libraries.sh @@ -71,7 +71,7 @@ source MacOSX.sh if [ ! -f out/build-cpp11-libcpp-x86_64/lib/libuv.a ] ; then ./scripts/build_libuv.sh ; fi if [ ! -f out/build-cpp11-libcpp-x86_64/lib/libssl.a ] ; then ./scripts/build_openssl.sh ; fi if [ ! -f out/build-cpp11-libcpp-x86_64/lib/libcurl.a ] ; then ./scripts/build_curl.sh ; fi - if [ ! -d out/build-cpp11-libcpp-x86_64/include/boost ] ; then ./scripts/build_boost.sh `pwd`/../../src/ `pwd`/../../linux/ `pwd`/../../common/ ; fi + if [ ! -d out/build-cpp11-libcpp-x86_64/include/boost ] ; then ./scripts/build_boost.sh `pwd`/../../src/ `pwd`/../../include/ `pwd`/../../linux/ `pwd`/../../common/ ; fi echo ' ...done' rm -rf out/packages @@ -91,7 +91,7 @@ source Linux.sh if [ ! -f out/build-cpp11-libstdcpp-gcc-x86_64/lib/libuv.a ] ; then ./scripts/build_libuv.sh ; fi if [ ! -f out/build-cpp11-libstdcpp-gcc-x86_64/lib/libssl.a ] ; then ./scripts/build_openssl.sh ; fi if [ ! -f out/build-cpp11-libstdcpp-gcc-x86_64/lib/libcurl.a ] ; then ./scripts/build_curl.sh ; fi - if [ ! -d out/build-cpp11-libstdcpp-gcc-x86_64/include/boost ] ; then ./scripts/build_boost.sh `pwd`/../../src/ `pwd`/../../linux/ `pwd`/../../common/ ; fi + if [ ! -d out/build-cpp11-libstdcpp-gcc-x86_64/include/boost ] ; then ./scripts/build_boost.sh `pwd`/../../src/ `pwd`/../../include/ `pwd`/../../linux/ `pwd`/../../common/ ; fi rm -rf out/packages