diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-04-07 11:34:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-04-07 16:55:00 +0200 |
commit | 7087e5b9be3a099743f60ba721305f6cc607eaef (patch) | |
tree | 1c788688b954fa5889754c9c09f28936f110d720 /svx | |
parent | 9e786320a7d2609a9f997b32e31347f2eab0489e (diff) |
Resolves: tdf#154680 don't mark an empty fontname as italic for "unknown"
its used for 'ambigious' rather than 'unknown'
Change-Id: I1aeb2f825c5e611e0a943a6ce5f3ab58658701bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150121
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 0ed31c52804b..17b574231ebf 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -354,6 +354,8 @@ protected: ".uno:CharEndPreviewFontName", aArgs ); } + + bool CheckFontIsAvailable(std::u16string_view fontname); void CheckAndMarkUnknownFont(); public: @@ -1759,16 +1761,21 @@ void SvxFontNameBox_Base::FillList() m_xWidget->select_entry_region(nStartPos, nEndPos); } +bool SvxFontNameBox_Base::CheckFontIsAvailable(std::u16string_view fontname) +{ + lcl_GetDocFontList(&pFontList, this); + return pFontList && pFontList->IsAvailable(fontname); +} + void SvxFontNameBox_Base::CheckAndMarkUnknownFont() { if (mbCheckingUnknownFont) //tdf#117537 block rentry return; mbCheckingUnknownFont = true; OUString fontname = m_xWidget->get_active_text(); - lcl_GetDocFontList( &pFontList, this ); - // If the font is unknown, show it in italic. + // tdf#154680 If a font is set and that font is unknown, show it in italic. vcl::Font font = m_xWidget->get_entry_font(); - if( pFontList != nullptr && pFontList->IsAvailable( fontname )) + if (fontname.isEmpty() || CheckFontIsAvailable(fontname)) { if( font.GetItalic() != ITALIC_NONE ) { |