diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-10-20 11:17:56 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-10-20 11:53:18 +0100 |
commit | e12ba2eddc827e39444f5efe6107d8afe1f7aaff (patch) | |
tree | 4510c21ddbe5da9d948e9ef3253e5321a3234d9f /vcl/source | |
parent | eb7aa9f1fa58ff43d4a974aec868f627755ce152 (diff) |
Resolves: fdo#85006 limit script stripping to known suffixes
Change-Id: I276535b007bbb55555148d5937076b86da5de825
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/font/PhysicalFontCollection.cxx | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx index af2440ca7866..416cc6b8945a 100644 --- a/vcl/source/font/PhysicalFontCollection.cxx +++ b/vcl/source/font/PhysicalFontCollection.cxx @@ -36,40 +36,6 @@ #include "PhysicalFontCollection.hxx" -static OUString lcl_stripCharSetFromName(const OUString& _aName) -{ - // I worry that someone will have a font which *does* have - // e.g. "Greek" legitimately at the end of its name :-( - const char*suffixes[] = { " baltic", - " ce", - " cyr", - " greek", - " tur", - " (arabic)", - " (hebrew)", - " (thai)", - " (vietnamese)" - }; - - OUString aName = _aName; - // These can be crazily piled up, e.g. Times New Roman CYR Greek - bool bFinished = false; - while (!bFinished) - { - bFinished = true; - for (size_t i = 0; i < SAL_N_ELEMENTS(suffixes); ++i) - { - size_t nLen = strlen(suffixes[i]); - if (aName.endsWithIgnoreAsciiCaseAsciiL(suffixes[i], nLen)) - { - bFinished = false; - aName = aName.copy(0, aName.getLength() - nLen); - } - } - } - return aName; -} - static unsigned lcl_IsCJKFont( const OUString& rFontName ) { // Test, if Fontname includes CJK characters --> In this case we @@ -1113,7 +1079,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r // Win 3.1/Win95 style fontnames which attempt to put the // charset encoding into the filename // http://www.webcenter.ru/~kazarn/eng/fonts_ttf.htm - OUString sStrippedName = lcl_stripCharSetFromName(rFSD.maTargetName); + OUString sStrippedName = StripScriptFromName(rFSD.maTargetName); if (sStrippedName != rFSD.maTargetName) { rFSD.maTargetName = sStrippedName; |