diff options
Diffstat (limited to 'psprint')
-rw-r--r-- | psprint/source/fontmanager/fontconfig.cxx | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/psprint/source/fontmanager/fontconfig.cxx b/psprint/source/fontmanager/fontconfig.cxx index 0aacf662fccd..9948d3883cda 100644 --- a/psprint/source/fontmanager/fontconfig.cxx +++ b/psprint/source/fontmanager/fontconfig.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fontconfig.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: rt $ $Date: 2004-07-23 10:08:07 $ + * last change: $Author: hr $ $Date: 2004-10-13 08:22:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -94,6 +94,9 @@ typedef char FcChar8; #ifndef _OSL_THREAD_H #include <osl/thread.h> #endif +#ifndef _RTL_USTRBUF_HXX +#include <rtl/ustrbuf.hxx> +#endif using namespace psp; using namespace osl; @@ -546,7 +549,7 @@ void PrintFontManager::deinitFontconfig() FontCfgWrapper::release(); } -bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo ) +bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale ) { #ifdef ENABLE_FONTCONFIG FontCfgWrapper& rWrapper = FontCfgWrapper::get(); @@ -556,7 +559,22 @@ bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo ) FcConfig* pConfig = rWrapper.getDefConfig(); FcPattern* pPattern = rWrapper.FcPatternCreate(); + OString aLangAttrib; // populate pattern with font characteristics + if( rLocale.Language.getLength() ) + { + OUStringBuffer aLang(6); + aLang.append( rLocale.Language ); + if( rLocale.Country.getLength() ) + { + aLang.append( sal_Unicode('-') ); + aLang.append( rLocale.Country ); + } + aLangAttrib = OUStringToOString( aLang.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); + } + if( aLangAttrib.getLength() ) + rWrapper.FcPatternAddString( pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr() ); + OString aFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 ); if( aFamily.getLength() ) rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)aFamily.getStr() ); |