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 <khaled@libreoffice.org>
This commit is contained in:
committed by
Khaled Hosny
parent
8b44be318a
commit
d47d44191d
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user