From 33e80611c46ffb8b324e1d445287f0957546de97 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 26 Nov 2018 10:25:31 +0200 Subject: remove unused SubsFontFlags flags and document in the registry that the SubstFontsPS is unused Change-Id: I66a9e0b4353f17b34cffb02823726c9887b7bdd3 Reviewed-on: https://gerrit.libreoffice.org/64065 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../clang/unusedenumconstants.readonly.results | 4 --- include/unotools/fontcfg.hxx | 2 -- include/unotools/fontdefs.hxx | 6 ++-- officecfg/registry/schema/org/openoffice/VCL.xcs | 4 +-- unotools/source/config/fontcfg.cxx | 4 --- unotools/source/misc/fontdefs.cxx | 37 ++++++---------------- 6 files changed, 13 insertions(+), 44 deletions(-) diff --git a/compilerplugins/clang/unusedenumconstants.readonly.results b/compilerplugins/clang/unusedenumconstants.readonly.results index 6a2e090b7e57..821492b5cde6 100644 --- a/compilerplugins/clang/unusedenumconstants.readonly.results +++ b/compilerplugins/clang/unusedenumconstants.readonly.results @@ -580,10 +580,6 @@ include/unotools/fontcfg.hxx:85 enum ImplFontAttrs AllSubscript include/unotools/fontcfg.hxx:86 enum ImplFontAttrs AllSerifStyle -include/unotools/fontdefs.hxx:31 - enum SubsFontFlags PS -include/unotools/fontdefs.hxx:32 - enum SubsFontFlags HTML include/unotools/fontdefs.hxx:70 enum DefaultFontType LATIN_DISPLAY include/unotools/fontdefs.hxx:71 diff --git a/include/unotools/fontcfg.hxx b/include/unotools/fontcfg.hxx index 47418afdb0ab..24dfbb6540f3 100644 --- a/include/unotools/fontcfg.hxx +++ b/include/unotools/fontcfg.hxx @@ -129,8 +129,6 @@ struct UNOTOOLS_DLLPUBLIC FontNameAttr OUString Name; ::std::vector< OUString > Substitutions; ::std::vector< OUString > MSSubstitutions; - ::std::vector< OUString > PSSubstitutions; - ::std::vector< OUString > HTMLSubstitutions; FontWeight Weight; FontWidth Width; ImplFontAttrs Type; diff --git a/include/unotools/fontdefs.hxx b/include/unotools/fontdefs.hxx index 12dfc44ba985..7a8bf90d7c4f 100644 --- a/include/unotools/fontdefs.hxx +++ b/include/unotools/fontdefs.hxx @@ -27,14 +27,12 @@ enum class SubsFontFlags { ONLYONE = 0x01, - MS = 0x02, - PS = 0x04, - HTML = 0x08, + MS = 0x02 }; namespace o3tl { - template<> struct typed_flags : is_typed_flags {}; + template<> struct typed_flags : is_typed_flags {}; } UNOTOOLS_DLLPUBLIC OUString GetSubsFontName( const OUString& rName, SubsFontFlags nFlags ); diff --git a/officecfg/registry/schema/org/openoffice/VCL.xcs b/officecfg/registry/schema/org/openoffice/VCL.xcs index a46588965c01..7c9a567b4ce5 100644 --- a/officecfg/registry/schema/org/openoffice/VCL.xcs +++ b/officecfg/registry/schema/org/openoffice/VCL.xcs @@ -38,12 +38,12 @@ - Contains a list of substitute fonts used in a PostScript context (for example, EPS export). + Unused. Used to contain a list of substitute fonts used in a PostScript context (for example, EPS export). - Contains a list of substitute fonts used in a HTML context (for example, HTML import/export). + Unused. Used to contain a list of substitute fonts used in a HTML context (for example, HTML import/export). diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index 9f796ff88fc4..114e2dc37352 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -1002,8 +1002,6 @@ void FontSubstConfiguration::readLocaleSubst( const OUString& rBcp47 ) const // strings for subst retrieval, construct only once OUString const aSubstFontsStr ( "SubstFonts" ); OUString const aSubstFontsMSStr ( "SubstFontsMS" ); - OUString const aSubstFontsPSStr ( "SubstFontsPS" ); - OUString const aSubstFontsHTMLStr ( "SubstFontsHTML" ); OUString const aSubstWeightStr ( "FontWeight" ); OUString const aSubstWidthStr ( "FontWidth" ); OUString const aSubstTypeStr ( "FontType" ); @@ -1032,8 +1030,6 @@ void FontSubstConfiguration::readLocaleSubst( const OUString& rBcp47 ) const aAttr.Name = pFontNames[i]; fillSubstVector( xFont, aSubstFontsStr, aAttr.Substitutions ); fillSubstVector( xFont, aSubstFontsMSStr, aAttr.MSSubstitutions ); - fillSubstVector( xFont, aSubstFontsPSStr, aAttr.PSSubstitutions ); - fillSubstVector( xFont, aSubstFontsHTMLStr, aAttr.HTMLSubstitutions ); aAttr.Weight = getSubstWeight( xFont, aSubstWeightStr ); aAttr.Width = getSubstWidth( xFont, aSubstWidthStr ); aAttr.Type = getSubstType( xFont, aSubstTypeStr ); diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx index 35af2a1bddfb..c83c14d93cda 100644 --- a/unotools/source/misc/fontdefs.cxx +++ b/unotools/source/misc/fontdefs.cxx @@ -529,37 +529,18 @@ OUString GetSubsFontName( const OUString& rName, SubsFontFlags nFlags ) const utl::FontNameAttr* pAttr = utl::FontSubstConfiguration::get().getSubstInfo( aOrgName ); if ( pAttr ) { - for( int i = 0; i < 3; i++ ) - { - const ::std::vector< OUString >* pVector = nullptr; - switch( i ) + if( nFlags & SubsFontFlags::MS && !pAttr->MSSubstitutions.empty() ) { - case 0: - if( nFlags & SubsFontFlags::MS && !pAttr->MSSubstitutions.empty() ) - pVector = &pAttr->MSSubstitutions; - break; - case 1: - if( nFlags & SubsFontFlags::PS && !pAttr->PSSubstitutions.empty() ) - pVector = &pAttr->PSSubstitutions; - break; - case 2: - if( nFlags & SubsFontFlags::HTML && !pAttr->HTMLSubstitutions.empty() ) - pVector = &pAttr->HTMLSubstitutions; - break; - } - if( ! pVector ) - continue; - for( const auto& rSubstitution : *pVector ) - if( ! ImplIsFontToken( rName, rSubstitution ) ) - { - ImplAppendFontToken( aName, rSubstitution ); - if( nFlags & SubsFontFlags::ONLYONE ) + for( const auto& rSubstitution : pAttr->MSSubstitutions ) + if( ! ImplIsFontToken( rName, rSubstitution ) ) { - i = 4; - break; + ImplAppendFontToken( aName, rSubstitution ); + if( nFlags & SubsFontFlags::ONLYONE ) + { + break; + } } - } - } + } } return aName; -- cgit