Package: openoffice.org-bin Version: 1.1.0-2 I wrote this patch on a request of Chriss Halls, but got no reply on the private mail. So I am putting the information into BTS to avoid information loose.
> > Does that module honour $KDEHOME? > > I don't think so. But it does look in ~/.kderc. Do you have that? > > > I think it should. > > Sure, I'll wait for your patch... :) > > > > Yup, and that's what I meant it would be nice to receive a patch :) > > > Attached to this message, there is a drop-in replacement for > gui-fonts-kde.diff that has more debian-friendly KDE configuration files > paths, and honours $KDEHOME. > > I've tested it. It basically works (unlike one my previous mail).
diff -ur vcl.orig/unx/inc/kdeint.hxx vcl/unx/inc/kdeint.hxx --- vcl.orig/unx/inc/kdeint.hxx 2003-10-27 23:07:23.000000000 +0300 +++ vcl/unx/inc/kdeint.hxx 2003-10-27 23:08:17.000000000 +0300 @@ -74,6 +74,8 @@ private: KDEIntegrator( SalFrame* ); + Font parseKDEFont( const ByteString& rLine ); + public: virtual ~KDEIntegrator(); diff -ur vcl.orig/unx/source/gdi/kdeint.cxx vcl/unx/source/gdi/kdeint.cxx --- vcl.orig/unx/source/gdi/kdeint.cxx 2003-10-27 23:07:47.000000000 +0300 +++ vcl/unx/source/gdi/kdeint.cxx 2003-10-27 23:09:35.000000000 +0300 @@ -82,13 +82,54 @@ static char* pTryFiles[] = { - "/usr/share/config/kdeglobals", - "/opt/kde/share/config/kdeglobals", - "~/.kde2/share/config/kdeglobals", + "/etc/kde3/system.kdeglobals", + "/etc/kde2/system.kdeglobals", + "$KDEDIR/share/config/kdeglobals", + "~/.kderc", "~/.kde/share/config/kdeglobals", - "~/.kderc" + "$KDEHOME/share/config/kdeglobals" }; +Font KDEIntegrator::parseKDEFont( const ByteString& rLine ) +{ + rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); + + Font aFont; + xub_StrLen nIndex = 0; + + ByteString aToken = rLine.GetToken( 0, ',', nIndex ); + + if( aToken.Len() ) { + aFont.SetName( String( aToken, osl_getThreadTextEncoding() ) ); + } + + aToken = rLine.GetToken( 0, ',', nIndex ); + aFont.SetHeight( aToken.ToInt32() ); + + aToken = rLine.GetToken( 2, ',', nIndex ); + + if( aToken.Len() ) { + int nWeight = aToken.ToInt32(); + if( nWeight < 30) { + aFont.SetWeight( WEIGHT_LIGHT ); + } + else if( nWeight > 70) { + aFont.SetWeight( WEIGHT_BOLD ); + } + } + + aToken = rLine.GetToken( 0, ',', nIndex ); + if( aToken.Len() ) { + int nItalic = aToken.ToInt32(); + if( nItalic == 1) { + aFont.SetItalic( ITALIC_NORMAL ); + } + } + + return aFont; + +} + void KDEIntegrator::GetSystemLook( AllSettings& rSettings ) { rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); @@ -101,6 +142,16 @@ aFile = aHomeDir; aFile += String( pTryFiles[i]+1, aEncoding ); } + else if( pTryFiles[i][0] == '$' ) + { + char *p, *q, *r; + for ( p = q = &(pTryFiles[i][1]); *q >= 'A' && *q <= 'Z'; q++ ); + r = getenv( ByteString( p, q - p ).GetBuffer() ); + if( !r ) + continue; + aFile = String( r, aEncoding ); + aFile += String( q, aEncoding ); + } else aFile = String( ByteString( pTryFiles[i] ), aEncoding ); @@ -227,12 +278,10 @@ aLine = aConfig.ReadKey( "font" ); if( aLine.Len() ) { - Font aFont = aStyleSettings.GetAppFont(); - aFont.SetName( String( aLine, gsl_getSystemTextEncoding() ) ); - + Font aFont = parseKDEFont(aLine); + aStyleSettings.SetAppFont( aFont ); aStyleSettings.SetHelpFont( aFont ); - aStyleSettings.SetMenuFont( aFont ); aStyleSettings.SetToolFont( aFont ); aStyleSettings.SetLabelFont( aFont ); aStyleSettings.SetInfoFont( aFont ); @@ -242,6 +291,14 @@ aStyleSettings.SetIconFont( aFont ); aStyleSettings.SetGroupFont( aFont ); } + + aLine = aConfig.ReadKey( "menuFont" ); + if( aLine.Len() ) + { + Font aFont = parseKDEFont(aLine); + + aStyleSettings.SetMenuFont( aFont ); + } } rSettings.SetStyleSettings( aStyleSettings );