diff --git a/Common/3dParty/html/css/src/xhtml/CDocumentStyle.cpp b/Common/3dParty/html/css/src/xhtml/CDocumentStyle.cpp
index 982f449c3a6..48e3207b405 100644
--- a/Common/3dParty/html/css/src/xhtml/CDocumentStyle.cpp
+++ b/Common/3dParty/html/css/src/xhtml/CDocumentStyle.cpp
@@ -249,8 +249,8 @@ namespace NSCSS
const std::vector& sMargins = oStyle.GetMargins();
if (!sMargins.empty())
{
- const float fLeftValue = wcstof(sMargins[1].c_str(), NULL);
- const float fRightValue = wcstof(sMargins[3].c_str(), NULL);
+ const float fLeftValue = wcstof(sMargins[3].c_str(), NULL) * 10.0f;
+ const float fRightValue = wcstof(sMargins[1].c_str(), NULL) * 10.0f;
sInfValue += L"w:left=\"" + std::to_wstring(static_cast(fLeftValue + 0.5f)) + L"\" ";
sInfValue += L"w:right=\"" + std::to_wstring(static_cast(fRightValue + 0.5f)) + L"\" ";
}
@@ -280,9 +280,10 @@ namespace NSCSS
if (fLineHeight >= 1.0f)
{
- fLineHeight *= (fLineHeight < fValue / 2) ? 10.0f : 10.0f / fLineHeight;
+ fLineHeight *= (fLineHeight < fValue / 2) ? 10.0f : (10.0f / fLineHeight);
+ float fLine = fLineHeight * fValue;
- sSpacingValue += L"w:line=\"" + std::to_wstring(static_cast(fLineHeight * fValue + 0.5f)) + L"\" ";
+ sSpacingValue += L"w:line=\"" + std::to_wstring(static_cast((fLine < fValue * 20.0f) ? fLine : fValue * 5.0f + 0.5f)) + L"\" ";
sSpacingValue += L"w:lineRule=\"auto\"";
}
}