summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorHerbert Duerr [hdu] <duerr@sun.com>2010-07-02 14:37:01 +0200
committerHerbert Duerr [hdu] <duerr@sun.com>2010-07-02 14:37:01 +0200
commit900fe79dcc690e1e872ec5f7fc9d930cd6adc1c6 (patch)
treea689547944808a9ecb709a21b02073ef09e5ddc0 /unotools
parentf9dc559631798dca006c64f69b531cb2f8f34167 (diff)
#i112731# a searchname must fully contain the keyname to be considered a match
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/fontcfg.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index a1d287337bea..d1fb037347a2 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -1199,8 +1199,15 @@ const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontNam
// try to find an exact match
// because the list is sorted this will also find fontnames of the form searchfontname*
std::vector< FontNameAttr >::const_iterator it = ::std::lower_bound( lang->second.aSubstAttributes.begin(), lang->second.aSubstAttributes.end(), aSearchAttr, StrictStringSort() );
- if( it != lang->second.aSubstAttributes.end() && aSearchFont.CompareTo( it->Name, aSearchFont.Len() ) == COMPARE_EQUAL )
- return &(*it);
+ if( it != lang->second.aSubstAttributes.end())
+ {
+ const FontNameAttr& rFoundAttr = *it;
+ // a search for "abcblack" may match with an entry for "abc"
+ // the reverse is not a good idea (e.g. #i112731# alba->albani)
+ if( rFoundAttr.Name.Len() < aSearchFont.Len() )
+ if( aSearchFont.CompareTo( rFoundAttr.Name, aSearchFont.Len() ) == COMPARE_EQUAL )
+ return &rFoundAttr;
+ }
}
// gradually become more unspecific
if( aLocale.Variant.getLength() )