Commit 45c2f923 authored by Ilya Kirillov's avatar Ilya Kirillov

Fixed issue with relative font url.

parent 100fb404
......@@ -79,8 +79,11 @@ namespace XPS
sFontData[nIndex] ^= sKey[nIndex % 16];
FILE* pFile = oFile.GetFileNative();
fseek(pFile, 0, SEEK_SET);
fwrite(sFontData, 1, 32, pFile);
if (pFile)
{
fseek(pFile, 0, SEEK_SET);
fwrite(sFontData, 1, 32, pFile);
}
oFile.CloseFile();
}
......
......@@ -437,7 +437,22 @@ namespace XPS
{
wsFontPath = oReader.GetText();
std::wstring wsFontName = GetFileName(wsFontPath);
wsFontPath = m_wsRootPath + L"/" + wsFontPath;
if (wsFontPath.length() >= 0 && '.' == wsFontPath.at(0))
{
int nSlashPos = m_wsPagePath.find_last_of(L'/');
if (std::wstring::npos == nSlashPos)
nSlashPos = -1;
std::wstring wsRelativePath = (std::wstring::npos == nSlashPos) ? m_wsPagePath : m_wsPagePath.substr(0, nSlashPos + 1);
wsFontPath = wsRelativePath + wsFontPath;
}
else
{
wsFontPath = m_wsRootPath + L"/" + wsFontPath;
}
std::wstring wsExt = GetFileExtension(wsFontPath);
NSStringExt::ToLower(wsExt);
if (L"odttf" == wsExt)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment