Fix problem with shape top and height

This commit is contained in:
Alexey Nagaev
2025-12-10 15:58:50 +03:00
parent 7ecab52601
commit cec10b7058
2 changed files with 5 additions and 4 deletions

View File

@ -1606,7 +1606,8 @@ namespace NSDocxRenderer
// lamda to setup and add paragpraph
auto add_paragraph = [this, &max_right, &min_left, &ar_paragraphs] (paragraph_ptr_t& paragraph) {
paragraph->m_dBot = paragraph->m_arTextLines.back()->m_dBotWithMaxDescent;
double additional_bottom = m_arTextLines.front()->m_dTopWithMaxAscent - m_arTextLines.front()->m_dTop;
paragraph->m_dBot = paragraph->m_arTextLines.back()->m_dBot + additional_bottom;
paragraph->m_dTop = paragraph->m_arTextLines.front()->m_dTopWithMaxAscent;
paragraph->m_dRight = max_right;
paragraph->m_dLeft = min_left;
@ -2540,7 +2541,7 @@ namespace NSDocxRenderer
pParagraph->m_arTextLines.push_back(pLine);
pParagraph->m_dLeft = pLine->m_dLeft;
pParagraph->m_dTop = pLine->m_dTopWithMaxAscent;
pParagraph->m_dBot = pLine->m_dBotWithMaxDescent;
pParagraph->m_dBot = pLine->m_dBot + (pLine->m_dTopWithMaxAscent - pLine->m_dTop);
pParagraph->m_dWidth = pLine->m_dWidth;
pParagraph->m_dHeight = pLine->m_dHeight;
pParagraph->m_dRight = pLine->m_dRight;

View File

@ -1260,8 +1260,8 @@ namespace NSDocxRenderer
double em_height = oMetrics.dEmHeight;
double ratio = font_size / em_height * c_dPtToMM;
pCont->m_dTopWithAscent = pCont->m_dBot - (oMetrics.dAscent * ratio) - oMetrics.dBaselineOffset;
pCont->m_dBotWithDescent = pCont->m_dBot + (oMetrics.dDescent * ratio) - oMetrics.dBaselineOffset;
pCont->m_dTopWithAscent = pCont->m_dBot - (oMetrics.dAscent * ratio);
pCont->m_dBotWithDescent = pCont->m_dBot + (oMetrics.dDescent * ratio);
pCont->m_dSpaceWidthMM = pFontManager->GetSpaceWidthMM();
pCont->m_wsOriginFontName = oFont.Name;