Compare commits

...

18 Commits

Author SHA1 Message Date
7dffc8245a Merge remote-tracking branch 'origin/hotfix/v9.3.1' into develop 2026-02-28 11:07:16 +03:00
2b46e0251f Merge pull request 'fix for prev binary' (#705) from fix/fix-bugs into hotfix/v9.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/705
2026-02-27 13:42:47 +00:00
078a58772c fix for prev binary 2026-02-27 16:37:30 +03:00
1753007900 Merge pull request 'Fix bug 80293' (#704) from fix/bug80293 into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/704
2026-02-27 08:55:33 +00:00
f43230dcaf Fix bug 80293 2026-02-27 11:45:55 +03:00
bb7d2ce8ee Merge pull request 'fix/bug79307' (#702) from fix/bug79307 into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/702
2026-02-26 14:57:59 +00:00
ed8a47cbb7 fix/bug79307
fix bug #79307
2026-02-26 17:27:18 +03:00
3b2721e2da fix/bug79307
fix bug #79307
2026-02-26 15:15:23 +03:00
19c66750a8 fix/bug79307
fix bug #79307
2026-02-25 23:09:05 +03:00
927f49291a Merge branch release/v9.3.0 into develop 2026-02-25 15:14:16 +00:00
d54f0326cd Merge branch release/v9.3.0 into master 2026-02-24 14:07:21 +00:00
269dd9b8bc Merge pull request 'Fix bugs 80287, 80300, 80281' (#699) from fix/bug-80287 into release/v9.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/699
2026-02-24 14:00:15 +00:00
9da0b82ead Fix bug 80281 2026-02-24 16:45:55 +03:00
e3334cbea5 Fix bug 80300 2026-02-24 14:27:45 +03:00
01c928c724 Fix bug 80287 2026-02-24 13:41:01 +03:00
7d06219664 Merge branch hotfix/v9.2.1 into master 2025-12-26 16:24:51 +00:00
e936b0e4e7 Merge branch hotfix/v9.2.1 into master 2025-12-25 10:57:58 +00:00
a22f0bfb60 Merge branch hotfix/v9.2.1 into master 2025-12-17 11:33:19 +00:00
10 changed files with 242 additions and 122 deletions

View File

@ -1068,25 +1068,28 @@ public:
{
case ODRAW::rtLineTo:
{
if (valuePointer + 1 > m_arPoints.size())
for (_UINT16 j = 0; j < m_arSegments[i].m_nCount; j++)
{
break;
if (valuePointer + 1 > m_arPoints.size())
{
break;
strVmlPath += L"l";
strVmlPath += std::to_wstring(m_arPoints[0].x);
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[0].y);
strVmlPath += L"l";
strVmlPath += std::to_wstring(m_arPoints[0].x);
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[0].y);
++valuePointer;
}
else
{
strVmlPath += L"l";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].y );
++valuePointer;
}
else
{
strVmlPath += L"l";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].y );
++valuePointer;
++valuePointer;
}
}
}break;
case ODRAW::rtCurveTo:

View File

@ -267,7 +267,7 @@ namespace SimpleTypes
std::wstring CGuid::ToString (bool braces) const
{
std::wstringstream sstream;
sstream << boost::wformat( L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" ) % m_oGUID.a % m_oGUID.b % m_oGUID.c % m_oGUID.d % m_oGUID.e % m_oGUID.f % m_oGUID.g % m_oGUID.h % m_oGUID.i % m_oGUID.j % m_oGUID.k;
sstream << boost::wformat( L"%08X-%04X-%04X-%02X%0X-%02X%02X%02X%02X%02X%02X" ) % m_oGUID.a % m_oGUID.b % m_oGUID.c % m_oGUID.d % m_oGUID.e % m_oGUID.f % m_oGUID.g % m_oGUID.h % m_oGUID.i % m_oGUID.j % m_oGUID.k;
std::wstring res = (braces ? L"{" : L"") + sstream.str() + (braces ? L"}" : L"");
return res;
}

View File

@ -5088,7 +5088,14 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer
oox_table_pr->m_oTblW->m_oW->GetValue() > 0 )
{
if ( oox_table_pr->m_oTblW->m_oW->IsPercent() == false)
odt_context->table_context()->set_default_column_width(oox_table_pr->m_oTblW->m_oW->GetValue() / 20.);
{
const double PtPerCm = 72 / 2.54;
const double TwPerPt = 20.0;
const double TwPerCm = PtPerCm * TwPerPt;
const double WidthCm = oox_table_pr->m_oTblW->m_oW->GetValue() / TwPerCm;
odt_context->table_context()->set_default_column_width(WidthCm);
table_properties->content_.style_width_ = odf_types::length(WidthCm, odf_types::length::cm);
}
}
else if ( oox_table_pr->m_oTblW->m_oType->GetValue() == SimpleTypes::tblwidthAuto &&
oox_table_pr->m_oTblW->m_oW->GetValue() == 0 )

View File

@ -227,7 +227,10 @@ void odf_table_context::end_table()
style_table_properties * table_props = style_->content_.add_get_style_table_properties();
if (table_props)
{
table_props->content_.style_width_ = length(length(impl_->current_table().table_width,length::pt).get_value_unit(length::cm),length::cm);
if( !table_props->content_.style_width_ )
{
table_props->content_.style_width_ = length(length(impl_->current_table().table_width,length::pt).get_value_unit(length::cm),length::cm);
}
}
}
}

View File

@ -3452,8 +3452,12 @@ bool CPdfEditor::EditAnnot(int _nPageIndex, int nID)
pAnnot = new PdfWriter::CPolygonLineAnnotation(pXref);
else if (oType.isName("FreeText"))
{
std::map<std::wstring, std::wstring> mapFont = PdfReader::GetAnnotFont(pPDFDocument, m_pReader->GetFontManager(), pFontList, &oAnnotRef);
m_mFonts.insert(mapFont.begin(), mapFont.end());
std::vector<PdfReader::CAnnotFontInfo> arrFont = PdfReader::GetAnnotFontInfos(pPDFDocument, m_pReader->GetFontManager(), pFontList, &oAnnotRef);
for (int i = 0; i < arrFont.size(); ++i)
{
PdfReader::CAnnotFontInfo oFontInfo = arrFont[i];
m_mFonts.insert(std::make_pair(oFontInfo.wsFontName, oFontInfo.wsFontPath));
}
pAnnot = new PdfWriter::CFreeTextAnnotation(pXref);
}
else if (oType.isName("Caret"))

View File

@ -1097,7 +1097,7 @@ HRESULT CPdfFile::put_FontName(const std::wstring& wsName)
{
std::wstring sTargetHash = wsName.substr(lastSpace + 1);
const std::map<std::wstring, std::wstring>& mFonts = m_pInternal->pReader->GetFonts();
auto it = std::find_if(mFonts.begin(), mFonts.end(), [&sTargetHash](const std::pair<const std::wstring, std::wstring>& pair)
std::map<std::wstring, std::wstring>::const_iterator it = std::find_if(mFonts.begin(), mFonts.end(), [&sTargetHash](const std::pair<const std::wstring, std::wstring>& pair)
{
const std::wstring& key = pair.first;
size_t pos = key.rfind(L' ');

View File

@ -218,6 +218,34 @@ bool CheckFontNameStyle(std::wstring& sName, const std::wstring& sStyle)
}
return bRet;
}
std::wstring Normalize(const std::wstring& wsName)
{
std::wstring s = wsName;
bool bIsRemove = false;
size_t lastSpace = s.find_last_of(L' ');
if (lastSpace != std::wstring::npos)
{
bIsRemove = true;
for (size_t nIndex = lastSpace + 1; nIndex < s.size(); ++nIndex)
{
wchar_t nChar = s.at(nIndex);
if (nChar < '0' || nChar > 'F' || (nChar > '9' && nChar < 'A'))
{
bIsRemove = false;
break;
}
}
if (bIsRemove)
s.erase(lastSpace + 1);
}
bool bDummy1 = false, bDummy2 = false;
PdfReader::CheckFontStylePDF(s, bDummy1, bDummy2);
NSStringExt::ToLower(s);
s.erase(std::remove_if(s.begin(), s.end(), [](wchar_t c){ return c == L' ' || c == L'-' || c == L'_'; }), s.end());
return s;
};
namespace PdfReader
{
@ -692,18 +720,19 @@ bool FindFonts(Object* oStream, int nDepth, Object* oResFonts)
oXObject.free(); oResources.free();
return false;
}
std::map<std::wstring, std::wstring> GetAnnotFont(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList *pFontList, Object* oAnnotRef)
std::vector<CAnnotFontInfo> GetAnnotFontInfos(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList* pFontList, Object* oAnnotRef)
{
std::vector<CAnnotFontInfo> result;
Object oAnnot, oObj;
XRef* pXref = pdfDoc->getXRef();
oAnnotRef->fetch(pXref, &oAnnot);
std::map<std::wstring, std::wstring> mFontFreeText;
Object oAP, oN;
if (!oAnnot.dictLookup("AP", &oAP)->isDict() || !oAP.dictLookup("N", &oN)->isStream())
{
oAP.free(); oN.free(); oAnnot.free();
return mFontFreeText;
return result;
}
oAP.free();
@ -711,13 +740,10 @@ std::map<std::wstring, std::wstring> GetAnnotFont(PDFDoc* pdfDoc, NSFonts::IFont
if (!FindFonts(&oN, 0, &oFonts))
{
oN.free(); oFonts.free(); oAnnot.free();
return mFontFreeText;
return result;
}
oN.free();
CFontList* pAppFontList = (CFontList*)pFontManager->GetApplication()->GetList();
NSFonts::IFontsMemoryStorage* pMemoryStorage = NSFonts::NSApplicationFontStream::GetGlobalMemoryStorage();
for (int i = 0, nFonts = oFonts.dictGetLength(); i < nFonts; ++i)
{
Object oFontRef;
@ -727,101 +753,132 @@ std::map<std::wstring, std::wstring> GetAnnotFont(PDFDoc* pdfDoc, NSFonts::IFont
continue;
}
CAnnotFontInfo info;
std::string sFontName, sActualFontName;
bool bBold = false, bItalic = false;
std::wstring sFontPath = GetFontData(pdfDoc, pFontManager, pFontList, &oFontRef, sFontName, sActualFontName, bBold, bItalic);
info.wsFontPath = GetFontData(pdfDoc, pFontManager, pFontList, &oFontRef, sFontName, sActualFontName, info.bBold, info.bItalic);
oFontRef.free();
if (sFontPath.empty() || IsBaseFont(sFontPath) || !sActualFontName.empty())
if (info.wsFontPath.empty() || IsBaseFont(info.wsFontPath))
continue;
std::wstring wsFontName = UTF8_TO_U(sFontName);
NSFonts::IFontStream* pFontStream = NULL;
bool bRemoveStream = false;
if (pMemoryStorage)
pFontStream = (NSFonts::IFontStream*)pMemoryStorage->Get(sFontPath);
else
{
pFontStream = NSFonts::NSStream::Create();
pFontStream->CreateFromFile(sFontPath);
bRemoveStream = true;
}
if (pFontStream)
{
bool bNew = true;
std::vector<NSFonts::CFontInfo*>* arrFontList = pAppFontList->GetFonts();
for (int nIndex = 0; nIndex < arrFontList->size(); ++nIndex)
{
if (((*arrFontList)[nIndex]->m_wsFontPath == sFontPath ||
(*arrFontList)[nIndex]->m_wsFontName == wsFontName) &&
(*arrFontList)[nIndex]->m_bBold == (bBold ? 1 : 0) &&
(*arrFontList)[nIndex]->m_bItalic == (bItalic ? 1 : 0))
{
bNew = false;
break;
}
}
if (bNew)
pAppFontList->Add(sFontPath, pFontStream);
}
if (bRemoveStream)
RELEASEINTERFACE(pFontStream);
mFontFreeText[wsFontName] = sFontPath;
info.wsFontName = UTF8_TO_U(sFontName);
if (!sActualFontName.empty())
info.wsActualFontName = UTF8_TO_U(sActualFontName);
result.push_back(info);
}
oFonts.free(); oAnnot.free();
return mFontFreeText;
return result;
}
int GetAnnotFontNamePenalty(const std::wstring& sCandNorm, const std::wstring& sReqNorm)
{
if (sReqNorm.empty())
return 0;
if (sCandNorm.empty())
return 10000;
if (sCandNorm == sReqNorm)
return 0;
bool bCandInReq = sReqNorm.find(sCandNorm) != std::wstring::npos;
bool bReqInCand = sCandNorm.find(sReqNorm) != std::wstring::npos;
if (bCandInReq || bReqInCand)
return 500;
return 10000;
}
const CAnnotFontInfo* FindMatchInAnnotFonts(const std::vector<CAnnotFontInfo>& annotFonts, const std::wstring& wsRCName, bool bBold, bool bItalic)
{
std::wstring wsReqNorm = Normalize(wsRCName);
const CAnnotFontInfo* pBestMatch = nullptr;
int nBestPenalty = INT_MAX;
for (const auto& fi : annotFonts)
{
int nNamePenalty = GetAnnotFontNamePenalty(Normalize(fi.wsFontName), wsReqNorm);
if (!fi.wsActualFontName.empty())
{
int nActualPenalty = GetAnnotFontNamePenalty(Normalize(fi.wsActualFontName), wsReqNorm);
if (nActualPenalty < nNamePenalty)
nNamePenalty = nActualPenalty;
}
if (nNamePenalty >= 5000)
continue;
int nBoldPenalty = (fi.bBold != bBold) ? 1 : 0;
int nItalicPenalty = (fi.bItalic != bItalic) ? 4 : 0;
int nTotalPenalty = nNamePenalty + nBoldPenalty + nItalicPenalty;
if (nTotalPenalty < nBestPenalty)
{
nBestPenalty = nTotalPenalty;
pBestMatch = &fi;
}
if (nTotalPenalty == 0)
break;
}
return pBestMatch;
}
std::map<std::wstring, std::wstring> GetFreeTextFont(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList* pFontList, Object* oAnnotRef, std::vector<CAnnotMarkup::CFontData*>& arrRC)
{
std::map<std::wstring, std::wstring> mRes;
std::map<std::wstring, std::wstring> mFontFreeText = GetAnnotFont(pdfDoc, pFontManager, pFontList, oAnnotRef);
std::vector<CAnnotFontInfo> annotFonts = GetAnnotFontInfos(pdfDoc, pFontManager, pFontList, oAnnotRef);
NSFonts::IFontsMemoryStorage* pMemoryStorage = NSFonts::NSApplicationFontStream::GetGlobalMemoryStorage();
CFontList* pAppFontList = (CFontList*)pFontManager->GetApplication()->GetList();
for (int i = 0; i < arrRC.size(); ++i)
for (int i = 0; i < (int)arrRC.size(); ++i)
{
if (arrRC[i]->bFind)
continue;
std::string sFontName = arrRC[i]->sFontFamily;
std::wstring wsFontName = UTF8_TO_U(sFontName);
bool bBold = (bool)((arrRC[i]->unFontFlags >> 0) & 1);
bool bBold = (bool)((arrRC[i]->unFontFlags >> 0) & 1);
bool bItalic = (bool)((arrRC[i]->unFontFlags >> 1) & 1);
if (IsBaseFont(wsFontName))
{
if (sFontName == "Times-Roman")
{
if (bBold && bItalic)
sFontName = "Times-BoldItalic";
else if (bBold)
sFontName = "Times-Bold";
else if (bItalic)
sFontName = "Times-Italic";
if (bBold && bItalic) sFontName = "Times-BoldItalic";
else if (bBold) sFontName = "Times-Bold";
else if (bItalic) sFontName = "Times-Italic";
}
else if (sFontName == "Courier" || sFontName == "Helvetica")
{
if (bBold && bItalic)
sFontName += "-BoldOblique";
else if (bBold)
sFontName += "-Bold";
else if (bItalic)
sFontName += "-Oblique";
if (bBold && bItalic) sFontName += "-BoldOblique";
else if (bBold) sFontName += "-Bold";
else if (bItalic) sFontName += "-Oblique";
}
wsFontName = UTF8_TO_U(sFontName);
const unsigned char* pData14 = NULL;
unsigned int nSize14 = 0;
NSFonts::IFontsMemoryStorage* pMemoryStorage = NSFonts::NSApplicationFontStream::GetGlobalMemoryStorage();
if (pMemoryStorage && !pMemoryStorage->Get(wsFontName) && GetBaseFont(wsFontName, pData14, nSize14))
pMemoryStorage->Add(wsFontName, (BYTE*)pData14, nSize14, false);
if (pMemoryStorage && !pMemoryStorage->Get(wsFontName))
{
const unsigned char* pData14 = NULL;
unsigned int nSize14 = 0;
if (GetBaseFont(wsFontName, pData14, nSize14))
pMemoryStorage->Add(wsFontName, (BYTE*)pData14, nSize14, false);
}
std::string sFontNameBefore = arrRC[i]->sFontFamily;
arrRC[i]->sFontFamily = sFontName;
arrRC[i]->bFind = true;
mRes[wsFontName] = wsFontName;
for (int j = i; j < arrRC.size(); ++j)
for (int j = i; j < (int)arrRC.size(); ++j)
{
if (arrRC[j]->sFontFamily == sFontNameBefore && bBold == (bool)((arrRC[j]->unFontFlags >> 0) & 1) && bItalic == (bool)((arrRC[j]->unFontFlags >> 1) & 1))
if (arrRC[j]->sFontFamily == sFontNameBefore &&
bBold == (bool)((arrRC[j]->unFontFlags >> 0) & 1) &&
bItalic == (bool)((arrRC[j]->unFontFlags >> 1) & 1))
{
arrRC[j]->sFontFamily = sFontName;
arrRC[j]->bFind = true;
@ -830,47 +887,57 @@ std::map<std::wstring, std::wstring> GetFreeTextFont(PDFDoc* pdfDoc, NSFonts::IF
}
else
{
NSFonts::CFontSelectFormat oFontSelect;
if (bBold)
oFontSelect.bBold = new INT(1);
if (bItalic)
oFontSelect.bItalic = new INT(1);
oFontSelect.wsName = new std::wstring(wsFontName);
const CAnnotFontInfo* pMatch = FindMatchInAnnotFonts(annotFonts, wsFontName, bBold, bItalic);
NSFonts::CFontInfo* pFontInfo = pAppFontList->GetByParams(oFontSelect);
if (pFontInfo && !pFontInfo->m_wsFontPath.empty())
std::wstring wsResolvedName;
std::wstring wsResolvedPath;
bool bFoundInAnnot = false;
if (pMatch)
{
std::wstring sFontPath = pFontInfo->m_wsFontPath;
bool bFindFreeText = false;
for (std::map<std::wstring, std::wstring>::iterator it = mFontFreeText.begin(); it != mFontFreeText.end(); ++it)
{
if (it->second == sFontPath)
{
bFindFreeText = true;
break;
}
}
std::wstring wsFontBaseName = pFontInfo->m_wsFontName;
EraseSubsetTag(wsFontBaseName);
wsResolvedPath = pMatch->wsFontPath;
wsResolvedName = pMatch->wsActualFontName.empty() ? pMatch->wsFontName : pMatch->wsActualFontName;
EraseSubsetTag(wsResolvedName);
bFoundInAnnot = true;
}
else
{
NSFonts::CFontSelectFormat oFontSelect;
if (bBold) oFontSelect.bBold = new INT(1);
if (bItalic) oFontSelect.bItalic = new INT(1);
oFontSelect.wsName = new std::wstring(wsFontName);
if (bFindFreeText)
NSFonts::CFontInfo* pFontInfo = pAppFontList->GetByParams(oFontSelect);
if (pFontInfo && !pFontInfo->m_wsFontPath.empty())
{
arrRC[i]->sFontFamily = U_TO_UTF8(wsFontBaseName);
mRes[wsFontBaseName] = pFontInfo->m_wsFontPath;
wsResolvedPath = pFontInfo->m_wsFontPath;
wsResolvedName = pFontInfo->m_wsFontName;
EraseSubsetTag(wsResolvedName);
}
}
if (!wsResolvedName.empty())
{
if (bFoundInAnnot)
{
arrRC[i]->sFontFamily = U_TO_UTF8(wsResolvedName);
mRes[wsResolvedName] = wsResolvedPath;
}
else
{
arrRC[i]->unFontFlags |= (1 << 6);
arrRC[i]->sActualFont = U_TO_UTF8(wsFontBaseName);
arrRC[i]->sActualFont = U_TO_UTF8(wsResolvedName);
}
arrRC[i]->bFind = true;
std::string sFontNameNew = bFindFreeText ? arrRC[i]->sFontFamily : arrRC[i]->sActualFont;
for (int j = i; j < arrRC.size(); ++j)
std::string sFontNameNew = bFoundInAnnot ? arrRC[i]->sFontFamily : arrRC[i]->sActualFont;
for (int j = i; j < (int)arrRC.size(); ++j)
{
if (arrRC[j]->sFontFamily == sFontName && bBold == (bool)((arrRC[j]->unFontFlags >> 0) & 1) && bItalic == (bool)((arrRC[j]->unFontFlags >> 1) & 1))
if (arrRC[j]->sFontFamily == sFontName &&
bBold == (bool)((arrRC[j]->unFontFlags >> 0) & 1) &&
bItalic == (bool)((arrRC[j]->unFontFlags >> 1) & 1))
{
if (bFindFreeText)
if (bFoundInAnnot)
arrRC[j]->sFontFamily = sFontNameNew;
else
{

View File

@ -46,13 +46,22 @@
namespace PdfReader
{
struct CAnnotFontInfo
{
std::wstring wsFontName;
std::wstring wsFontPath;
std::wstring wsActualFontName;
bool bBold = false;
bool bItalic = false;
};
std::string GetRCFromDS(const std::string& sDS, Object* pContents, const std::vector<double>& arrCFromDA);
bool IsNeedCMap(PDFDoc* pDoc);
bool IsBaseFont(const std::wstring& wsName);
std::map<std::wstring, std::wstring> GetAllFonts(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList* pFontList, bool bIsNeedCMap);
std::wstring GetFontData(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList *pFontList, Object* oFontRef, std::string& sFontName, std::string& sActualFontName, bool& bBold, bool& bItalic, bool bIsNeedCMap = false);
bool GetFontFromAP(PDFDoc* pdfDoc, AcroFormField* pField, Object* oFontRef, std::string& sFontKey);
std::map<std::wstring, std::wstring> GetAnnotFont(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList *pFontList, Object* oAnnotRef);
std::vector<CAnnotFontInfo> GetAnnotFontInfos(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList* pFontList, Object* oAnnotRef);
std::map<std::wstring, std::wstring> GetFreeTextFont(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList* pFontList, Object* oAnnotRef, std::vector<CAnnotMarkup::CFontData*>& arrRC);
bool FindFonts(Object* oStream, int nDepth, Object* oResFonts);
void CollectFontWidths(GfxFont* gfxFont, Dict* pFontDict, std::map<unsigned int, unsigned int>& mGIDToWidth);

View File

@ -146,7 +146,7 @@ namespace PdfWriter
{
if (m_pObj->GetType() != object_type_UNKNOWN)
return m_pObj;
return new PdfWriter::CProxyObject(m_pObj, true);
return new PdfWriter::CProxyObject(m_pObj);
}
CObjectBase* CFontEmbedded::GetObj2()
{

View File

@ -5104,15 +5104,42 @@ void Gfx::opEndIgnoreUndef(Object args[], int numArgs) {
void Gfx::SkipBDC()
{
Object obj;
// Стек аргументов (как в основном цикле обработки)
Object args[maxArgs];
int numArgs = 0;
getContentObj(&obj);
while (!obj.isEOF()) {
if (obj.isCmd("BMC") || obj.isCmd("BDC"))
SkipBDC();
else if (obj.isCmd("EMC"))
break;
obj.free();
getContentObj(&obj);
if (obj.isCmd("BMC") || obj.isCmd("BDC")) {
// Сбрасываем накопленные аргументы перед рекурсией
for (int i = 0; i < numArgs; ++i) args[i].free();
numArgs = 0;
SkipBDC();
} else if (obj.isCmd("EMC")) {
break;
} else if (obj.isCmd("Tf")) {
if (numArgs == 2) {
opSetFont(args, numArgs);
out->updateFont(state);
}
for (int i = 0; i < numArgs; ++i) args[i].free();
numArgs = 0;
} else if (obj.isCmd()) {
// Любая другая команда — просто сбрасываем аргументы
for (int i = 0; i < numArgs; ++i) args[i].free();
numArgs = 0;
} else {
// Операнд — кладём в стек аргументов
if (numArgs < maxArgs) {
obj.copy(&args[numArgs]);
++numArgs;
}
}
obj.free();
getContentObj(&obj);
}
for (int i = 0; i < numArgs; ++i) args[i].free();
obj.free();
}
void Gfx::opBeginMarkedContent(Object args[], int numArgs) {