SVG import: set C locale to make fractional units work.

This commit is contained in:
Alex Shvartzkop 2023-09-02 18:56:55 +03:00
parent 891583f616
commit 3bd8ff442d
1 changed files with 5 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include <nanosvg.h>
#include <algorithm>
#include <cmath>
#include <locale_io.h>
#include <eda_item.h>
#include "graphics_importer.h"
@ -55,6 +56,8 @@ bool SVG_IMPORT_PLUGIN::Load( const wxString& aFileName )
{
wxCHECK( m_importer, false );
LOCALE_IO toggle; // switch on/off the locale "C" notation
// 1- wxFopen takes care of unicode filenames across platforms
// 2 - nanosvg (exactly nsvgParseFromFile) expects a binary file (exactly the CRLF eof must
// not be replaced by LF and changes the byte count) in one validity test,
@ -77,6 +80,8 @@ bool SVG_IMPORT_PLUGIN::LoadFromMemory( const wxMemoryBuffer& aMemBuffer )
{
wxCHECK( m_importer, false );
LOCALE_IO toggle; // switch on/off the locale "C" notation
std::string str( reinterpret_cast<char*>( aMemBuffer.GetData() ), aMemBuffer.GetDataLen() );
wxCHECK( str.data()[aMemBuffer.GetDataLen()] == '\0', false );