diff options
Diffstat (limited to 'vcl/source/gdi/outdev3.cxx')
-rwxr-xr-x | vcl/source/gdi/outdev3.cxx | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 768f1e82d19d..67ef1fe9e430 100755 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -1543,14 +1543,15 @@ ImplDevFontListData* ImplDevFontList::ImplFindBySearchName( const String& rSearc // ----------------------------------------------------------------------- -ImplDevFontListData* ImplDevFontList::ImplFindByAliasName( const String& rSearchName, const String& rShortName ) const +ImplDevFontListData* ImplDevFontList::ImplFindByAliasName(const rtl::OUString& rSearchName, + const rtl::OUString& rShortName) const { // short circuit for impossible font name alias - if( !rSearchName.Len() ) + if (rSearchName.isEmpty()) return NULL; // short circuit if no alias names are available - if( !mbMapNames ) + if (!mbMapNames) return NULL; // use the font's alias names to find the font @@ -1563,7 +1564,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByAliasName( const String& rSearch continue; // if one alias name matches we found a matching font - String aTempName; + rtl::OUString aTempName; xub_StrLen nIndex = 0; do { @@ -1591,7 +1592,7 @@ ImplDevFontListData* ImplDevFontList::FindFontFamily( const String& rFontName ) // ----------------------------------------------------------------------- -ImplDevFontListData* ImplDevFontList::ImplFindByTokenNames( const String& rTokenStr ) const +ImplDevFontListData* ImplDevFontList::ImplFindByTokenNames(const rtl::OUString& rTokenStr) const { ImplDevFontListData* pFoundData = NULL; @@ -1635,10 +1636,9 @@ ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const utl::FontNa const FontWeight eSearchWeight = rFontAttr.Weight; const FontWidth eSearchWidth = rFontAttr.Width; const FontItalic eSearchSlant = ITALIC_DONTKNOW; - const FontFamily eSearchFamily = FAMILY_DONTKNOW; const String aSearchName; pFoundData = ImplFindByAttributes( nSearchType, - eSearchWeight, eSearchWidth, eSearchFamily, eSearchSlant, aSearchName ); + eSearchWeight, eSearchWidth, eSearchSlant, aSearchName ); if( pFoundData ) return pFoundData; } @@ -1668,20 +1668,11 @@ void ImplDevFontList::InitMatchData() const } } -//---------------------------------------------------------------------------- -ImplDevFontListData* ImplDevFontList::ImplFindByLocale( com::sun::star::lang::Locale& rLocale ) const -{ - // get the default font for a specified locale - const DefaultFontConfiguration& rDefaults = DefaultFontConfiguration::get(); - const String aDefault = rDefaults.getUserInterfaceFont( rLocale ); - return ImplFindByTokenNames( aDefault ); -} - // ----------------------------------------------------------------------- ImplDevFontListData* ImplDevFontList::ImplFindByAttributes( sal_uLong nSearchType, - FontWeight eSearchWeight, FontWidth eSearchWidth, FontFamily /*eSearchFamily*/, - FontItalic eSearchItalic, const String& rSearchFamilyName ) const + FontWeight eSearchWeight, FontWidth eSearchWidth, + FontItalic eSearchItalic, const rtl::OUString& rSearchFamilyName ) const { if( (eSearchItalic != ITALIC_NONE) && (eSearchItalic != ITALIC_DONTKNOW) ) nSearchType |= IMPL_FONT_ATTR_ITALIC; @@ -1789,7 +1780,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByAttributes( sal_uLong nSearchTyp nTestMatch -= 10000; // match stripped family name - if( rSearchFamilyName.Len() && (rSearchFamilyName == pData->maMatchFamilyName) ) + if( !rSearchFamilyName.isEmpty() && (rSearchFamilyName.equals(pData->maMatchFamilyName)) ) nTestMatch += 1000000*3; // match ALLSCRIPT? attribute @@ -1882,8 +1873,8 @@ ImplDevFontListData* ImplDevFontList::ImplFindByAttributes( sal_uLong nSearchTyp // test font name substrings // TODO: calculate name matching score using e.g. Levenstein distance - if( (rSearchFamilyName.Len() >= 4) && (pData->maMatchFamilyName.Len() >= 4) - && ((rSearchFamilyName.Search( pData->maMatchFamilyName ) != STRING_NOTFOUND) + if( (rSearchFamilyName.getLength() >= 4) && (pData->maMatchFamilyName.Len() >= 4) + && ((rSearchFamilyName.indexOf( pData->maMatchFamilyName ) != -1) || (pData->maMatchFamilyName.Search( rSearchFamilyName ) != STRING_NOTFOUND)) ) nTestMatch += 5000; @@ -2715,7 +2706,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( FontSelectPattern& rFSD, ImplCalcType( nSearchType, eSearchWeight, eSearchWidth, rFSD.meFamily, pFontAttr ); ImplDevFontListData* pFoundData = ImplFindByAttributes( nSearchType, - eSearchWeight, eSearchWidth, rFSD.meFamily, rFSD.meItalic, aSearchFamilyName ); + eSearchWeight, eSearchWidth, rFSD.meItalic, aSearchFamilyName ); if( pFoundData ) { |