Commit 77b7f988 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander Trofimov

Исправлен баг с чтением юникодных значений Cid-шрифтов.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63327 954022d7-b5bf-4e40-9824-e11837661b57
parent 399a1dd5
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include "windows.h" #include "windows.h"
#include "../../../DesktopEditor/raster/BgraFrame.h"
#include "../../../DesktopEditor/raster/ImageFileFormatChecker.h"
std::vector<std::wstring> GetAllFilesInFolder(std::wstring wsFolder, std::wstring wsExt) std::vector<std::wstring> GetAllFilesInFolder(std::wstring wsFolder, std::wstring wsExt)
{ {
...@@ -68,6 +70,6 @@ void main() ...@@ -68,6 +70,6 @@ void main()
PdfReader::CPdfReader oPdfReader(&oFonts); PdfReader::CPdfReader oPdfReader(&oFonts);
oPdfReader.SetTempFolder(L"D://Test Files//Temp//"); oPdfReader.SetTempFolder(L"D://Test Files//Temp//");
oPdfReader.SetCMapFolder(L"D://Subversion//AVS//Redist//AVSOfficeStudio//CMaps//"); oPdfReader.SetCMapFolder(L"D://Subversion//AVS//Redist//AVSOfficeStudio//CMaps//");
ConvertFolder(oPdfReader, L"D://Test Files//"); ConvertFolder(oPdfReader, L"D://Test Files//3//");
} }
...@@ -1240,11 +1240,14 @@ namespace PdfReader ...@@ -1240,11 +1240,14 @@ namespace PdfReader
case fontCIDType2: case fontCIDType2:
case fontCIDType2OT: case fontCIDType2OT:
{ {
// Создаем карту CID-to-GID
// Если у нас есть мап ToUnicode, тогда на основе его читаем из файла гиды по юникодным значениям,
// если не нашли, но у нас есть мап CIDtoGID, тогда строим по последнему.
pCodeToGID = NULL; pCodeToGID = NULL;
nLen = 0; nLen = 0;
if (L"" != wsFileName) if (L"" != wsFileName)
{ {
// Создаем карту CID-to-GID
CharCodeToUnicode *pCodeToUnicode = NULL; CharCodeToUnicode *pCodeToUnicode = NULL;
if ((pCodeToUnicode = ((GrCIDFont *)pFont)->GetToUnicode())) if ((pCodeToUnicode = ((GrCIDFont *)pFont)->GetToUnicode()))
{ {
...@@ -1289,30 +1292,16 @@ namespace PdfReader ...@@ -1289,30 +1292,16 @@ namespace PdfReader
} }
pCodeToUnicode->Release(); pCodeToUnicode->Release();
} }
else
{
if (((GrCIDFont *)pFont)->GetCIDToGID())
{
nLen = ((GrCIDFont *)pFont)->GetCIDToGIDLen();
pCodeToGID = (unsigned short *)MemUtilsMallocArray(nLen, sizeof(unsigned short));
if (!pCodeToGID)
break;
memcpy(pCodeToGID, ((GrCIDFont *)pFont)->GetCIDToGID(), nLen * sizeof(unsigned short));
}
}
} }
else
if (!pCodeToGID && ((GrCIDFont *)pFont)->GetCIDToGID())
{ {
if (((GrCIDFont *)pFont)->GetCIDToGID()) nLen = ((GrCIDFont *)pFont)->GetCIDToGIDLen();
{ pCodeToGID = (unsigned short *)MemUtilsMallocArray(nLen, sizeof(unsigned short));
nLen = ((GrCIDFont *)pFont)->GetCIDToGIDLen(); if (!pCodeToGID)
pCodeToGID = (unsigned short *)MemUtilsMallocArray(nLen, sizeof(unsigned short)); break;
if (!pCodeToGID)
break;
memcpy(pCodeToGID, ((GrCIDFont *)pFont)->GetCIDToGID(), nLen * sizeof(unsigned short)); memcpy(pCodeToGID, ((GrCIDFont *)pFont)->GetCIDToGID(), nLen * sizeof(unsigned short));
}
} }
break; break;
......
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