summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-06-19 13:48:45 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-06-19 14:11:50 +0100
commitd9e4c74811855de15f1bf2045c2c9b061a2d4dc6 (patch)
tree895cbcd595094e9fd2621a943fc83bb004b429c9 /vcl/source
parent2a598619d7fbc992f1903a745fd536ddf5e45c81 (diff)
merge together hand-crafted traditional/simplified chinese tests
merge together a gadzillion hand-crafted isSimpleChinese/isTraditionalChinese/isKoreanVariants/isCJK implementations which should fix a goodly amount of them add a MsLangId::isFamilyNameFirst for locales where family name appears first while I'm at it. Change-Id: I65377793be037d16fe7250cd7450b28aec689e83
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/gdi/outdev3.cxx41
-rw-r--r--vcl/source/window/mnemonic.cxx19
-rw-r--r--vcl/source/window/window.cxx17
3 files changed, 20 insertions, 57 deletions
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index daddd9096e64..948fcc38ce84 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -2734,30 +2734,19 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( FontSelectPattern& rFSD,
}
// if still needed use the font request's attributes to find a good match
- switch( rFSD.meLanguage )
+ if (MsLangId::isSimplifiedChinese(rFSD.meLanguage))
+ nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_SC;
+ else if (MsLangId::isTraditionalChinese(rFSD.meLanguage))
+ nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_TC;
+ else if (MsLangId::isKorean(rFSD.meLanguage))
+ nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_KR;
+ else if (rFSD.meLanguage == LANGUAGE_JAPANESE)
+ nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_JP;
+ else
{
- case LANGUAGE_CHINESE:
- case LANGUAGE_CHINESE_SIMPLIFIED:
- case LANGUAGE_CHINESE_SINGAPORE:
- nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_SC;
- break;
- case LANGUAGE_CHINESE_TRADITIONAL:
- case LANGUAGE_CHINESE_HONGKONG:
- case LANGUAGE_CHINESE_MACAU:
- nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_TC;
- break;
- case LANGUAGE_KOREAN:
- case LANGUAGE_KOREAN_JOHAB:
- nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_KR;
- break;
- case LANGUAGE_JAPANESE:
- nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_JP;
- break;
- default:
- nSearchType |= ImplIsCJKFont( rFSD.maName );
- if( rFSD.IsSymbolFont() )
- nSearchType |= IMPL_FONT_ATTR_SYMBOL;
- break;
+ nSearchType |= ImplIsCJKFont( rFSD.maName );
+ if( rFSD.IsSymbolFont() )
+ nSearchType |= IMPL_FONT_ATTR_SYMBOL;
}
ImplCalcType( nSearchType, eSearchWeight, eSearchWidth, rFSD.meFamily, pFontAttr );
@@ -2936,15 +2925,13 @@ FontEmphasisMark OutputDevice::ImplGetEmphasisMarkStyle( const Font& rFont )
{
LanguageType eLang = rFont.GetLanguage();
// In Chinese Simplified the EmphasisMarks are below/left
- if ( (eLang == LANGUAGE_CHINESE_SIMPLIFIED) ||
- (eLang == LANGUAGE_CHINESE_SINGAPORE) )
+ if (MsLangId::isSimplifiedChinese(eLang))
nEmphasisMark |= EMPHASISMARK_POS_BELOW;
else
{
eLang = rFont.GetCJKContextLanguage();
// In Chinese Simplified the EmphasisMarks are below/left
- if ( (eLang == LANGUAGE_CHINESE_SIMPLIFIED) ||
- (eLang == LANGUAGE_CHINESE_SINGAPORE) )
+ if (MsLangId::isSimplifiedChinese(eLang))
nEmphasisMark |= EMPHASISMARK_POS_BELOW;
else
nEmphasisMark |= EMPHASISMARK_POS_ABOVE;
diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx
index daeae8ba3b04..4d9acb9972d0 100644
--- a/vcl/source/window/mnemonic.cxx
+++ b/vcl/source/window/mnemonic.cxx
@@ -34,6 +34,7 @@
#include <vcl/unohelp.hxx>
#include <com/sun/star/i18n/XCharacterClassification.hpp>
+#include <i18npool/mslangid.hxx>
using namespace ::com::sun::star;
@@ -148,22 +149,8 @@ sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey )
sal_Bool bChanged = sal_False;
xub_StrLen nLen = aKey.Len();
- sal_Bool bCJK = sal_False;
- switch( Application::GetSettings().GetUILanguage() )
- {
- case LANGUAGE_JAPANESE:
- case LANGUAGE_CHINESE_TRADITIONAL:
- case LANGUAGE_CHINESE_SIMPLIFIED:
- case LANGUAGE_CHINESE_HONGKONG:
- case LANGUAGE_CHINESE_SINGAPORE:
- case LANGUAGE_CHINESE_MACAU:
- case LANGUAGE_KOREAN:
- case LANGUAGE_KOREAN_JOHAB:
- bCJK = sal_True;
- break;
- default:
- break;
- }
+ bool bCJK = MsLangId::isCJK(Application::GetSettings().GetUILanguage());
+
// #107889# in CJK versions ALL strings (even those that contain latin characters)
// will get mnemonics in the form: xyz (M)
// thus steps 1) and 2) are skipped for CJK locales
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b0d10a16be54..8cb1a5213e12 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -26,6 +26,7 @@
*
************************************************************************/
+#include <i18npool/mslangid.hxx>
#include "tools/time.hxx"
#include "tools/debug.hxx"
@@ -405,21 +406,9 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl
// if the UI is korean, chinese or another locale
// where the system font size is kown to be often too small to
// generate readable fonts enforce a minimum font size of 9 points
- bool bBrokenLangFontHeight = false;
- static const LanguageType eBrokenSystemFontSizeLanguages[] =
- { LANGUAGE_KOREAN, LANGUAGE_KOREAN_JOHAB,
- LANGUAGE_CHINESE_HONGKONG, LANGUAGE_CHINESE_MACAU, LANGUAGE_CHINESE_SIMPLIFIED, LANGUAGE_CHINESE_SINGAPORE, LANGUAGE_CHINESE_TRADITIONAL
- };
- static std::set< LanguageType > aBrokenSystemFontSizeLanguagesSet(
- eBrokenSystemFontSizeLanguages,
- eBrokenSystemFontSizeLanguages + SAL_N_ELEMENTS(eBrokenSystemFontSizeLanguages)
- );
- LanguageType aLang = Application::GetSettings().GetUILanguage();
- if( aBrokenSystemFontSizeLanguagesSet.find( aLang ) != aBrokenSystemFontSizeLanguagesSet.end() )
- {
+ bool bBrokenLangFontHeight = MsLangId::isCJK(Application::GetSettings().GetUILanguage());
+ if (bBrokenLangFontHeight)
defFontheight = Max(9, defFontheight);
- bBrokenLangFontHeight = true;
- }
// i22098, toolfont will be scaled differently to avoid bloated rulers and status bars for big fonts
int toolfontheight = defFontheight;