[mapguide-commits] r9352 - sandbox/jng/common_decouple/Common/Renderers

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sat Mar 3 09:59:05 PST 2018


Author: jng
Date: 2018-03-03 09:59:05 -0800 (Sat, 03 Mar 2018)
New Revision: 9352

Modified:
   sandbox/jng/common_decouple/Common/Renderers/AGGRenderer.cpp
Log:
Use UnicodeString::WideCharToMultiByte in the absence of DWFCore::DWFString::EncodeUTF8

Modified: sandbox/jng/common_decouple/Common/Renderers/AGGRenderer.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Renderers/AGGRenderer.cpp	2018-03-03 17:47:19 UTC (rev 9351)
+++ sandbox/jng/common_decouple/Common/Renderers/AGGRenderer.cpp	2018-03-03 17:59:05 UTC (rev 9352)
@@ -1487,17 +1487,20 @@
     if (cxt->last_font != font)
     {
         // convert font path to utf8
+#ifdef WITH_DWF
         size_t lenf = font->m_filename.length();
         size_t lenbytesf = lenf * 4 + 1;
         char* futf8 = (char*)alloca(lenbytesf);
-#ifdef WITH_DWF
         DWFCore::DWFString::EncodeUTF8(font->m_filename.c_str(), lenf * sizeof(wchar_t), futf8, lenbytesf);
+        // load the font
+        bool res = cxt->feng.load_font(futf8, 0, glyph_type);
 #else
-        //TODO: Alternate implementation of EncodeUTF8
+        std::string mbFont;
+        UnicodeString::WideCharToMultiByte(font->m_filename.c_str(), mbFont);
+        // load the font
+        bool res = cxt->feng.load_font(mbFont.c_str(), 0, glyph_type);
 #endif
 
-        // load the font
-        bool res = cxt->feng.load_font(futf8, 0, glyph_type);
         cxt->feng.char_map(FT_ENCODING_UNICODE);
 
         if (!res)
@@ -1612,16 +1615,18 @@
     if (c()->last_font != font)
     {
         // convert font path to utf8
+#ifdef WITH_DWF
         size_t lenf = font->m_filename.length();
         size_t lenbytesf = lenf * 4 + 1;
         char* futf8 = (char*)alloca(lenbytesf);
-#ifdef WITH_DWF
         DWFCore::DWFString::EncodeUTF8(font->m_filename.c_str(), lenf * sizeof(wchar_t), futf8, lenbytesf);
+        bool res1 = c()->feng.load_font(futf8, 0, agg::glyph_ren_agg_gray8);
 #else
-        //TODO: Alternate implementation of EncodeUTF8
+        std::string mbFont;
+        UnicodeString::WideCharToMultiByte(font->m_filename.c_str(), mbFont);
+        bool res1 = c()->feng.load_font(mbFont.c_str(), 0, agg::glyph_ren_agg_gray8);
 #endif
 
-        bool res1 = c()->feng.load_font(futf8, 0, agg::glyph_ren_agg_gray8);
         c()->feng.char_map(FT_ENCODING_UNICODE);
 
         if (!res1)



More information about the mapguide-commits mailing list