Kaydet (Commit) e5ac3524 authored tarafından Christina Rossmanith's avatar Christina Rossmanith Kaydeden (comit) Caolán McNamara

Replace getLength() with isEmpty() in vcl/generic/fontmanager

üst 8ca94d31
......@@ -176,7 +176,7 @@ void FontCache::flush()
for( ::std::list< int >::const_iterator name_it = (*it)->m_aAliases.begin(); name_it != (*it)->m_aAliases.end(); ++name_it )
{
const OUString& rAdd( pAtoms->getString( ATOM_FAMILYNAME, *name_it ) );
if( rAdd.getLength() )
if( !rAdd.isEmpty() )
{
aLine.append(';');
aLine.append(OUStringToOString(rAdd, RTL_TEXTENCODING_UTF8));
......@@ -233,7 +233,7 @@ void FontCache::flush()
break;
default: break;
}
if( (*it)->m_aStyleName.getLength() )
if( !(*it)->m_aStyleName.isEmpty() )
{
aLine.append(';');
aLine.append(OUStringToOString((*it)->m_aStyleName, RTL_TEXTENCODING_UTF8));
......
......@@ -773,7 +773,7 @@ bool PrintFontManager::Substitute( FontSelectPattern &rPattern, rtl::OUString& r
FcPatternAddString(pPattern, FC_FAMILY, pTargetNameUtf8);
const rtl::OString aLangAttrib = MsLangId::convertLanguageToIsoByteString(rPattern.meLanguage);
if( aLangAttrib.getLength() )
if( !aLangAttrib.isEmpty() )
{
const FcChar8* pLangAttribUtf8;
if (aLangAttrib.equalsIgnoreAsciiCase(OString(RTL_CONSTASCII_STRINGPARAM("pa-in"))))
......@@ -784,7 +784,7 @@ bool PrintFontManager::Substitute( FontSelectPattern &rPattern, rtl::OUString& r
}
// Add required Unicode characters, if any
if ( rMissingCodes.getLength() )
if ( !rMissingCodes.isEmpty() )
{
FcCharSet *unicodes = FcCharSetCreate();
for( sal_Int32 nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); )
......@@ -889,7 +889,7 @@ bool PrintFontManager::Substitute( FontSelectPattern &rPattern, rtl::OUString& r
}
// update rMissingCodes by removing resolved unicodes
if( rMissingCodes.getLength() > 0 )
if( !rMissingCodes.isEmpty() )
{
sal_uInt32* pRemainingCodes = (sal_uInt32*)alloca( rMissingCodes.getLength() * sizeof(sal_uInt32) );
int nRemainingLen = 0;
......@@ -954,7 +954,7 @@ ImplFontOptions* PrintFontManager::getFontOptions(
boost::unordered_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aLocalizedToCanonical.find(sFamily);
if (aI != rWrapper.m_aLocalizedToCanonical.end())
sFamily = aI->second;
if( sFamily.getLength() )
if( !sFamily.isEmpty() )
FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)sFamily.getStr());
addtopattern(pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch);
......@@ -1021,22 +1021,22 @@ bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star
OString aLangAttrib;
// populate pattern with font characteristics
if( rLocale.Language.getLength() )
if( !rLocale.Language.isEmpty() )
{
OUStringBuffer aLang(6);
aLang.append( rLocale.Language );
if( rLocale.Country.getLength() )
if( !rLocale.Country.isEmpty() )
{
aLang.append( sal_Unicode('-') );
aLang.append( rLocale.Country );
}
aLangAttrib = OUStringToOString( aLang.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
}
if( aLangAttrib.getLength() )
if( !aLangAttrib.isEmpty() )
FcPatternAddString(pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr());
OString aFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 );
if( aFamily.getLength() )
if( !aFamily.isEmpty() )
FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)aFamily.getStr());
addtopattern(pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch);
......
......@@ -613,7 +613,7 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult
if( ! m_nFamilyName )
{
aFamily = OStringToOUString( pInfo->gfi->familyName, RTL_TEXTENCODING_ISO_8859_1 );
if( ! aFamily.getLength() )
if( aFamily.isEmpty() )
{
aFamily = OStringToOUString( pInfo->gfi->fontName, RTL_TEXTENCODING_ISO_8859_1 );
sal_Int32 nIndex = 0;
......@@ -627,7 +627,7 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult
// style name: if fullname begins with family name
// interpret the rest of fullname as style
if( ! m_aStyleName.getLength() && pInfo->gfi->fullName && *pInfo->gfi->fullName )
if( m_aStyleName.isEmpty() && pInfo->gfi->fullName && *pInfo->gfi->fullName )
{
OUString aFullName( OStringToOUString( pInfo->gfi->fullName, RTL_TEXTENCODING_ISO_8859_1 ) );
if( aFullName.indexOf( aFamily ) == 0 )
......@@ -1494,7 +1494,7 @@ void PrintFontManager::analyzeTrueTypeFamilyName( void* pTTFont, ::std::list< OU
}
DisposeNameRecords( pNameRecords, nNameRecords );
}
if( aFamily.getLength() )
if( !aFamily.isEmpty() )
{
rNames.push_front( aFamily );
for( ::std::set< OUString >::const_iterator it = aSet.begin(); it != aSet.end(); ++it )
......@@ -1545,7 +1545,7 @@ bool PrintFontManager::analyzeTrueTypeFile( PrintFont* pFont ) const
}
for( ::std::list< OUString >::iterator it = aNames.begin(); it != aNames.end(); ++it )
{
if( it->getLength() )
if( !it->isEmpty() )
{
int nAlias = m_pAtoms->getAtom( ATOM_FAMILYNAME, *it, sal_True );
if( nAlias != pFont->m_nFamilyName )
......@@ -1720,7 +1720,7 @@ void PrintFontManager::initialize()
// search for the fonts in SAL_PRIVATE_FONTPATH first; those are
// the fonts installed with the office
if( rSalPrivatePath.getLength() )
if( !rSalPrivatePath.isEmpty() )
{
OString aPath = rtl::OUStringToOString( rSalPrivatePath, aEncoding );
const bool bAreFCSubstitutionsEnabled = AreFCSubstitutionsEnabled();
......@@ -1729,7 +1729,7 @@ void PrintFontManager::initialize()
{
OString aToken = aPath.getToken( 0, ';', nIndex );
normPath( aToken );
if (!aToken.getLength())
if ( aToken.isEmpty() )
{
continue;
}
......
......@@ -157,7 +157,7 @@ void psp::getPrinterPathList( std::list< OUString >& rPathList, const char* pSub
do
{
OString aDir( aPath.getToken( 0, ':', nIndex ) );
if( ! aDir.getLength() )
if( aDir.isEmpty() )
continue;
if( pSubDir )
......@@ -201,14 +201,14 @@ OUString psp::getFontPath()
{
static OUString aPath;
if( ! aPath.getLength() )
if (aPath.isEmpty())
{
OUStringBuffer aPathBuffer( 512 );
OUString aConfigPath( getOfficePath( psp::ConfigPath ) );
OUString aInstallationRootPath( getOfficePath( psp::InstallationRootPath ) );
OUString aUserPath( getOfficePath( psp::UserPath ) );
if( aConfigPath.getLength() )
if( !aConfigPath.isEmpty() )
{
// #i53530# Path from CustomDataUrl will completely
// replace net and user paths if the path exists
......@@ -225,16 +225,16 @@ OUString psp::getFontPath()
aPathBuffer.appendAscii("/share/fonts");
}
}
if( aConfigPath.getLength() == 0 )
if( aConfigPath.isEmpty() )
{
if( aInstallationRootPath.getLength() )
if( !aInstallationRootPath.isEmpty() )
{
aPathBuffer.append( aInstallationRootPath );
aPathBuffer.appendAscii( "/share/fonts/truetype;");
aPathBuffer.append( aInstallationRootPath );
aPathBuffer.appendAscii( "/share/fonts/type1;" );
}
if( aUserPath.getLength() )
if( !aUserPath.isEmpty() )
{
aPathBuffer.append( aUserPath );
aPathBuffer.appendAscii( "/user/fonts" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment