Compare commits

...

16 Commits

Author SHA1 Message Date
3d7381dc68 Merge pull request 'Fix bug 81092' (#748) from fix/bug-81092 into release/v9.4.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/748
2026-04-21 13:46:39 +00:00
e33e3d6b42 Fix bug 81092 2026-04-21 16:13:34 +03:00
c03fd25b6d Fix build 2026-04-21 16:06:19 +03:00
c7c98d3f69 Merge pull request 'fix bug #81148' (#747) from fix/bug81148- into release/v9.4.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/747
2026-04-21 10:00:55 +00:00
d9d7ffef26 fix bug #81148 2026-04-21 12:50:49 +03:00
b0efeafd27 Merge pull request 'Add patch for fix build Xcode 26+ Clang treats enum-constexpr-conversion as hard error' (#742) from fix/boost-integral-wrapper-xcode into release/v9.4.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/742
2026-04-16 07:18:21 +00:00
8a3a922dba Merge pull request 'Fix bug 81029' (#744) from fix/bug-81029 into release/v9.4.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/744
2026-04-14 13:20:10 +00:00
b78bcb10dc Fix bug 81029 2026-04-14 16:16:38 +03:00
653ff24c0e Merge pull request 'Fix AP removal for modified annotations' (#743) from fix/pdf-bugs into release/v9.4.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/743
2026-04-14 07:52:40 +00:00
a62f97627b Fix AP removal for modified annotations 2026-04-14 10:50:07 +03:00
612c26cf6c Add patch for fix build Xcode 26+ Clang treats enum-constexpr-conversion as hard error 2026-04-09 11:07:45 +03:00
2873418d74 Merge pull request 'Fix bug 80951' (#741) from fix/bug-80951 into release/v9.4.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/741
2026-04-08 12:52:43 +00:00
77346270a4 Fix bug 80951 2026-04-08 15:07:22 +03:00
5f39acbe51 Merge pull request 'For bug 80374' (#740) from fix/forbug80374 into release/v9.4.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/740
2026-04-08 08:34:04 +00:00
6badba384c For bug 80374 2026-04-08 11:27:44 +03:00
c96df4e62e Fix bugs in fromUnicode method 2026-04-07 22:11:37 +03:00
10 changed files with 172 additions and 65 deletions

View File

@ -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
>>>>>>>

View File

@ -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;

View File

@ -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;

View File

@ -367,7 +367,8 @@ namespace NSDocxRenderer
bForcedBold,
m_bUseDefaultFont,
m_bWriteStyleRaw,
m_bCollectMetaInfo
m_bCollectMetaInfo,
m_bFontSubstitution
);
}

View File

@ -31,7 +31,8 @@
*/
#include "Unit.h"
#include <cwchar>
#include <mutex>
#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<std::mutex> lock(prng_mutex);
prng.GenerateBlock(reinterpret_cast<unsigned char*>(&result), sizeof(result));
return result;
}
int GenerateInt()
{
//todo c++11 <random>
return ((Rand() & 0x7FFF) | ((Rand() & 0x7FFF) << 15) | ((Rand() & 0x3) << 30));
return static_cast<int>(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 )

View File

@ -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 \

View File

@ -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())
{

View File

@ -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;
}

View File

@ -100,45 +100,8 @@ const std::vector<std::string> 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<unsigned int>(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<char>(0xF0 | ((cp >> 18) & 0x07));
utf8_result += static_cast<char>(0x80 | ((cp >> 12) & 0x3F));
utf8_result += static_cast<char>(0x80 | ((cp >> 6) & 0x3F));
utf8_result += static_cast<char>(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())

View File

@ -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);
}