Skip to content

Commit

Permalink
fixed line spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
PolyakovKirill committed Nov 11, 2020
1 parent 858f005 commit 59175fc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Common/3dParty/html/css/src/xhtml/CDocumentStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ namespace NSCSS
const std::vector<std::wstring>& 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<short int>(fLeftValue + 0.5f)) + L"\" ";
sInfValue += L"w:right=\"" + std::to_wstring(static_cast<short int>(fRightValue + 0.5f)) + L"\" ";
}
Expand Down Expand Up @@ -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<unsigned short int>(fLineHeight * fValue + 0.5f)) + L"\" ";
sSpacingValue += L"w:line=\"" + std::to_wstring(static_cast<unsigned short int>((fLine < fValue * 20.0f) ? fLine : fValue * 5.0f + 0.5f)) + L"\" ";
sSpacingValue += L"w:lineRule=\"auto\"";
}
}
Expand Down

0 comments on commit 59175fc

Please sign in to comment.