From d47d44191df99488ebf8632053baf020907328ed Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sat, 27 Jun 2026 20:25:05 +0300 Subject: [PATCH] tdf#152396: List extended subfamily names in the style box FontStyleBox::Fill inserted an entry only when weight/italic/width attributes differed from the previous one, but these are not the only attributes that can change between style. For example Fontin Sans has both Regular and Small Caps styles and they have the same weight/italic/width, so we were showing Regular while using Small Caps. Change-Id: I01f6530c1c54e083faf722eabfac7ab925b39c00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207382 Tested-by: Jenkins Reviewed-by: Khaled Hosny --- svtools/source/control/ctrlbox.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index e25b3dfd45c1..19a468d1ae25 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -973,6 +973,7 @@ void FontStyleBox::Fill( std::u16string_view rName, const FontList* pList ) FontWeight eLastWeight = WEIGHT_DONTKNOW; FontItalic eLastItalic = ITALIC_NONE; FontWidth eLastWidth = WIDTH_DONTKNOW; + OUString aLastStyleName; bool bNormal = false; bool bItalic = false; bool bBold = false; @@ -986,10 +987,14 @@ void FontStyleBox::Fill( std::u16string_view rName, const FontList* pList ) FontWeight eWeight = aFontMetric.GetWeightMaybeAskConfig(); FontItalic eItalic = aFontMetric.GetItalicMaybeAskConfig(); FontWidth eWidth = aFontMetric.GetWidthTypeMaybeAskConfig(); + const OUString& rStyleName = aFontMetric.GetStyleName(); // Only if the attributes are different, we insert the // Font to avoid double Entries in different languages + // tdf#87288 also insert if attributes are the same but style name + // is different (e.g. “Small Caps” that have the same attributes as + // “Regular”). if ( (eWeight != eLastWeight) || (eItalic != eLastItalic) || - (eWidth != eLastWidth) ) + (eWidth != eLastWidth) || (rStyleName != aLastStyleName) ) { if ( bInsert ) m_xComboBox->append_text(aStyleText); @@ -1021,6 +1026,7 @@ void FontStyleBox::Fill( std::u16string_view rName, const FontList* pList ) eLastWeight = eWeight; eLastItalic = eItalic; eLastWidth = eWidth; + aLastStyleName = rStyleName; } else {