--- svx/source/items/textitem.cxx.orig 2007-05-10 22:53:50.000000000 +0800 +++ svx/source/items/textitem.cxx 2007-07-23 14:09:11.000000000 +0800 @@ -3717,7 +3717,7 @@ void SvxScriptSetItem::PutItemForScriptT { USHORT nLatin, nAsian, nComplex; GetWhichIds( nLatin, nAsian, nComplex ); - + SfxPoolItem* pCpy = rItem.Clone(); if( SCRIPTTYPE_LATIN & nScriptType ) { @@ -3726,8 +3726,19 @@ void SvxScriptSetItem::PutItemForScriptT } if( SCRIPTTYPE_ASIAN & nScriptType ) { - pCpy->SetWhich( nAsian ); - GetItemSet().Put( *pCpy ); + // #i73003#, if the font supports cjk lang, apply it. + sal_Bool bCJKFont = sal_True; + if ( rItem.ISA(SvxFontItem) ) + { + Font aFont; + aFont.SetName(((SvxFontItem&)rItem).GetFamilyName()); + bCJKFont = aFont.IsSupportCJK(); + } + if( bCJKFont ) + { + pCpy->SetWhich( nAsian ); + GetItemSet().Put( *pCpy ); + } } if( SCRIPTTYPE_COMPLEX & nScriptType ) { --- svtools/inc/ctrlbox.hxx.orig 2007-01-23 19:44:18.000000000 +0800 +++ svtools/inc/ctrlbox.hxx 2007-07-23 14:09:11.000000000 +0800 @@ -384,6 +384,7 @@ private: Image maImageScalableFont; BOOL mbWYSIWYG; BOOL mbSymbols; + BOOL mbOnlyListCJKFont; // #i73003# #ifdef _CTRLBOX_CXX SVT_DLLPRIVATE void ImplCalcUserItemSize(); --- svtools/source/control/ctrlbox.cxx.orig 2007-03-26 19:53:44.000000000 +0800 +++ svtools/source/control/ctrlbox.cxx 2007-07-23 16:32:08.000000000 +0800 @@ -61,6 +61,8 @@ #include +#define LB_EAST_NAME 112 + #define IMGTEXTSPACE 2 #define EXTRAFONTSIZE 5 @@ -622,6 +624,8 @@ FontNameBox::FontNameBox( Window* pParen mpFontList = NULL; mbWYSIWYG = FALSE; mbSymbols = FALSE; + // #i73003# + mbOnlyListCJKFont = FALSE; } // ------------------------------------------------------------------- @@ -633,6 +637,13 @@ FontNameBox::FontNameBox( Window* pParen mpFontList = NULL; mbWYSIWYG = FALSE; mbSymbols = FALSE; + // #i73003# + mbOnlyListCJKFont = FALSE; + if( rResId.GetId() == LB_EAST_NAME ) + { + mbOnlyListCJKFont = TRUE; + } + } // ------------------------------------------------------------------- @@ -696,6 +707,14 @@ void FontNameBox::Fill( const FontList* for ( USHORT i = 0; i < nFontCount; i++ ) { const FontInfo& rFontInfo = pList->GetFontName( i ); + + // #i73003# + if( mbOnlyListCJKFont && (!rFontInfo.IsSupportCJK()) ) + { + //Only list CJK font + continue; + } + ULONG nIndex = InsertEntry( rFontInfo.GetName() ); if ( nIndex != LISTBOX_ERROR ) { --- vcl/inc/vcl/font.hxx.orig 2007-04-12 01:54:10.000000000 +0800 +++ vcl/inc/vcl/font.hxx 2007-07-23 14:09:11.000000000 +0800 @@ -156,6 +156,9 @@ public: friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const Font& ); static Font identifyFont( const void* pBuffer, sal_uInt32 nLen ); + + // #i73003# + BOOL IsSupportCJK() const; }; #endif // _VCL_FONT_HXX --- vcl/source/gdi/font.cxx.orig 2007-03-26 19:20:37.000000000 +0800 +++ vcl/source/gdi/font.cxx 2007-07-23 14:09:11.000000000 +0800 @@ -61,7 +61,9 @@ #endif #include - +#ifndef _PSPRINT_FONTMANAGER_HXX_ +#include +#endif // ======================================================================= DBG_NAME( Font ) @@ -1069,6 +1071,17 @@ Font Font::identifyFont( const void* i_p return aResult; } +// #i73003# +BOOL Font::IsSupportCJK() const +{ + BOOL bRet = TRUE; + const String aFamilyName = GetName(); + #ifdef UNX + bRet = ::psp::PrintFontManager::get().IsSupportCJK(aFamilyName); + #endif + return bRet; +} + // the inlines from the font.hxx header are now instantiated for pImpl-ification // TODO: reformat const Color& Font::GetColor() const { return mpImplFont->maColor; } --- psprint/inc/psprint/fontmanager.hxx.orig 2007-07-23 16:55:33.000000000 +0800 +++ psprint/inc/psprint/fontmanager.hxx 2007-07-23 14:30:01.000000000 +0800 @@ -200,13 +200,15 @@ struct PrintFontInfo : public FastPrintF int m_nDescend; int m_nLeading; int m_nWidth; + bool m_bCJKSupport; // #i73003# PrintFontInfo() : FastPrintFontInfo(), m_nAscend( 0 ), m_nDescend( 0 ), m_nLeading( 0 ), - m_nWidth( 0 ) + m_nWidth( 0 ), + m_bCJKSupport( 0 ) // #i73003# {} }; @@ -306,6 +308,7 @@ class PrintFontManager int m_nYMax; bool m_bHaveVerticalSubstitutedGlyphs; bool m_bUserOverride; + bool m_bCJKSupport; // #i73003# fcstatus::type m_eEmbeddedbitmap; fcstatus::type m_eAntialias; @@ -737,6 +740,7 @@ public: false else */ bool matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale ); + bool IsSupportCJK( const rtl::OUString& rFontName ); // #i73003# }; } // namespace --- psprint/source/fontmanager/fontmanager.cxx.orig 2007-07-23 16:56:02.000000000 +0800 +++ psprint/source/fontmanager/fontmanager.cxx 2007-07-23 14:29:17.000000000 +0800 @@ -392,6 +392,7 @@ PrintFontManager::PrintFont::PrintFont( m_nYMax( 0 ), m_bHaveVerticalSubstitutedGlyphs( false ), m_bUserOverride( false ), + m_bCJKSupport( false ), m_eEmbeddedbitmap( fcstatus::isunset ), m_eAntialias( fcstatus::isunset ) { @@ -2026,6 +2027,9 @@ bool PrintFontManager::analyzeTrueTypeFi // get vertical substitutions flag pFont->m_bHaveVerticalSubstitutedGlyphs = DoesVerticalSubstitution( pTTFont, 1 ); + // i#73003#, check for CJK capatibilies for the current font + pFont->m_bCJKSupport = (aInfo.ur2 & 0x08000000) >> 27 ; + CloseTTFont( pTTFont ); bSuccess = true; } @@ -2788,6 +2792,7 @@ void PrintFontManager::fillPrintFontInfo rInfo.m_nDescend = pFont->m_nDescend; rInfo.m_nLeading = pFont->m_nLeading; rInfo.m_nWidth = pFont->m_aGlobalMetricX.width < pFont->m_aGlobalMetricY.width ? pFont->m_aGlobalMetricY.width : pFont->m_aGlobalMetricX.width; + rInfo.m_bCJKSupport = pFont->m_bCJKSupport; // #i73003# } // ------------------------------------------------------------------------- @@ -4140,3 +4145,22 @@ bool PrintFontManager::readOverrideMetri return true; } + +bool PrintFontManager::IsSupportCJK( const rtl::OUString& rFamilyName ) +{ + bool bRet = true; + + for( ::std::hash_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it ) + { + fontID nFont = it->first; + if( rFamilyName == getFontFamily(nFont) ) + { + PrintFont* pFont = it->second; + // might be a truetype font not yet analyzed + if( pFont->m_eType == fonttype::TrueType ) + analyzeTrueTypeFile( pFont ); + return pFont->m_bCJKSupport; + } + } + return bRet; +}