vcl/inc/fontattributes.hxx                 |   26 +++++---------------------
 vcl/inc/unx/freetype_glyphcache.hxx        |    2 +-
 vcl/qa/cppunit/physicalfontcollection.cxx  |    4 ++--
 vcl/quartz/ctfonts.cxx                     |    2 +-
 vcl/source/font/PhysicalFontCollection.cxx |    4 ++--
 vcl/source/font/PhysicalFontFace.cxx       |    2 +-
 vcl/source/font/PhysicalFontFamily.cxx     |    2 +-
 vcl/source/font/font.cxx                   |    2 +-
 vcl/source/font/fontattributes.cxx         |    5 ++---
 vcl/source/font/fontcache.cxx              |    4 ++--
 vcl/source/font/fontmetric.cxx             |    2 +-
 vcl/source/gdi/pdfbuildin_fonts.cxx        |    3 ++-
 vcl/source/gdi/pdfwriter_impl.cxx          |    2 +-
 vcl/source/outdev/font.cxx                 |    2 +-
 vcl/unx/generic/fontmanager/fontsubst.cxx  |    4 ++--
 vcl/unx/generic/print/genpspgraphics.cxx   |    2 +-
 vcl/win/gdi/salfont.cxx                    |    8 ++++----
 17 files changed, 30 insertions(+), 46 deletions(-)

New commits:
commit 538ebbd4fa4241d59e49e33d3cedd04e02ca9287
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Nov 20 21:09:01 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Nov 21 16:17:47 2022 +0100

    remove FontAttributes::meCharSet
    
    its baked in that Symbol means RTL_TEXTENCODING_SYMBOL, so accept
    that status quo and make it explicit
    
    Change-Id: I78d90965e3d6b4543cd74a7847e13246485380d6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143010
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/inc/fontattributes.hxx b/vcl/inc/fontattributes.hxx
index 23fd15955404..7ae4b4527bf1 100644
--- a/vcl/inc/fontattributes.hxx
+++ b/vcl/inc/fontattributes.hxx
@@ -42,9 +42,8 @@ public:
     FontItalic          GetItalic() const                           { return 
meItalic; }
     FontPitch           GetPitch() const                            { return 
mePitch; }
     FontWidth           GetWidthType() const                        { return 
meWidthType; }
-    rtl_TextEncoding    GetCharSet() const                          { return 
meCharSet; }
 
-    bool                IsSymbolFont() const                        { return 
mbSymbolFlag; }
+    bool                IsMicrosoftSymbolEncoded() const            { return 
mbMicrosoftSymbolEncoded; }
 
     void                SetFamilyName(const OUString& sFamilyName)  { 
maFamilyName = sFamilyName; }
     void                SetStyleName( const OUString& sStyleName)   { 
maStyleName = sStyleName; }
@@ -55,7 +54,7 @@ public:
     void                SetWeight(const FontWeight eWeight )        { meWeight 
= eWeight; }
     void                SetWidthType(const FontWidth eWidthType)    { 
meWidthType = eWidthType; }
 
-    void                SetSymbolFlag(const bool );
+    void                SetMicrosoftSymbolEncoded(const bool );
 
     bool                CompareDeviceIndependentFontAttributes(const 
FontAttributes& rOther) const;
 
@@ -77,8 +76,7 @@ private:
     FontPitch           mePitch;                    // Pitch Type
     FontWidth           meWidthType;                // Width Type
     FontItalic          meItalic;                   // Slant Type
-    rtl_TextEncoding    meCharSet;                  // RTL_TEXTENCODING_SYMBOL 
or RTL_TEXTENCODING_UNICODE
-    bool                mbSymbolFlag;               // Is font a symbol?
+    bool                mbMicrosoftSymbolEncoded;   // Is font microsoft 
symbol encoded?
 
     // device dependent variables
     OUString            maMapNames;                 // List of family name 
aliases separated with ';'
@@ -86,23 +84,9 @@ private:
 
 };
 
-inline void FontAttributes::SetSymbolFlag( const bool bSymbolFlag )
+inline void FontAttributes::SetMicrosoftSymbolEncoded(const bool 
bMicrosoftSymbolEncoded)
 {
-    mbSymbolFlag = bSymbolFlag;
-    if ( bSymbolFlag )
-    {
-        meCharSet = RTL_TEXTENCODING_SYMBOL;
-    }
-    else
-    {
-        // if the symbol flag is unset, but it was a symbol font before then
-        // until the character set encoding is set via SetCharSet then we
-        // can't know what the characterset is!
-        if ( meCharSet == RTL_TEXTENCODING_SYMBOL )
-        {
-            meCharSet = RTL_TEXTENCODING_DONTKNOW;
-        }
-    }
+    mbMicrosoftSymbolEncoded = bMicrosoftSymbolEncoded;
 }
 
 inline void FontAttributes::AddMapName( std::u16string_view aMapName )
diff --git a/vcl/inc/unx/freetype_glyphcache.hxx 
b/vcl/inc/unx/freetype_glyphcache.hxx
index fd54def14bb5..dd081339b910 100644
--- a/vcl/inc/unx/freetype_glyphcache.hxx
+++ b/vcl/inc/unx/freetype_glyphcache.hxx
@@ -67,7 +67,7 @@ public:
     int                   GetFontFaceIndex() const  { return mnFaceNum; }
     int                   GetFontFaceVariation() const  { return 
mnFaceVariation; }
     sal_IntPtr            GetFontId() const         { return mnFontId; }
-    bool                  IsMicrosoftSymbolEncoded() const { return 
maDevFontAttributes.IsSymbolFont(); }
+    bool                  IsMicrosoftSymbolEncoded() const { return 
maDevFontAttributes.IsMicrosoftSymbolEncoded(); }
     const FontAttributes& GetFontAttributes() const { return 
maDevFontAttributes; }
 
     void                  AnnounceFont( vcl::font::PhysicalFontCollection* );
diff --git a/vcl/qa/cppunit/physicalfontcollection.cxx 
b/vcl/qa/cppunit/physicalfontcollection.cxx
index 9bea5f7adf52..c3cde102ed26 100644
--- a/vcl/qa/cppunit/physicalfontcollection.cxx
+++ b/vcl/qa/cppunit/physicalfontcollection.cxx
@@ -259,7 +259,7 @@ void 
VclPhysicalFontCollectionTest::testShouldFindSymbolFamilyByMatchType()
 
     FontAttributes aFontAttr;
     aFontAttr.SetFamilyName("symbols");
-    aFontAttr.SetSymbolFlag(true);
+    aFontAttr.SetMicrosoftSymbolEncoded(true);
     aFontAttr.SetWeight(WEIGHT_NORMAL);
     pFontFamily->AddFontFace(new TestFontFace(aFontAttr, FONTID));
 
@@ -278,7 +278,7 @@ void 
VclPhysicalFontCollectionTest::testImpossibleSymbolFamily()
 
     FontAttributes aFontAttr;
     aFontAttr.SetFamilyName("testsymbolfamily");
-    aFontAttr.SetSymbolFlag(true);
+    aFontAttr.SetMicrosoftSymbolEncoded(true);
     aFontAttr.SetWeight(WEIGHT_NORMAL);
     TestFontFace* pFontFace = new TestFontFace(aFontAttr, FONTID);
     pFontFamily->AddFontFace(pFontFace);
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 93a862653b74..38112a7deb50 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -317,7 +317,7 @@ FontAttributes DevFontFromCTFontDescriptor( 
CTFontDescriptorRef pFD, bool* bFont
     rDFA.SetWidthType( WIDTH_NORMAL );
     rDFA.SetWeight( WEIGHT_NORMAL );
     rDFA.SetItalic( ITALIC_NONE );
-    rDFA.SetSymbolFlag( false );
+    rDFA.SetMicrosoftSymbolEncoded( false );
 
     // get font name
 #ifdef MACOSX
diff --git a/vcl/source/font/PhysicalFontCollection.cxx 
b/vcl/source/font/PhysicalFontCollection.cxx
index 5b00083104da..04b031ad6bd1 100644
--- a/vcl/source/font/PhysicalFontCollection.cxx
+++ b/vcl/source/font/PhysicalFontCollection.cxx
@@ -1157,7 +1157,7 @@ PhysicalFontFamily* 
PhysicalFontCollection::FindFontFamily(FontSelectPattern& rF
     }
 
     // if a target symbol font is not available use a default symbol font
-    if( rFSD.IsSymbolFont() )
+    if( rFSD.IsMicrosoftSymbolEncoded() )
     {
         LanguageTag aDefaultLanguageTag("en");
         if (utl::ConfigManager::IsFuzzing())
@@ -1233,7 +1233,7 @@ PhysicalFontFamily* 
PhysicalFontCollection::FindFontFamily(FontSelectPattern& rF
     else
     {
         nSearchType |= lcl_IsCJKFont( rFSD.GetFamilyName() );
-        if( rFSD.IsSymbolFont() )
+        if( rFSD.IsMicrosoftSymbolEncoded() )
             nSearchType |= ImplFontAttrs::Symbol;
     }
 
diff --git a/vcl/source/font/PhysicalFontFace.cxx 
b/vcl/source/font/PhysicalFontFace.cxx
index 174bd931b2ea..83f50b31e690 100644
--- a/vcl/source/font/PhysicalFontFace.cxx
+++ b/vcl/source/font/PhysicalFontFace.cxx
@@ -275,7 +275,7 @@ FontCharMapRef PhysicalFontFace::GetFontCharMap() const
     hb_set_destroy(pUnicodes);
 
     if (!mxCharMap.is())
-        mxCharMap = FontCharMap::GetDefaultMap(IsSymbolFont());
+        mxCharMap = FontCharMap::GetDefaultMap(IsMicrosoftSymbolEncoded());
 
     return mxCharMap;
 }
diff --git a/vcl/source/font/PhysicalFontFamily.cxx 
b/vcl/source/font/PhysicalFontFamily.cxx
index 5171e291c5b5..16bb35c50100 100644
--- a/vcl/source/font/PhysicalFontFamily.cxx
+++ b/vcl/source/font/PhysicalFontFamily.cxx
@@ -131,7 +131,7 @@ void PhysicalFontFamily::AddFontFace( PhysicalFontFace* 
pNewFontFace )
     // set attributes for attribute based font matching
     mnTypeFaces |= FontTypeFaces::Scalable;
 
-    if( pNewFontFace->IsSymbolFont() )
+    if( pNewFontFace->IsMicrosoftSymbolEncoded() )
         mnTypeFaces |= FontTypeFaces::Symbol;
     else
         mnTypeFaces |= FontTypeFaces::NoneSymbol;
diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx
index 410b03d2cae9..46009ff47d04 100644
--- a/vcl/source/font/font.cxx
+++ b/vcl/source/font/font.cxx
@@ -414,7 +414,7 @@ void Font::GetFontAttributes( FontAttributes& rAttrs ) const
     rAttrs.SetItalic( mpImplFont->GetItalicNoAsk() );
     rAttrs.SetWeight( mpImplFont->GetWeightNoAsk() );
     rAttrs.SetWidthType( WIDTH_DONTKNOW );
-    rAttrs.SetSymbolFlag( mpImplFont->GetCharSet() == RTL_TEXTENCODING_SYMBOL 
);
+    rAttrs.SetMicrosoftSymbolEncoded( mpImplFont->GetCharSet() == 
RTL_TEXTENCODING_SYMBOL );
 }
 
 // tdf#127471 for corrections on EMF/WMF we need the AvgFontWidth in 
Windows-specific notation
diff --git a/vcl/source/font/fontattributes.cxx 
b/vcl/source/font/fontattributes.cxx
index 20e8e1b65edd..5c020d072480 100644
--- a/vcl/source/font/fontattributes.cxx
+++ b/vcl/source/font/fontattributes.cxx
@@ -25,8 +25,7 @@ FontAttributes::FontAttributes()
     mePitch( PITCH_DONTKNOW ),
     meWidthType ( WIDTH_DONTKNOW ),
     meItalic ( ITALIC_NONE ),
-    meCharSet( RTL_TEXTENCODING_DONTKNOW ),
-    mbSymbolFlag( false ),
+    mbMicrosoftSymbolEncoded( false ),
     mnQuality( 0 )
 {}
 
@@ -53,7 +52,7 @@ bool 
FontAttributes::CompareDeviceIndependentFontAttributes(const FontAttributes
     if (meWidthType != rOther.meWidthType)
         return false;
 
-    if (mbSymbolFlag != rOther.mbSymbolFlag)
+    if (mbMicrosoftSymbolEncoded != rOther.mbMicrosoftSymbolEncoded)
         return false;
 
     return true;
diff --git a/vcl/source/font/fontcache.cxx b/vcl/source/font/fontcache.cxx
index ef08a5467321..9fde6e5407a0 100644
--- a/vcl/source/font/fontcache.cxx
+++ b/vcl/source/font/fontcache.cxx
@@ -64,7 +64,7 @@ bool ImplFontCache::IFSD_Equal::operator()(const 
vcl::font::FontSelectPattern& r
 
     // Symbol fonts may recode from one type to another So they are only
     // safely equivalent for equal targets
-    if (rA.IsSymbolFont() || rB.IsSymbolFont())
+    if (rA.IsMicrosoftSymbolEncoded() || rB.IsMicrosoftSymbolEncoded())
     {
         if (rA.maTargetName != rB.maTargetName)
             return false;
@@ -152,7 +152,7 @@ rtl::Reference<LogicalFontInstance> 
ImplFontCache::GetFontInstance( PhysicalFont
 
         // if we're substituting from or to a symbol font we may need a symbol
         // conversion table
-        if( pFontData->IsSymbolFont() || aFontSelData.IsSymbolFont() )
+        if( pFontData->IsMicrosoftSymbolEncoded() || 
aFontSelData.IsMicrosoftSymbolEncoded() )
         {
             if( aFontSelData.maTargetName != aFontSelData.maSearchName )
                 pFontInstance->mpConversion = ConvertChar::GetRecodeData( 
aFontSelData.maTargetName, aFontSelData.maSearchName );
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index 7870131fae36..7b40d46a1123 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -61,7 +61,7 @@ FontMetric::FontMetric(vcl::font::PhysicalFontFace const& 
rFace)
 {
     SetFamilyName(rFace.GetFamilyName());
     SetStyleName(rFace.GetStyleName());
-    SetCharSet(rFace.GetCharSet());
+    SetCharSet(rFace.IsMicrosoftSymbolEncoded() ? RTL_TEXTENCODING_SYMBOL : 
RTL_TEXTENCODING_UNICODE);
     SetFamily(rFace.GetFamilyType());
     SetPitch(rFace.GetPitch());
     SetWeight(rFace.GetWeight());
diff --git a/vcl/source/gdi/pdfbuildin_fonts.cxx 
b/vcl/source/gdi/pdfbuildin_fonts.cxx
index d6504c5c0fb7..e387f78638d3 100644
--- a/vcl/source/gdi/pdfbuildin_fonts.cxx
+++ b/vcl/source/gdi/pdfbuildin_fonts.cxx
@@ -59,7 +59,8 @@ FontAttributes BuildinFont::GetFontAttributes() const
     aDFA.SetFamilyName(OUString::createFromAscii(m_pName));
     aDFA.SetStyleName(OUString::createFromAscii(m_pStyleName));
     aDFA.SetFamilyType(m_eFamily);
-    aDFA.SetSymbolFlag(m_eCharSet != RTL_TEXTENCODING_MS_1252);
+    // dubious, see BuildinFont::GetFontCharMap
+    aDFA.SetMicrosoftSymbolEncoded(m_eCharSet != RTL_TEXTENCODING_MS_1252);
     aDFA.SetPitch(m_ePitch);
     aDFA.SetWeight(m_eWeight);
     aDFA.SetItalic(m_eItalic);
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 4efca33b13e8..8ba2ac6e0428 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2376,7 +2376,7 @@ std::map< sal_Int32, sal_Int32 > 
PDFWriterImpl::emitSystemFont( const vcl::font:
             aLine.append( "/BaseFont/" );
             appendName( aInfo.m_aPSName, aLine );
             aLine.append( "\n" );
-            if( !pFace->IsSymbolFont() )
+            if (!pFace->IsMicrosoftSymbolEncoded())
                 aLine.append( "/Encoding/WinAnsiEncoding\n" );
             aLine.append( "/FirstChar 32 /LastChar 255\n"
                           "/Widths[" );
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index ec24bc9abc6b..5014800fa2c6 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -187,7 +187,7 @@ FontMetric OutputDevice::GetFontMetric() const
     aMetric.SetFamilyName( maFont.GetFamilyName() );
     aMetric.SetStyleName( xFontMetric->GetStyleName() );
     aMetric.SetFontSize( PixelToLogic( Size( xFontMetric->GetWidth(), 
xFontMetric->GetAscent() + xFontMetric->GetDescent() - 
xFontMetric->GetInternalLeading() ) ) );
-    aMetric.SetCharSet( xFontMetric->IsSymbolFont() ? RTL_TEXTENCODING_SYMBOL 
: RTL_TEXTENCODING_UNICODE );
+    aMetric.SetCharSet( xFontMetric->IsMicrosoftSymbolEncoded() ? 
RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE );
     aMetric.SetFamily( xFontMetric->GetFamilyType() );
     aMetric.SetPitch( xFontMetric->GetPitch() );
     aMetric.SetWeight( xFontMetric->GetWeight() );
diff --git a/vcl/unx/generic/fontmanager/fontsubst.cxx 
b/vcl/unx/generic/fontmanager/fontsubst.cxx
index 0f429723b21e..d4fae2f79085 100644
--- a/vcl/unx/generic/fontmanager/fontsubst.cxx
+++ b/vcl/unx/generic/fontmanager/fontsubst.cxx
@@ -99,7 +99,7 @@ namespace
 bool FcPreMatchSubstitution::FindFontSubstitute(vcl::font::FontSelectPattern 
&rFontSelData) const
 {
     // We don't actually want to talk to Fontconfig at all for symbol fonts
-    if( rFontSelData.IsSymbolFont() )
+    if( rFontSelData.IsMicrosoftSymbolEncoded() )
         return false;
     // OpenSymbol is a unicode font, but it still deserves to be treated as a 
symbol font
     if ( IsOpenSymbol(rFontSelData.maSearchName) )
@@ -175,7 +175,7 @@ bool 
FcGlyphFallbackSubstitution::FindFontSubstitute(vcl::font::FontSelectPatter
     OUString& rMissingCodes ) const
 {
     // We don't actually want to talk to Fontconfig at all for symbol fonts
-    if( rFontSelData.IsSymbolFont() )
+    if( rFontSelData.IsMicrosoftSymbolEncoded() )
         return false;
     // OpenSymbol is a unicode font, but it still deserves to be treated as a 
symbol font
     if ( IsOpenSymbol(rFontSelData.maSearchName) )
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx 
b/vcl/unx/generic/print/genpspgraphics.cxx
index 29049cb44d69..54496bff8d6c 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -309,7 +309,7 @@ FontAttributes GenPspGraphics::Info2FontAttributes( const 
psp::FastPrintFontInfo
     aDFA.SetItalic( rInfo.m_eItalic );
     aDFA.SetWidthType( rInfo.m_eWidth );
     aDFA.SetPitch( rInfo.m_ePitch );
-    aDFA.SetSymbolFlag( rInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL );
+    aDFA.SetMicrosoftSymbolEncoded( rInfo.m_aEncoding == 
RTL_TEXTENCODING_SYMBOL );
     aDFA.SetQuality(512);
 
     // add font family name aliases
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 7139aa038163..9dde07473845 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -170,7 +170,7 @@ const std::map<OUString, OUString> aBitmapFontSubs =
 // TODO: See if Windows have API that we can use here to improve font fallback.
 bool 
WinPreMatchFontSubstititution::FindFontSubstitute(vcl::font::FontSelectPattern& 
rFontSelData) const
 {
-    if (rFontSelData.IsSymbolFont() || IsOpenSymbol(rFontSelData.maSearchName))
+    if (rFontSelData.IsMicrosoftSymbolEncoded() || 
IsOpenSymbol(rFontSelData.maSearchName))
         return false;
 
     for (const auto& aSub : aBitmapFontSubs)
@@ -448,7 +448,7 @@ static FontAttributes WinFont2DevFontAttributes( const 
ENUMLOGFONTEXW& rEnumFont
     aDFA.SetWeight(ImplWeightToSal( rLogFont.lfWeight ));
     aDFA.SetItalic((rLogFont.lfItalic) ? ITALIC_NORMAL : ITALIC_NONE);
     aDFA.SetPitch(ImplLogPitchToSal( rLogFont.lfPitchAndFamily ));
-    aDFA.SetSymbolFlag(rLogFont.lfCharSet == SYMBOL_CHARSET);
+    aDFA.SetMicrosoftSymbolEncoded(rLogFont.lfCharSet == SYMBOL_CHARSET);
 
     // get the font face name
     aDFA.SetFamilyName(OUString(o3tl::toU(rLogFont.lfFaceName)));
@@ -697,7 +697,7 @@ void ImplGetLogFontFromFontSelect( const 
vcl::font::FontSelectPattern& rFont,
     }
     else
     {
-        rLogFont.lfCharSet = rFont.IsSymbolFont() ? SYMBOL_CHARSET : 
DEFAULT_CHARSET;
+        rLogFont.lfCharSet = rFont.IsMicrosoftSymbolEncoded() ? SYMBOL_CHARSET 
: DEFAULT_CHARSET;
         rLogFont.lfPitchAndFamily = ImplPitchToWin( rFont.GetPitch() )
                                   | ImplFamilyToWin( rFont.GetFamilyType() );
     }
@@ -860,7 +860,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& 
rxFontMetric, int nFa
 
     // device independent font attributes
     rxFontMetric->SetFamilyType(ImplFamilyToSal( aWinMetric.tmPitchAndFamily 
));
-    rxFontMetric->SetSymbolFlag(aWinMetric.tmCharSet == SYMBOL_CHARSET);
+    rxFontMetric->SetMicrosoftSymbolEncoded(aWinMetric.tmCharSet == 
SYMBOL_CHARSET);
     rxFontMetric->SetWeight(ImplWeightToSal( aWinMetric.tmWeight ));
     rxFontMetric->SetPitch(ImplMetricPitchToSal( aWinMetric.tmPitchAndFamily 
));
     rxFontMetric->SetItalic(aWinMetric.tmItalic ? ITALIC_NORMAL : ITALIC_NONE);

Reply via email to