From c96df4e62ee996469aeae2a6b2e24e0a5303a7df Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Tue, 7 Apr 2026 22:11:37 +0300 Subject: [PATCH 1/9] Fix bugs in fromUnicode method --- UnicodeConverter/UnicodeConverter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/UnicodeConverter/UnicodeConverter.cpp b/UnicodeConverter/UnicodeConverter.cpp index 1a4ebeea40..68737f1153 100644 --- a/UnicodeConverter/UnicodeConverter.cpp +++ b/UnicodeConverter/UnicodeConverter.cpp @@ -105,6 +105,8 @@ namespace NSUnicodeConverter UErrorCode status = U_ZERO_ERROR; int32_t nUCharCapacity = (int32_t)nInputLen;// UTF-16 uses 2 code-points per char + if (sizeof(wchar_t) > 2) + nUCharCapacity *= 2; UChar* pUChar = new UChar[(uint32_t)nUCharCapacity * sizeof(UChar)]; if (pUChar) @@ -169,8 +171,9 @@ namespace NSUnicodeConverter if (U_SUCCESS(status)) { int32_t nUCharCapacity = (int32_t)nInputLen;// UTF-16 uses 2 code-points per char + if (sizeof(wchar_t) > 2) + nUCharCapacity *= 2; - //UChar* pUChar = new UChar[nUCharCapacity]; UChar* pUChar = (UChar*)malloc((uint32_t)nUCharCapacity * sizeof(UChar)); if (pUChar) { @@ -196,7 +199,7 @@ namespace NSUnicodeConverter sRes.clear(); } } - //delete []pUCharStart; + free(pUChar); } ucnv_close(conv); } From 6badba384cdcbec4ba5179b06eab0f4477edb158 Mon Sep 17 00:00:00 2001 From: Daria Ermakova Date: Wed, 8 Apr 2026 11:27:44 +0300 Subject: [PATCH 2/9] For bug 80374 --- TxtFile/Source/TxtFormat/TxtFile.cpp | 37 ---------------------------- 1 file changed, 37 deletions(-) diff --git a/TxtFile/Source/TxtFormat/TxtFile.cpp b/TxtFile/Source/TxtFormat/TxtFile.cpp index 3a011ddc32..7ff7971523 100644 --- a/TxtFile/Source/TxtFormat/TxtFile.cpp +++ b/TxtFile/Source/TxtFormat/TxtFile.cpp @@ -100,45 +100,8 @@ const std::vector TxtFile::readUtf8Lines(int IdxEncoding) { unicode_content = conv.toUnicode(file_data.get(), read_size, 65001); } -#if !defined(_WIN32) && !defined(_WIN64) - std::wstring regular_text; - std::string utf8_result; - for (size_t i = 0; i < unicode_content.size(); i++) - { - unsigned int cp = static_cast(unicode_content[i]); - - if (cp > 0xFFFF) - { - - if (!regular_text.empty()) - { - utf8_result += conv.fromUnicode(regular_text, "UTF-8"); - regular_text.clear(); - } - - - utf8_result += static_cast(0xF0 | ((cp >> 18) & 0x07)); - utf8_result += static_cast(0x80 | ((cp >> 12) & 0x3F)); - utf8_result += static_cast(0x80 | ((cp >> 6) & 0x3F)); - utf8_result += static_cast(0x80 | (cp & 0x3F)); - } - else - { - regular_text += unicode_content[i]; - } - } - - - if (!regular_text.empty()) - { - utf8_result += conv.fromUnicode(regular_text, "UTF-8"); - } - - utf8_content = utf8_result; -#else utf8_content = conv.fromUnicode(unicode_content, "UTF-8"); -#endif } size_t lineCount = 0; if (!utf8_content.empty()) From 77346270a404efd18ae81b82be94a7714fc93fdf Mon Sep 17 00:00:00 2001 From: Svetlana Kulikova Date: Wed, 8 Apr 2026 15:07:22 +0300 Subject: [PATCH 3/9] Fix bug 80951 --- DocxRenderer/src/logic/Page.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DocxRenderer/src/logic/Page.cpp b/DocxRenderer/src/logic/Page.cpp index 8bb69a6efc..f9034c9119 100644 --- a/DocxRenderer/src/logic/Page.cpp +++ b/DocxRenderer/src/logic/Page.cpp @@ -367,7 +367,8 @@ namespace NSDocxRenderer bForcedBold, m_bUseDefaultFont, m_bWriteStyleRaw, - m_bCollectMetaInfo + m_bCollectMetaInfo, + m_bFontSubstitution ); } From 612c26cf6c2c00b732cfa2af8af138913c9bb29a Mon Sep 17 00:00:00 2001 From: Alexander Yuzhin Date: Thu, 9 Apr 2026 11:07:45 +0300 Subject: [PATCH 4/9] Add patch for fix build Xcode 26+ Clang treats enum-constexpr-conversion as hard error --- .../boost/patches/mpl_integral_wrapper.patch | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Common/3dParty/boost/patches/mpl_integral_wrapper.patch diff --git a/Common/3dParty/boost/patches/mpl_integral_wrapper.patch b/Common/3dParty/boost/patches/mpl_integral_wrapper.patch new file mode 100644 index 0000000000..29751211af --- /dev/null +++ b/Common/3dParty/boost/patches/mpl_integral_wrapper.patch @@ -0,0 +1,36 @@ +<<<<<<< +#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243) + private: + BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1))); + BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1))); + public: + typedef AUX_WRAPPER_INST(next_value) next; + typedef AUX_WRAPPER_INST(prior_value) prior; +#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ + || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \ + || (BOOST_WORKAROUND(__HP_aCC, <= 53800) && (BOOST_WORKAROUND(__hpxstd98, != 1))) + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)) ) next; + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)) ) prior; +#else + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value + 1)) ) next; + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior; +#endif +======= +#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243) \ + || defined(__clang__) + private: + BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1))); + BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1))); + public: + typedef AUX_WRAPPER_INST(next_value) next; + typedef AUX_WRAPPER_INST(prior_value) prior; +#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ + || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \ + || (BOOST_WORKAROUND(__HP_aCC, <= 53800) && (BOOST_WORKAROUND(__hpxstd98, != 1))) + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)) ) next; + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)) ) prior; +#else + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value + 1)) ) next; + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior; +#endif +>>>>>>> From a62f97627b58d26f556db5ba933afa697a59d7c7 Mon Sep 17 00:00:00 2001 From: Svetlana Kulikova Date: Tue, 14 Apr 2026 10:50:07 +0300 Subject: [PATCH 5/9] Fix AP removal for modified annotations --- PdfFile/PdfWriter.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PdfFile/PdfWriter.cpp b/PdfFile/PdfWriter.cpp index d9d28cfbf6..43be9ec26b 100644 --- a/PdfFile/PdfWriter.cpp +++ b/PdfFile/PdfWriter.cpp @@ -2674,6 +2674,9 @@ HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotF CAnnotFieldInfo::CWidgetAnnotPr::CSignatureWidgetPr* pPr = oInfo.GetWidgetAnnotPr()->GetSignatureWidgetPr(); PdfWriter::CSignatureWidget* pSignatureWidget = (PdfWriter::CSignatureWidget*)pAnnot; } + + if (m_bSplit) + pWidgetAnnot->RemoveAP(); } else if (oInfo.IsLink()) { From b78bcb10dc75d91bb29e27d8c91f7e01ef58d43d Mon Sep 17 00:00:00 2001 From: Svetlana Kulikova Date: Tue, 14 Apr 2026 16:16:38 +0300 Subject: [PATCH 6/9] Fix bug 81029 --- PdfFile/lib/xpdf/Gfx.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PdfFile/lib/xpdf/Gfx.cc b/PdfFile/lib/xpdf/Gfx.cc index 65e4ea4e5c..005232470a 100644 --- a/PdfFile/lib/xpdf/Gfx.cc +++ b/PdfFile/lib/xpdf/Gfx.cc @@ -4082,6 +4082,15 @@ void Gfx::opXObject(Object args[], int numArgs) { Object opiDict; #endif + double *ctm; + double det; + + ctm = state->getCTM(); + det = ctm[0] * ctm[3] - ctm[1] * ctm[2]; + if (fabs(det) <= 1e-10) { + return; + } + if (!ocState && !out->needCharCount()) { return; } From d9d7ffef2619aa76b8f343d05ad34ecaf652c53a Mon Sep 17 00:00:00 2001 From: Elena Subbotina Date: Tue, 21 Apr 2026 12:50:49 +0300 Subject: [PATCH 7/9] fix bug #81148 --- OOXML/Base/Unit.cpp | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/OOXML/Base/Unit.cpp b/OOXML/Base/Unit.cpp index bbd808e890..e7e1496139 100644 --- a/OOXML/Base/Unit.cpp +++ b/OOXML/Base/Unit.cpp @@ -31,7 +31,8 @@ */ #include "Unit.h" #include - +#include +#include "../../Common/3dParty/cryptopp/osrng.h" double Cm_To_Mm (const double &dValue) { @@ -764,30 +765,36 @@ namespace XmlUtils } return std::rand(); } + static unsigned int Rand1() + { + static CryptoPP::AutoSeededRandomPool prng; + static std::mutex prng_mutex; + unsigned int result; + std::lock_guard lock(prng_mutex); + prng.GenerateBlock(reinterpret_cast(&result), sizeof(result)); + return result; + } int GenerateInt() { - //todo c++11 - return ((Rand() & 0x7FFF) | ((Rand() & 0x7FFF) << 15) | ((Rand() & 0x3) << 30)); + return static_cast(Rand1()); } std::wstring GenerateGuid() { std::wstring result; - //#if defined (_WIN32) || defined(_WIN64) - // GUID guid; - // CoCreateGuid(&guid); - // - // OLECHAR* guidString; - // StringFromCLSID(guid, &guidString); - // - // result = std::wstring(guidString); - // - // CoTaskMemFree(guidString); - //#else + std::wstringstream sstream; - sstream << boost::wformat(L"%04X%04X-%04X-%04X-%04X-%04X%04X%04X") % (Rand() & 0xff) % (Rand() & 0xff) % (Rand() & 0xff) % ((Rand() & 0x0fff) | 0x4000) % ((Rand() % 0x3fff) + 0x8000) % (Rand() & 0xff) % (Rand() & 0xff) % (Rand() & 0xff); + sstream << boost::wformat(L"%04X%04X-%04X-%04X-%04X-%04X%04X%04X") + % (Rand1() & 0xffff) + % (Rand1() & 0xffff) + % (Rand1() & 0xffff) + % ((Rand1() & 0x0fff) | 0x4000) + % ((Rand1() & 0x3fff) | 0x8000) + % (Rand1() & 0xffff) + % (Rand1() & 0xffff) + % (Rand1() & 0xffff); result = sstream.str(); - //#endif + return result; } std::wstring DoubleToString( double value, wchar_t* format ) From c03fd25b6dc9a3caaff2ab5df5a5e7bda8c6cf68 Mon Sep 17 00:00:00 2001 From: "Oleg.Korshul" Date: Tue, 21 Apr 2026 16:06:19 +0300 Subject: [PATCH 8/9] Fix build --- OdfFile/Reader/Converter/StarMath2OOXML/StarMath2OOXML.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/OdfFile/Reader/Converter/StarMath2OOXML/StarMath2OOXML.pro b/OdfFile/Reader/Converter/StarMath2OOXML/StarMath2OOXML.pro index 27834ff012..93c517b1f2 100644 --- a/OdfFile/Reader/Converter/StarMath2OOXML/StarMath2OOXML.pro +++ b/OdfFile/Reader/Converter/StarMath2OOXML/StarMath2OOXML.pro @@ -16,6 +16,7 @@ include($$CORE_ROOT_DIR/Common/base.pri) include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri) include($$CORE_ROOT_DIR/Common/3dParty/boost/boost.pri) +LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lCryptoPPLib ADD_DEPENDENCY(kernel) SOURCES += $$PWD/cconversionsmtoooxml.cpp \ From e33e3d6b42e7041ea092424c7ac5756413f0b2b0 Mon Sep 17 00:00:00 2001 From: Svetlana Kulikova Date: Tue, 21 Apr 2026 16:13:34 +0300 Subject: [PATCH 9/9] Fix bug 81092 --- DesktopEditor/graphics/pro/js/wasm/src/Text.h | 96 +++++++++++++++++-- .../graphics/pro/js/wasm/src/serialize.h | 6 ++ 2 files changed, 93 insertions(+), 9 deletions(-) diff --git a/DesktopEditor/graphics/pro/js/wasm/src/Text.h b/DesktopEditor/graphics/pro/js/wasm/src/Text.h index 29041be15e..11f5730d1a 100644 --- a/DesktopEditor/graphics/pro/js/wasm/src/Text.h +++ b/DesktopEditor/graphics/pro/js/wasm/src/Text.h @@ -233,20 +233,98 @@ namespace NSHtmlRenderer NSWasm::CHChar* pLastChar = m_oLine.GetTail(); if (dOffsetX > (pLastChar->width + 0.5)) { - // insert space. Our space will not be a regular space. But a specific one - NSWasm::CHChar* pSpaceChar = m_oLine.AddTail(); - pLastChar = &m_oLine.m_pChars[m_oLine.m_lCharsTail - 2]; - pSpaceChar->x = pLastChar->width; - pSpaceChar->width = dOffsetX - pLastChar->width; - pSpaceChar->unicode = 0xFFFF; - dOffsetX -= pLastChar->width; + if (pLastChar->unicode == 32 || pLastChar->unicode == 9) + { + pLastChar->width = dOffsetX; + } + else + { + // insert space. Our space will not be a regular space. But a specific one + NSWasm::CHChar* pSpaceChar = m_oLine.AddTail(); + pLastChar = &m_oLine.m_pChars[m_oLine.m_lCharsTail - 2]; + pSpaceChar->x = pLastChar->width; + pSpaceChar->width = dOffsetX - pLastChar->width; + pSpaceChar->unicode = 0xFFFF; + dOffsetX -= pLastChar->width; + } } } else { // letter is shifted left relative to previous letter - // we react to this situation simply - just start a new line, - // after dumping the old one + // check if new glyph lands inside a synthetic space (0xFFFF) in current line + double sx = _x1 - m_oLine.m_dX; + double sy = _y1 - m_oLine.m_dY; + double newGlyphOffset = sx * m_oLine.m_ex + sy * m_oLine.m_ey; + + // walk through chars accumulating offset to find which char we hit + double charOffset = 0; + LONG nCount = m_oLine.GetCountChars(); + LONG nSplitIndex = -1; + for (LONG i = 0; i < nCount; ++i) + { + NSWasm::CHChar* pCh = &m_oLine.m_pChars[i]; + if (i > 0) + charOffset += pCh->x; // x here is offset from previous char + if (pCh->unicode == 0xFFFF && + newGlyphOffset >= charOffset && + newGlyphOffset < charOffset + pCh->width) + { + nSplitIndex = i; + break; + } + } + + if (nSplitIndex >= 0) + { + NSWasm::CHLine oSaved; + oSaved = m_oLine; + + // --- Dump head: chars [0 .. nSplitIndex - 1] --- + m_oLine.m_lCharsTail = nSplitIndex; // truncate before the 0xFFFF + DumpLine(); // clears m_oLine + + // --- Dump tail: chars [nSplitIndex + 1 .. nCount - 1] --- + LONG nTailStart = nSplitIndex + 1; + LONG nTailCount = nCount - nTailStart; + if (nTailCount > 0) + { + // Reconstruct baseline origin for the tail. + // Walk offsets up to nTailStart to find its position along baseline. + double tailOffset = 0; + for (LONG i = 1; i <= nTailStart; ++i) + tailOffset += oSaved.m_pChars[i].x; + + m_oLine.m_bIsConstX = oSaved.m_bIsConstX; + m_oLine.m_dK = oSaved.m_dK; + m_oLine.m_dB = oSaved.m_dB; + m_oLine.m_ex = oSaved.m_ex; + m_oLine.m_ey = oSaved.m_ey; + m_oLine.m_dAscent = oSaved.m_dAscent; + m_oLine.m_dDescent = oSaved.m_dDescent; + m_oLine.m_bIsSetUpTransform = oSaved.m_bIsSetUpTransform; + m_oLine.m_sx = oSaved.m_sx; + m_oLine.m_sy = oSaved.m_sy; + m_oLine.m_shx = oSaved.m_shx; + m_oLine.m_shy = oSaved.m_shy; + + // Origin of tail shifted along baseline + m_oLine.m_dX = oSaved.m_dX + tailOffset * oSaved.m_ex; + m_oLine.m_dY = oSaved.m_dY + tailOffset * oSaved.m_ey; + m_oLine.m_dEndX = m_oLine.m_dX; + m_oLine.m_dEndY = m_oLine.m_dY; + + // Copy tail chars; first tail char has x=0 (it's now the line origin) + for (LONG i = 0; i < nTailCount; ++i) + { + NSWasm::CHChar* pDst = m_oLine.AddTail(); + *pDst = oSaved.m_pChars[nTailStart + i]; + if (i == 0) + pDst->x = 0; // first char offset is always 0 + } + } + } + DumpLine(); m_oLine.m_bIsConstX = _isConstX; diff --git a/DesktopEditor/graphics/pro/js/wasm/src/serialize.h b/DesktopEditor/graphics/pro/js/wasm/src/serialize.h index e29ad97cf9..1cf99b0401 100644 --- a/DesktopEditor/graphics/pro/js/wasm/src/serialize.h +++ b/DesktopEditor/graphics/pro/js/wasm/src/serialize.h @@ -424,8 +424,14 @@ namespace NSWasm m_dX = oLine.m_dX; m_dY = oLine.m_dY; + m_dEndX = oLine.m_dEndX; + m_dEndY = oLine.m_dEndY; + m_dK = oLine.m_dK; m_dB = oLine.m_dB; + m_ex = oLine.m_ex; + m_ey = oLine.m_ey; + m_bIsConstX = oLine.m_bIsConstX; m_lSizeChars = oLine.m_lSizeChars; m_lCharsTail = oLine.m_lCharsTail;