starmath/inc/symbol.hxx | 3 ++- starmath/source/node.cxx | 5 +---- starmath/source/symbol.cxx | 8 ++++++-- 3 files changed, 9 insertions(+), 7 deletions(-)
New commits: commit 37f91706e6efd36074187234530f8c8ee8a3edd8 Author: Khaled Hosny <kha...@libreoffice.org> AuthorDate: Tue Sep 19 10:22:37 2023 +0300 Commit: خالد حسني <kha...@libreoffice.org> CommitDate: Tue Sep 19 14:22:11 2023 +0200 starmath: Get the font from current format for special symbols We want to use the current format when using the symbol in a document, and fallback for stabdard format when rendering the symbol in symbols dialog. Fixup for the following two commits: commit f28b043b4eb40e90b330721fc43d19ae6c06951e Author: Khaled Hosny <kha...@libreoffice.org> Date: Mon Sep 18 19:00:02 2023 +0300 starmath: Fix editing symbols in the Symbols Catalogue commit 32d2e001bb056e7d98aa143b222f2721967337dc Author: Khaled Hosny <kha...@libreoffice.org> Date: Tue Sep 12 18:35:46 2023 +0300 tdf#101174: Don’t hard-code OpenSymbol font for predefined special symbols Change-Id: Id3730749a49015120ecf9719027f932fd90c605a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157043 Tested-by: Jenkins Reviewed-by: خالد حسني <kha...@libreoffice.org> diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx index a3d08b37d522..321dbb500e03 100644 --- a/starmath/inc/symbol.hxx +++ b/starmath/inc/symbol.hxx @@ -28,6 +28,7 @@ #include <vector> #include <set> +#include "format.hxx" #include "utility.hxx" @@ -51,7 +52,7 @@ public: SmSym& operator = (const SmSym& rSymbol); - const vcl::Font& GetFace() const; + const vcl::Font& GetFace(const SmFormat* pFormat = nullptr) const; sal_UCS4 GetCharacter() const { return m_cChar; } const OUString& GetName() const { return m_aName; } diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 92eafe8dbccb..01b14c177e43 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -2192,10 +2192,7 @@ void SmSpecialNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell sal_UCS4 cChar = pSym->GetCharacter(); OUString aTmp( &cChar, 1 ); SetText( aTmp ); - if (pSym->GetFace().GetFamilyName().isEmpty()) - GetFont() = rFormat.GetFont(FNT_VARIABLE); - else - GetFont() = pSym->GetFace(); + GetFont() = pSym->GetFace(&rFormat); } else { diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx index 7bff8d995d5c..a75b6a912670 100644 --- a/starmath/source/symbol.cxx +++ b/starmath/source/symbol.cxx @@ -81,10 +81,14 @@ bool SmSym::IsEqualInUI( const SmSym& rSymbol ) const m_cChar == rSymbol.m_cChar; } -const vcl::Font& SmSym::GetFace() const +const vcl::Font& SmSym::GetFace(const SmFormat* pFormat) const { if (m_aFace.GetFamilyName().isEmpty()) - return SM_MOD()->GetConfig()->GetStandardFormat().GetFont(FNT_MATH); + { + if (!pFormat) + pFormat = &SM_MOD()->GetConfig()->GetStandardFormat(); + return pFormat->GetFont(FNT_VARIABLE); + } return m_aFace; }