starmath/source/node.cxx | 6 ++++++ 1 file changed, 6 insertions(+) New commits: commit a15762233047a75588f8c5da1cee1134f1259417 Author: Khaled Hosny <kha...@libreoffice.org> AuthorDate: Thu Sep 14 20:03:36 2023 +0300 Commit: خالد حسني <kha...@libreoffice.org> CommitDate: Fri Sep 15 12:44:05 2023 +0200
starmath: Improve root rendering for fonts other than OpenSymbol The radical glyph in OpenSymbol is aligned to the font ascender, which is not essentially true for other fonts, so we now use the bounding rectangle of the glyph to get accurate positioning. Change-Id: I83c21cd21de25f23f96f819e168f43aa9ab22351 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156926 Tested-by: Jenkins Reviewed-by: خالد حسني <kha...@libreoffice.org> diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 1572d5f8e67e..92eafe8dbccb 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -769,6 +769,12 @@ void SmRootNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) pRootSym->Arrange(rDev, rFormat); + // Set the top and bottom of the root symbol to the top and bottom of its glyph bounding rect, + // to get accurate position of the root symbol. + SmRect rRootSymRect = pRootSym->AsGlyphRect(); + pRootSym->SetTop(rRootSymRect.GetTop()); + pRootSym->SetBottom(rRootSymRect.GetBottom()); + Point aPos = pRootSym->AlignTo(*pBody, RectPos::Left, RectHorAlign::Center, RectVerAlign::Baseline); //! override calculated vertical position aPos.setY( pRootSym->GetTop() + pBody->GetBottom() - pRootSym->GetBottom() );