vcl: Format PhysicalFontFace.{cxx,hxx}
They are small files, lets format before adding more code.
Change-Id: I5e8e7e4031f045cf6e124dd533e37ab67f34e985
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139394
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@aliftype.com>
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index db4a72c..bca76db 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -14315,7 +14315,6 @@ vcl/inc/factory.hxx
vcl/inc/fltcall.hxx
vcl/inc/font/FontSelectPattern.hxx
vcl/inc/font/PhysicalFontCollection.hxx
vcl/inc/font/PhysicalFontFace.hxx
vcl/inc/fontattributes.hxx
vcl/inc/fontinstance.hxx
vcl/inc/fontsubset.hxx
@@ -14812,7 +14811,6 @@ vcl/source/filter/wmf/wmfwr.hxx
vcl/source/font/DirectFontSubstitution.cxx
vcl/source/font/FontSelectPattern.cxx
vcl/source/font/PhysicalFontCollection.cxx
vcl/source/font/PhysicalFontFace.cxx
vcl/source/font/PhysicalFontFamily.cxx
vcl/source/font/font.cxx
vcl/source/font/fontattributes.cxx
diff --git a/vcl/inc/font/PhysicalFontFace.hxx b/vcl/inc/font/PhysicalFontFace.hxx
index 52acaac..ee65766 100644
--- a/vcl/inc/font/PhysicalFontFace.hxx
+++ b/vcl/inc/font/PhysicalFontFace.hxx
@@ -51,8 +51,8 @@ class FontSelectPattern;
struct FontMatchStatus
{
public:
int mnFaceMatch;
const OUString* mpTargetStyleName;
int mnFaceMatch;
const OUString* mpTargetStyleName;
};
// TODO: no more direct access to members
@@ -65,31 +65,35 @@ public:
* It acts as a factory for its corresponding LogicalFontInstances and
* can be extended to cache device and font instance specific data.
*/
class VCL_PLUGIN_PUBLIC PhysicalFontFace : public FontAttributes, public salhelper::SimpleReferenceObject
class VCL_PLUGIN_PUBLIC PhysicalFontFace : public FontAttributes,
public salhelper::SimpleReferenceObject
{
public:
~PhysicalFontFace();
virtual rtl::Reference<LogicalFontInstance> CreateFontInstance(const vcl::font::FontSelectPattern&) const = 0;
virtual rtl::Reference<LogicalFontInstance>
CreateFontInstance(const vcl::font::FontSelectPattern&) const = 0;
virtual sal_IntPtr GetFontId() const = 0;
virtual FontCharMapRef GetFontCharMap() const;
virtual sal_IntPtr GetFontId() const = 0;
virtual FontCharMapRef GetFontCharMap() const;
virtual bool GetFontCapabilities(vcl::FontCapabilities&) const = 0;
bool IsBetterMatch( const vcl::font::FontSelectPattern&, FontMatchStatus& ) const;
sal_Int32 CompareIgnoreSize( const PhysicalFontFace& ) const;
bool IsBetterMatch(const vcl::font::FontSelectPattern&, FontMatchStatus&) const;
sal_Int32 CompareIgnoreSize(const PhysicalFontFace&) const;
virtual hb_face_t* GetHbFace() const;
virtual hb_blob_t* GetHbTable(hb_tag_t) const { assert(false); return nullptr; }
virtual hb_face_t* GetHbFace() const;
virtual hb_blob_t* GetHbTable(hb_tag_t) const
{
assert(false);
return nullptr;
}
protected:
mutable hb_face_t* mpHbFace;
mutable FontCharMapRef mxCharMap;
mutable hb_face_t* mpHbFace;
mutable FontCharMapRef mxCharMap;
explicit PhysicalFontFace(const FontAttributes&);
};
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/font/PhysicalFontFace.cxx b/vcl/source/font/PhysicalFontFace.cxx
index 917295f..2b09505 100644
--- a/vcl/source/font/PhysicalFontFace.cxx
+++ b/vcl/source/font/PhysicalFontFace.cxx
@@ -34,15 +34,14 @@
namespace vcl::font
{
PhysicalFontFace::PhysicalFontFace( const FontAttributes& rDFA )
: FontAttributes( rDFA )
PhysicalFontFace::PhysicalFontFace(const FontAttributes& rDFA)
: FontAttributes(rDFA)
, mpHbFace(nullptr)
{
// StarSymbol is a unicode font, but it still deserves the symbol flag
if( !IsSymbolFont() )
if ( IsStarSymbol( GetFamilyName() ) )
SetSymbolFlag( true );
if (!IsSymbolFont())
if (IsStarSymbol(GetFamilyName()))
SetSymbolFlag(true);
}
PhysicalFontFace::~PhysicalFontFace()
@@ -51,29 +50,29 @@ PhysicalFontFace::~PhysicalFontFace()
hb_face_destroy(mpHbFace);
}
sal_Int32 PhysicalFontFace::CompareIgnoreSize( const PhysicalFontFace& rOther ) const
sal_Int32 PhysicalFontFace::CompareIgnoreSize(const PhysicalFontFace& rOther) const
{
// compare their width, weight, italic, style name and family name
if( GetWidthType() < rOther.GetWidthType() )
if (GetWidthType() < rOther.GetWidthType())
return -1;
else if( GetWidthType() > rOther.GetWidthType() )
else if (GetWidthType() > rOther.GetWidthType())
return 1;
if( GetWeight() < rOther.GetWeight() )
if (GetWeight() < rOther.GetWeight())
return -1;
else if( GetWeight() > rOther.GetWeight() )
else if (GetWeight() > rOther.GetWeight())
return 1;
if( GetItalic() < rOther.GetItalic() )
if (GetItalic() < rOther.GetItalic())
return -1;
else if( GetItalic() > rOther.GetItalic() )
else if (GetItalic() > rOther.GetItalic())
return 1;
sal_Int32 nRet = GetFamilyName().compareTo( rOther.GetFamilyName() );
sal_Int32 nRet = GetFamilyName().compareTo(rOther.GetFamilyName());
if (nRet == 0)
{
nRet = GetStyleName().compareTo( rOther.GetStyleName() );
nRet = GetStyleName().compareTo(rOther.GetStyleName());
}
return nRet;
@@ -91,7 +90,8 @@ static int FamilyNameMatchValue(FontSelectPattern const& rFSP, std::u16string_vi
static int StyleNameMatchValue(FontMatchStatus const& rStatus, std::u16string_view rStyle)
{
if (rStatus.mpTargetStyleName && o3tl::equalsIgnoreAsciiCase(rStyle, *rStatus.mpTargetStyleName))
if (rStatus.mpTargetStyleName
&& o3tl::equalsIgnoreAsciiCase(rStyle, *rStatus.mpTargetStyleName))
return 120000;
return 0;
@@ -181,7 +181,7 @@ static int ItalicMatchValue(FontSelectPattern const& rFSP, FontItalic eItalic)
return 0;
}
bool PhysicalFontFace::IsBetterMatch( const FontSelectPattern& rFSP, FontMatchStatus& rStatus ) const
bool PhysicalFontFace::IsBetterMatch(const FontSelectPattern& rFSP, FontMatchStatus& rStatus) const
{
int nMatch = FamilyNameMatchValue(rFSP, GetFamilyName());
nMatch += StyleNameMatchValue(rStatus, GetStyleName());
@@ -197,13 +197,13 @@ bool PhysicalFontFace::IsBetterMatch( const FontSelectPattern& rFSP, FontMatchSt
else
nMatch += 5;
if( rStatus.mnFaceMatch > nMatch )
if (rStatus.mnFaceMatch > nMatch)
{
return false;
}
else if( rStatus.mnFaceMatch < nMatch )
else if (rStatus.mnFaceMatch < nMatch)
{
rStatus.mnFaceMatch = nMatch;
rStatus.mnFaceMatch = nMatch;
return true;
}
@@ -218,7 +218,8 @@ static hb_blob_t* getTable(hb_face_t*, hb_tag_t nTag, void* pUserData)
hb_face_t* PhysicalFontFace::GetHbFace() const
{
if (mpHbFace == nullptr)
mpHbFace = hb_face_create_for_tables(getTable, const_cast<PhysicalFontFace*>(this), nullptr);
mpHbFace
= hb_face_create_for_tables(getTable, const_cast<PhysicalFontFace*>(this), nullptr);
return mpHbFace;
}