diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-03-12 10:41:35 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-03-12 11:43:51 +0000 |
commit | da91ce535e51c814d56a6b1eddb44b5d71989261 (patch) | |
tree | 9fd6c577b561291512d94728030ca50268aef009 /vcl | |
parent | 7e16ec0347453851ef2f8870cfcf9fdbbc6bb99f (diff) |
remove unused FontFamily argument in ImplFindByAttributes
move ImplFindByLocale to windows only code, rename to
findDevFontListByLocale
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/outdev.h | 4 | ||||
-rw-r--r-- | vcl/inc/outfont.hxx | 11 | ||||
-rwxr-xr-x | vcl/source/gdi/outdev3.cxx | 35 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi3.cxx | 17 |
4 files changed, 35 insertions, 32 deletions
diff --git a/vcl/inc/outdev.h b/vcl/inc/outdev.h index 8434aa506caa..090fd887d502 100644 --- a/vcl/inc/outdev.h +++ b/vcl/inc/outdev.h @@ -86,8 +86,8 @@ friend class ImplDevFontList; // TODO: remove soon String maName; // Fontname (original font family name) String maSearchName; // normalized font family name String maMapNames; // fontname aliases - sal_uIntPtr mnTypeFaces; // Typeface Flags - sal_uIntPtr mnMatchType; // MATCH - Type + sal_uIntPtr mnTypeFaces; // Typeface Flags + sal_uIntPtr mnMatchType; // MATCH - Type String maMatchFamilyName; // MATCH - FamilyName FontWeight meMatchWeight; // MATCH - Weight FontWidth meMatchWidth; // MATCH - Width diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx index 75871dac4293..19c2c3a855a3 100644 --- a/vcl/inc/outfont.hxx +++ b/vcl/inc/outfont.hxx @@ -228,18 +228,17 @@ public: ImplGetDevFontList* GetDevFontList() const; ImplGetDevSizeList* GetDevSizeList( const String& rFontName ) const; - //used by 2-level font fallback - ImplDevFontListData* ImplFindByLocale( com::sun::star::lang::Locale& ) const; + ImplDevFontListData* ImplFindByTokenNames(const rtl::OUString& rTokenStr) const; protected: void InitMatchData() const; bool AreMapNamesAvailable() const { return mbMapNames; } - ImplDevFontListData* ImplFindByTokenNames( const String& ) const; - ImplDevFontListData* ImplFindByAliasName( const String& rSearchName, const String& rShortName ) const; + ImplDevFontListData* ImplFindByAliasName(const rtl::OUString& rSearchName, + const rtl::OUString& rShortName) const; ImplDevFontListData* ImplFindBySubstFontAttr( const utl::FontNameAttr& ) const; - ImplDevFontListData* ImplFindByAttributes( sal_uLong nSearchType, FontWeight, FontWidth, - FontFamily, FontItalic, const String& rSearchFamily ) const; + ImplDevFontListData* ImplFindByAttributes(sal_uLong nSearchType, FontWeight, FontWidth, + FontItalic, const rtl::OUString& rSearchFamily) const; ImplDevFontListData* FindDefaultFont() const; private: 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 ) { diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 2cea95951d11..3e24d7572b0d 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -544,6 +544,19 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace, return bHasMatches; } +namespace +{ + //used by 2-level font fallback + ImplDevFontListData* findDevFontListByLocale(const ImplDevFontList &rDevFontList, + const com::sun::star::lang::Locale& rLocale ) + { + // get the default font for a specified locale + const DefaultFontConfiguration& rDefaults = DefaultFontConfiguration::get(); + const rtl::OUString aDefault = rDefaults.getUserInterfaceFont(rLocale); + return rDevFontList.ImplFindByTokenNames(aDefault); + } +} + // find a fallback font for missing characters // TODO: should stylistic matches be searched and prefered? bool WinGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFontSelData, rtl::OUString& rMissingChars ) const @@ -571,7 +584,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFon // first level fallback: // try use the locale specific default fonts defined in VCL.xcu const ImplDevFontList* pDevFontList = ImplGetSVData()->maGDIData.mpScreenFontList; - /*const*/ ImplDevFontListData* pDevFont = pDevFontList->ImplFindByLocale( aLocale ); + /*const*/ ImplDevFontListData* pDevFont = findDevFontListByLocale(*pDevFontList, aLocale); if( pDevFont ) { const ImplFontData* pFace = pDevFont->FindBestFontFace( rFontSelData ); @@ -585,7 +598,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFon // are the missing characters symbols? pDevFont = pDevFontList->ImplFindByAttributes( IMPL_FONT_ATTR_SYMBOL, rFontSelData.meWeight, rFontSelData.meWidthType, - rFontSelData.meFamily, rFontSelData.meItalic, rFontSelData.maSearchName ); + rFontSelData.meItalic, rFontSelData.maSearchName ); if( pDevFont ) { const ImplFontData* pFace = pDevFont->FindBestFontFace( rFontSelData ); |