Browse Source

Follow-up of https://github.com/prusa3d/Slic3r/commit/8ea8eb67e46b019febcbf5c77f5f4e9786aab57e, utf-8 path conversion moved into nanosvg library

Enrico Turri 6 years ago
parent
commit
46eafca0eb
2 changed files with 6 additions and 4 deletions
  1. 4 2
      src/nanosvg/nanosvg.h
  2. 2 2
      src/slic3r/GUI/GLTexture.cpp

+ 4 - 2
src/nanosvg/nanosvg.h

@@ -2897,6 +2897,8 @@ NSVGimage* nsvgParse(char* input, const char* units, float dpi)
 	return ret;
 }
 
+#include <boost/nowide/cstdio.hpp>
+
 NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi)
 {
 	FILE* fp = NULL;
@@ -2904,8 +2906,8 @@ NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi)
 	char* data = NULL;
 	NSVGimage* image = NULL;
 
-	fp = fopen(filename, "rb");
-	if (!fp) goto error;
+    fp = boost::nowide::fopen(filename, "rb");
+    if (!fp) goto error;
 	fseek(fp, 0, SEEK_END);
 	size = ftell(fp);
 	fseek(fp, 0, SEEK_SET);

+ 2 - 2
src/slic3r/GUI/GLTexture.cpp

@@ -108,7 +108,7 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector<std::stri
         if (!boost::algorithm::iends_with(filename, ".svg"))
             continue;
 
-        NSVGimage* image = nsvgParseFromFile(encode_path(filename.c_str()).c_str(), "px", 96.0f);
+        NSVGimage* image = nsvgParseFromFile(filename.c_str(), "px", 96.0f);
         if (image == nullptr)
             continue;
 
@@ -361,7 +361,7 @@ bool GLTexture::load_from_png(const std::string& filename, bool use_mipmaps)
 
 bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, unsigned int max_size_px)
 {
-    NSVGimage* image = nsvgParseFromFile(encode_path(filename.c_str()).c_str(), "px", 96.0f);
+    NSVGimage* image = nsvgParseFromFile(filename.c_str(), "px", 96.0f);
     if (image == nullptr)
     {
 //        printf("Could not open SVG image.\n");