[Libreoffice-commits] core.git: vcl/inc vcl/source vcl/win
Chris Sherlock
chris.sherlock79 at gmail.com
Wed Dec 23 17:32:30 PST 2015
vcl/inc/PhysicalFontCollection.hxx | 16 +++----
vcl/source/font/PhysicalFontCollection.cxx | 64 ++++++++++++++---------------
vcl/source/font/PhysicalFontFamily.cxx | 4 -
vcl/source/outdev/font.cxx | 2
vcl/win/gdi/salgdi3.cxx | 4 -
5 files changed, 45 insertions(+), 45 deletions(-)
New commits:
commit 4842b8f2fbdbf543effb92d4df332b50e3ffd6f7
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Thu Dec 24 11:49:14 2015 +1100
vcl: update names of find functions in PhysicalFontCollection
The main issue I have with the naming convention is that it doesn't
show you clearly what you are finding. We look for FontFamily instances,
but later on down the track what if we want to find something else?
Change-Id: I0a4267581eafd0bf17548e8d16814b5b49d27ec9
Reviewed-on: https://gerrit.libreoffice.org/20916
Reviewed-by: Chris Sherlock <chris.sherlock79 at gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79 at gmail.com>
diff --git a/vcl/inc/PhysicalFontCollection.hxx b/vcl/inc/PhysicalFontCollection.hxx
index 083fc7f..67d762d 100644
--- a/vcl/inc/PhysicalFontCollection.hxx
+++ b/vcl/inc/PhysicalFontCollection.hxx
@@ -46,10 +46,10 @@ public:
// find the device font family
PhysicalFontFamily* FindFontFamily( const OUString& rFontName ) const;
- PhysicalFontFamily* FindOrCreateFamily( const OUString &rFamilyName );
- PhysicalFontFamily* FindByFont( FontSelectPattern& ) const;
- PhysicalFontFamily* FindByTokenNames(const OUString& rTokenStr) const;
- PhysicalFontFamily* FindByAttributes(ImplFontAttrs nSearchType, FontWeight, FontWidth,
+ PhysicalFontFamily* FindOrCreateFontFamily( const OUString &rFamilyName );
+ PhysicalFontFamily* FindFontFamilyByFont( FontSelectPattern& ) const;
+ PhysicalFontFamily* FindFontFamilyByTokenNames(const OUString& rTokenStr) const;
+ PhysicalFontFamily* FindFontFamilyByAttributes(ImplFontAttrs nSearchType, FontWeight, FontWidth,
FontItalic, const OUString& rSearchFamily) const;
// suggest fonts for glyph fallback
@@ -81,11 +81,11 @@ private:
void ImplInitMatchData() const;
void ImplInitGenericGlyphFallback() const;
- PhysicalFontFamily* ImplFindBySearchName( const OUString& ) const;
- PhysicalFontFamily* ImplFindByAliasName ( const OUString& rSearchName, const OUString& rShortName) const;
- PhysicalFontFamily* ImplFindBySubstFontAttr( const utl::FontNameAttr& ) const;
+ PhysicalFontFamily* ImplFindFontFamilyBySearchName( const OUString& ) const;
+ PhysicalFontFamily* ImplFindFontFamilyByAliasName ( const OUString& rSearchName, const OUString& rShortName) const;
+ PhysicalFontFamily* ImplFindFontFamilyBySubstFontAttr( const utl::FontNameAttr& ) const;
- PhysicalFontFamily* ImplFindDefaultFont() const;
+ PhysicalFontFamily* ImplFindDefaultFontFamily() const;
};
diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx
index 13f0e81..72b0d85 100644
--- a/vcl/source/font/PhysicalFontCollection.cxx
+++ b/vcl/source/font/PhysicalFontCollection.cxx
@@ -298,7 +298,7 @@ void PhysicalFontCollection::Add( PhysicalFontFace* pNewData )
{
OUString aSearchName = GetEnglishSearchFontName( pNewData->GetFamilyName() );
- PhysicalFontFamily* pFoundData = FindOrCreateFamily( aSearchName );
+ PhysicalFontFamily* pFoundData = FindOrCreateFontFamily( aSearchName );
bool bKeepNewData = pFoundData->AddFontFace( pNewData );
@@ -307,7 +307,7 @@ void PhysicalFontCollection::Add( PhysicalFontFace* pNewData )
}
// find the font from the normalized font family name
-PhysicalFontFamily* PhysicalFontCollection::ImplFindBySearchName( const OUString& rSearchName ) const
+PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyBySearchName( const OUString& rSearchName ) const
{
// must be called with a normalized name.
assert( GetEnglishSearchFontName( rSearchName ) == rSearchName );
@@ -320,7 +320,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindBySearchName( const OUString
return pFoundData;
}
-PhysicalFontFamily* PhysicalFontCollection::ImplFindByAliasName(const OUString& rSearchName,
+PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyByAliasName(const OUString& rSearchName,
const OUString& rShortName) const
{
// short circuit for impossible font name alias
@@ -359,10 +359,10 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAliasName(const OUString&
PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( const OUString& rFontName ) const
{
- return ImplFindBySearchName( GetEnglishSearchFontName( rFontName ) );
+ return ImplFindFontFamilyBySearchName( GetEnglishSearchFontName( rFontName ) );
}
-PhysicalFontFamily *PhysicalFontCollection::FindOrCreateFamily( const OUString &rFamilyName )
+PhysicalFontFamily *PhysicalFontCollection::FindOrCreateFontFamily( const OUString &rFamilyName )
{
PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.find( rFamilyName );
PhysicalFontFamily* pFoundData = nullptr;
@@ -379,7 +379,7 @@ PhysicalFontFamily *PhysicalFontCollection::FindOrCreateFamily( const OUString &
return pFoundData;
}
-PhysicalFontFamily* PhysicalFontCollection::FindByTokenNames(const OUString& rTokenStr) const
+PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByTokenNames(const OUString& rTokenStr) const
{
PhysicalFontFamily* pFoundData = nullptr;
@@ -399,7 +399,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByTokenNames(const OUString& rTo
return pFoundData;
}
-PhysicalFontFamily* PhysicalFontCollection::ImplFindBySubstFontAttr( const utl::FontNameAttr& rFontAttr ) const
+PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyBySubstFontAttr( const utl::FontNameAttr& rFontAttr ) const
{
PhysicalFontFamily* pFoundData = nullptr;
@@ -421,7 +421,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindBySubstFontAttr( const utl::
const FontItalic eSearchSlant = ITALIC_DONTKNOW;
const OUString aSearchName;
- pFoundData = FindByAttributes( nSearchType,
+ pFoundData = FindFontFamilyByAttributes( nSearchType,
eSearchWeight, eSearchWidth, eSearchSlant, aSearchName );
if( pFoundData )
@@ -454,11 +454,11 @@ void PhysicalFontCollection::ImplInitMatchData() const
}
}
-PhysicalFontFamily* PhysicalFontCollection::FindByAttributes( ImplFontAttrs nSearchType,
- FontWeight eSearchWeight,
- FontWidth eSearchWidth,
- FontItalic eSearchItalic,
- const OUString& rSearchFamilyName ) const
+PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttributes( ImplFontAttrs nSearchType,
+ FontWeight eSearchWeight,
+ FontWidth eSearchWidth,
+ FontItalic eSearchItalic,
+ const OUString& rSearchFamilyName ) const
{
if( (eSearchItalic != ITALIC_NONE) && (eSearchItalic != ITALIC_DONTKNOW) )
nSearchType |= ImplFontAttrs::Italic;
@@ -876,7 +876,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByAttributes( ImplFontAttrs nSea
return pFoundData;
}
-PhysicalFontFamily* PhysicalFontCollection::ImplFindDefaultFont() const
+PhysicalFontFamily* PhysicalFontCollection::ImplFindDefaultFontFamily() const
{
// try to find one of the default fonts of the
// UNICODE, SANSSERIF, SERIF or FIXED default font lists
@@ -886,23 +886,23 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindDefaultFont() const
const utl::DefaultFontConfiguration& rDefaults = utl::DefaultFontConfiguration::get();
LanguageTag aLanguageTag( OUString( "en"));
OUString aFontname = rDefaults.getDefaultFont( aLanguageTag, DefaultFontType::SANS_UNICODE );
- pFoundData = FindByTokenNames( aFontname );
+ pFoundData = FindFontFamilyByTokenNames( aFontname );
if( pFoundData )
return pFoundData;
aFontname = rDefaults.getDefaultFont( aLanguageTag, DefaultFontType::SANS );
- pFoundData = FindByTokenNames( aFontname );
+ pFoundData = FindFontFamilyByTokenNames( aFontname );
if( pFoundData )
return pFoundData;
aFontname = rDefaults.getDefaultFont( aLanguageTag, DefaultFontType::SERIF );
- pFoundData = FindByTokenNames( aFontname );
+ pFoundData = FindFontFamilyByTokenNames( aFontname );
if( pFoundData )
return pFoundData;
aFontname = rDefaults.getDefaultFont( aLanguageTag, DefaultFontType::FIXED );
- pFoundData = FindByTokenNames( aFontname );
+ pFoundData = FindFontFamilyByTokenNames( aFontname );
if( pFoundData )
return pFoundData;
}
@@ -985,7 +985,7 @@ ImplGetDevSizeList* PhysicalFontCollection::GetDevSizeList( const OUString& rFon
return pGetDevSizeList;
}
-PhysicalFontFamily* PhysicalFontCollection::FindByFont( FontSelectPattern& rFSD ) const
+PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByFont( FontSelectPattern& rFSD ) const
{
// give up if no fonts are available
if( !Count() )
@@ -1036,7 +1036,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByFont( FontSelectPattern& rFSD
else if( aSearchName.equalsIgnoreAsciiCase( "hgpminchob" ) )
aBoldName = "hgpminchoe";
- if( !aBoldName.isEmpty() && ImplFindBySearchName( aBoldName ) )
+ if( !aBoldName.isEmpty() && ImplFindFontFamilyBySearchName( aBoldName ) )
{
// the other font is available => use it
aSearchName = aBoldName;
@@ -1050,7 +1050,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByFont( FontSelectPattern& rFSD
rFSD.maTargetName = aOrigName;
#endif
// check if the current font name token or its substitute is valid
- PhysicalFontFamily* pFoundData = ImplFindBySearchName( aSearchName );
+ PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySearchName( aSearchName );
if( pFoundData )
return pFoundData;
@@ -1071,7 +1071,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByFont( FontSelectPattern& rFSD
{
rFSD.maTargetName = sStrippedName;
aSearchName = GetEnglishSearchFontName(rFSD.maTargetName);
- pFoundData = ImplFindBySearchName(aSearchName);
+ pFoundData = ImplFindFontFamilyBySearchName(aSearchName);
if( pFoundData )
return pFoundData;
}
@@ -1086,7 +1086,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByFont( FontSelectPattern& rFSD
// to restore the features to make the font selection data unique
rFSD.maTargetName = aOrigName;
#endif
- pFoundData = ImplFindBySearchName( aSearchName );
+ pFoundData = ImplFindFontFamilyBySearchName( aSearchName );
if( pFoundData )
return pFoundData;
@@ -1114,7 +1114,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByFont( FontSelectPattern& rFSD
if( mpPreMatchHook->FindFontSubstitute( rFSD ) )
aSearchName = GetEnglishSearchFontName( aSearchName );
ImplFontSubstitute( aSearchName );
- PhysicalFontFamily* pFoundData = ImplFindBySearchName( aSearchName );
+ PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySearchName( aSearchName );
if( pFoundData )
return pFoundData;
}
@@ -1140,7 +1140,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByFont( FontSelectPattern& rFSD
// use the font's shortened name if needed
if ( aSearchShortName != aSearchName )
{
- PhysicalFontFamily* pFoundData = ImplFindBySearchName( aSearchShortName );
+ PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySearchName( aSearchShortName );
if( pFoundData )
{
#ifdef UNX
@@ -1175,7 +1175,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByFont( FontSelectPattern& rFSD
// try the font substitutions suggested by the fallback info
if( pFontAttr )
{
- PhysicalFontFamily* pFoundData = ImplFindBySubstFontAttr( *pFontAttr );
+ PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySubstFontAttr( *pFontAttr );
if( pFoundData )
return pFoundData;
}
@@ -1189,7 +1189,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByFont( FontSelectPattern& rFSD
aSearchName = "OpenSymbol";
else
aSearchName = utl::DefaultFontConfiguration::get().getDefaultFont( aDefaultLanguageTag, DefaultFontType::SYMBOL );
- PhysicalFontFamily* pFoundData = FindByTokenNames( aSearchName );
+ PhysicalFontFamily* pFoundData = FindFontFamilyByTokenNames( aSearchName );
if( pFoundData )
return pFoundData;
}
@@ -1214,7 +1214,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByFont( FontSelectPattern& rFSD
// use a shortend token name if available
if( aTempShortName != aSearchName )
{
- PhysicalFontFamily* pFoundData = ImplFindBySearchName( aTempShortName );
+ PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySearchName( aTempShortName );
if( pFoundData )
return pFoundData;
}
@@ -1238,7 +1238,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByFont( FontSelectPattern& rFSD
// try the font substitutions suggested by the fallback info
if( pTempFontAttr )
{
- PhysicalFontFamily* pFoundData = ImplFindBySubstFontAttr( *pTempFontAttr );
+ PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySubstFontAttr( *pTempFontAttr );
if( pFoundData )
return pFoundData;
if( !pFontAttr )
@@ -1249,7 +1249,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByFont( FontSelectPattern& rFSD
// if still needed use the alias names of the installed fonts
if( mbMapNames )
{
- PhysicalFontFamily* pFoundData = ImplFindByAliasName( rFSD.maTargetName, aSearchShortName );
+ PhysicalFontFamily* pFoundData = ImplFindFontFamilyByAliasName( rFSD.maTargetName, aSearchShortName );
if( pFoundData )
return pFoundData;
}
@@ -1271,7 +1271,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByFont( FontSelectPattern& rFSD
}
PhysicalFontFamily::CalcType( nSearchType, eSearchWeight, eSearchWidth, rFSD.GetFamilyType(), pFontAttr );
- PhysicalFontFamily* pFoundData = FindByAttributes( nSearchType,
+ PhysicalFontFamily* pFoundData = FindFontFamilyByAttributes( nSearchType,
eSearchWeight, eSearchWidth, rFSD.GetSlant(), aSearchFamilyName );
if( pFoundData )
@@ -1302,7 +1302,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindByFont( FontSelectPattern& rFSD
else
{
// if still needed fall back to default fonts
- pFoundData = ImplFindDefaultFont();
+ pFoundData = ImplFindDefaultFontFamily();
}
return pFoundData;
diff --git a/vcl/source/font/PhysicalFontFamily.cxx b/vcl/source/font/PhysicalFontFamily.cxx
index 8cfc0e8..1496091 100644
--- a/vcl/source/font/PhysicalFontFamily.cxx
+++ b/vcl/source/font/PhysicalFontFamily.cxx
@@ -270,7 +270,7 @@ void PhysicalFontFamily::UpdateCloneFontList( PhysicalFontCollection& rFontColle
{
// This is rather expensive to do per face.
OUString aFamilyName = GetEnglishSearchFontName( GetFamilyName() );
- PhysicalFontFamily* pFamily = rFontCollection.FindOrCreateFamily( aFamilyName );
+ PhysicalFontFamily* pFamily = rFontCollection.FindOrCreateFontFamily( aFamilyName );
for( PhysicalFontFace* pFace = mpFirst; pFace; pFace = pFace->GetNextFace() )
{
@@ -282,7 +282,7 @@ void PhysicalFontFamily::UpdateCloneFontList( PhysicalFontCollection& rFontColle
PhysicalFontFace* pClonedFace = pFace->Clone();
assert( pClonedFace->GetFamilyName().replaceAll("-", "").trim() == GetFamilyName().replaceAll("-", "").trim() );
- assert( rFontCollection.FindOrCreateFamily( GetEnglishSearchFontName( pClonedFace->GetFamilyName() ) ) == pFamily );
+ assert( rFontCollection.FindOrCreateFontFamily( GetEnglishSearchFontName( pClonedFace->GetFamilyName() ) ) == pFamily );
if (! pFamily->AddFontFace( pClonedFace ) )
delete pClonedFace;
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 89fa8873..a6bed22 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1283,7 +1283,7 @@ ImplFontEntry* ImplFontCache::GetFontEntry( PhysicalFontCollection* pFontList,
if( !pEntry ) // no direct cache hit
{
// find the best matching logical font family and update font selector accordingly
- pFontFamily = pFontList->FindByFont( aFontSelData );
+ pFontFamily = pFontList->FindFontFamilyByFont( aFontSelData );
DBG_ASSERT( (pFontFamily != nullptr), "ImplFontCache::Get() No logical font found!" );
if( pFontFamily )
aFontSelData.maSearchName = pFontFamily->GetSearchName();
diff --git a/vcl/win/gdi/salgdi3.cxx b/vcl/win/gdi/salgdi3.cxx
index 02982f6d..ca8b49e 100644
--- a/vcl/win/gdi/salgdi3.cxx
+++ b/vcl/win/gdi/salgdi3.cxx
@@ -500,7 +500,7 @@ namespace
// get the default font for a specified locale
const utl::DefaultFontConfiguration& rDefaults = utl::DefaultFontConfiguration::get();
const OUString aDefault = rDefaults.getUserInterfaceFont(rLanguageTag);
- return rFontCollection.FindByTokenNames(aDefault);
+ return rFontCollection.FindFontFamilyByTokenNames(aDefault);
}
}
@@ -543,7 +543,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFon
}
// are the missing characters symbols?
- pFontFamily = pFontCollection->FindByAttributes( ImplFontAttrs::Symbol,
+ pFontFamily = pFontCollection->FindFontFamilyByAttributes( ImplFontAttrs::Symbol,
rFontSelData.GetWeight(),
rFontSelData.GetWidthType(),
rFontSelData.GetSlant(),
More information about the Libreoffice-commits
mailing list