diff --git a/DesktopEditor/common/File.h b/DesktopEditor/common/File.h index 7f656b7592..7b72918905 100644 --- a/DesktopEditor/common/File.h +++ b/DesktopEditor/common/File.h @@ -868,7 +868,7 @@ namespace NSFile CloseHandle( hFile ); #else std::string sFileUTF8 = U_TO_UTF8(sPath); - bIsSuccess = (0 == truncate(sFileUTF8, NewSize)); + bIsSuccess = (0 == truncate(sFileUTF8.c_str(), nNewSize)); #endif return bIsSuccess; } diff --git a/DesktopEditor/doctrenderer/nativecontrol.h b/DesktopEditor/doctrenderer/nativecontrol.h index bc0c18012b..8d0d380e90 100644 --- a/DesktopEditor/doctrenderer/nativecontrol.h +++ b/DesktopEditor/doctrenderer/nativecontrol.h @@ -356,14 +356,25 @@ void _GetFontArrayBuffer(const v8::FunctionCallbackInfo& args) // по идее файлы могут совпадать по имени, но лежать в разных директориях. // и поэтому в AllFonts.js надо бы писать пути полные. // пока оставим по-старому + std::wstring sFind = to_cstring(args[0]); + bool bIsFullFilePath = (std::wstring::npos != sFind.find('\\') || std::wstring::npos != sFind.find('/')); + if (bIsFullFilePath) { - std::wstring sFind = to_cstring(args[0]); + bIsFullFilePath = NSFile::CFileBinary::Exists(sFind); + } + + if (!bIsFullFilePath) + { std::map::iterator pair = pNative->m_map_fonts.find(sFind); if (pair != pNative->m_map_fonts.end()) strDir = pair->second; else strDir = pNative->m_sDefaultFont; } + else + { + strDir = sFind; + } pNative->getFileData(strDir, pData, len);