summaryrefslogtreecommitdiff
path: root/vcl/unx/generic
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r--vcl/unx/generic/app/i18n_xkb.cxx34
-rw-r--r--vcl/unx/generic/app/keysymnames.cxx6
-rw-r--r--vcl/unx/generic/app/saldisp.cxx40
-rw-r--r--vcl/unx/generic/app/wmadaptor.cxx30
-rw-r--r--vcl/unx/generic/fontmanager/fontcache.cxx121
-rw-r--r--vcl/unx/generic/fontmanager/fontconfig.cxx722
-rw-r--r--vcl/unx/generic/fontmanager/fontmanager.cxx81
-rw-r--r--vcl/unx/generic/gdi/salbmp.cxx320
-rw-r--r--vcl/unx/generic/gdi/salgdi3.cxx325
-rw-r--r--vcl/unx/generic/gdi/salprnpsp.cxx20
-rw-r--r--vcl/unx/generic/plugadapt/salplug.cxx2
-rw-r--r--vcl/unx/generic/printer/cupsmgr.cxx2
-rw-r--r--vcl/unx/generic/printer/jobdata.cxx69
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx45
-rw-r--r--vcl/unx/generic/printer/printerinfomanager.cxx41
-rw-r--r--vcl/unx/generic/printergfx/common_gfx.cxx2
-rw-r--r--vcl/unx/generic/printergfx/printerjob.cxx11
-rw-r--r--vcl/unx/generic/window/salframe.cxx2
18 files changed, 716 insertions, 1157 deletions
diff --git a/vcl/unx/generic/app/i18n_xkb.cxx b/vcl/unx/generic/app/i18n_xkb.cxx
index cb93f48b6bd7..c9e42dda6751 100644
--- a/vcl/unx/generic/app/i18n_xkb.cxx
+++ b/vcl/unx/generic/app/i18n_xkb.cxx
@@ -36,16 +36,10 @@
#include "unx/saldata.hxx"
#include "unx/i18n_xkb.hxx"
-SalI18N_KeyboardExtension::SalI18N_KeyboardExtension( Display*
-#if __XKeyboardExtension__
-pDisplay
-#endif
-)
- : mbUseExtension( (sal_Bool)__XKeyboardExtension__ ),
+SalI18N_KeyboardExtension::SalI18N_KeyboardExtension( Display* pDisplay )
+ : mbUseExtension( sal_True ),
mnDefaultGroup( 0 )
{
- #if __XKeyboardExtension__
-
mpDisplay = pDisplay;
// allow user to set the default keyboard group idx or to disable the usage
@@ -94,19 +88,11 @@ pDisplay
XkbGetState( mpDisplay, XkbUseCoreKbd, &aStateRecord );
mnGroup = aStateRecord.group;
}
-
- #endif // __XKeyboardExtension__
}
void
-SalI18N_KeyboardExtension::Dispatch( XEvent*
-#if __XKeyboardExtension__
-pEvent
-#endif
-)
+SalI18N_KeyboardExtension::Dispatch( XEvent* pEvent )
{
- #if __XKeyboardExtension__
-
// must the event be handled?
if ( !mbUseExtension
|| (pEvent->type != mnEventBase) )
@@ -130,21 +116,13 @@ pEvent
#endif
break;
}
- #endif // __XKeyboardExtension__
}
-#if __XKeyboardExtension__
sal_uInt32
SalI18N_KeyboardExtension::LookupKeysymInGroup( sal_uInt32 nKeyCode,
sal_uInt32 nShiftState,
sal_uInt32 nGroup ) const
-#else
-sal_uInt32
-SalI18N_KeyboardExtension::LookupKeysymInGroup( sal_uInt32,sal_uInt32,sal_uInt32 ) const
-#endif
{
- #if __XKeyboardExtension__
-
if ( !mbUseExtension )
return NoSymbol;
@@ -153,12 +131,6 @@ SalI18N_KeyboardExtension::LookupKeysymInGroup( sal_uInt32,sal_uInt32,sal_uInt32
KeySym nKeySymbol;
nKeySymbol = XkbKeycodeToKeysym( mpDisplay, nKeyCode, nGroup, nShiftState );
return nKeySymbol;
-
- #else
-
- return NoSymbol;
-
- #endif // __XKeyboardExtension__
}
diff --git a/vcl/unx/generic/app/keysymnames.cxx b/vcl/unx/generic/app/keysymnames.cxx
index e164d06d5d07..c2db38c2a13a 100644
--- a/vcl/unx/generic/app/keysymnames.cxx
+++ b/vcl/unx/generic/app/keysymnames.cxx
@@ -583,7 +583,7 @@ static const keyboard_layout type6_layout[] =
const char* SalDisplay::GetKeyboardName( bool bRefresh )
{
- if( bRefresh || ! m_aKeyboardName.Len() )
+ if (bRefresh || m_aKeyboardName.isEmpty())
{
#if defined(SOLARIS)
if( IsLocal() )
@@ -665,10 +665,10 @@ const char* SalDisplay::GetKeyboardName( bool bRefresh )
}
}
#endif
- if( ! m_aKeyboardName.Len() )
+ if (m_aKeyboardName.isEmpty())
m_aKeyboardName = "<unknown keyboard>";
}
- return m_aKeyboardName.GetBuffer();
+ return m_aKeyboardName.getStr();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 358bbc205004..8156b86cab08 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -885,10 +885,7 @@ void SalDisplay::Init()
sscanf( pProperties, "%li", &nProperties_ );
else
{
-#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD || \
- defined NETBSD || defined OPENBSD || defined DRAGONFLY
nProperties_ |= PROPERTY_FEATURE_Maximize;
-#endif
// Server Bugs & Properties
if( GetServerVendor() == vendor_excursion )
{
@@ -909,31 +906,6 @@ void SalDisplay::Init()
if( otherwm == eWindowManager_ ) eWindowManager_ = mwm;
}
else
- if( GetServerVendor() == vendor_xfree )
- {
- nProperties_ |= PROPERTY_BUG_XCopyArea_GXxor;
-#if defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD || \
- defined DRAGONFLY
- // otherwm and olwm are a kind of default, which are not detected
- // carefully. if we are running linux (i.e. not netbsd) on an xfree
- // display, fvwm is most probable the wm to choose, confusing with mwm
- // doesn't harm. #57791# start maximized if possible
- if( (otherwm == eWindowManager_)
- || (olwm == eWindowManager_ ))
- {
- eWindowManager_ = fvwm; // ???
- nProperties_ |= PROPERTY_FEATURE_Maximize;
- }
-#else
- if( otherwm == eWindowManager_ ) eWindowManager_ = winmgr;
-#endif
-#if defined SOLARIS && defined SPARC
- nProperties_ |= PROPERTY_BUG_Bitmap_Bit_Order;
- // solaris xlib seems to have problems with putting images
- // in correct bit order to xfree 8 bit displays
-#endif
- }
- else
if( GetServerVendor() == vendor_sun )
{
// nicht alle! (bekannt: nur Sparc II CG3, CG6?)
@@ -2358,7 +2330,7 @@ void SalX11Display::Yield()
if( pXLib_->HasXErrorOccurred() )
{
XFlush( pDisp_ );
- PrintEvent( "SalDisplay::Yield (WasXError)", &aEvent );
+ DbgPrintDisplayEvent("SalDisplay::Yield (WasXError)", &aEvent);
}
#endif
pXLib_->ResetXErrorOccurred();
@@ -2475,14 +2447,13 @@ long SalX11Display::Dispatch( XEvent *pEvent )
return 0;
}
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void SalDisplay::PrintEvent( const ByteString &rComment,
- XEvent *pEvent ) const
+#ifdef DBG_UTIL
+void SalDisplay::DbgPrintDisplayEvent(const char *pComment, XEvent *pEvent) const
{
if( pEvent->type <= MappingNotify )
{
fprintf( stderr, "[%s] %s s=%d w=%ld\n",
- rComment.GetBuffer(),
+ pComment,
EventNames[pEvent->type],
pEvent->xany.send_event,
pEvent->xany.window );
@@ -2609,11 +2580,12 @@ void SalDisplay::PrintEvent( const ByteString &rComment,
}
else
fprintf( stderr, "[%s] %d s=%d w=%ld\n",
- rComment.GetBuffer(),
+ pComment,
pEvent->type,
pEvent->xany.send_event,
pEvent->xany.window );
}
+#endif
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void SalDisplay::PrintInfo() const
diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx
index ad9b5ee22d6c..7ad584953069 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -228,8 +228,9 @@ WMAdaptor* WMAdaptor::createWMAdaptor( SalDisplay* pSalDisplay )
pAdaptor = new WMAdaptor( pSalDisplay );
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "Window Manager's name is \"%s\"\n",
- ByteString( pAdaptor->getWindowManagerName(), RTL_TEXTENCODING_ISO_8859_1 ).GetBuffer() );
+ fprintf(stderr, "Window Manager's name is \"%s\"\n",
+ rtl::OUStringToOString(pAdaptor->getWindowManagerName(),
+ RTL_TEXTENCODING_UTF8).getStr());
#endif
return pAdaptor;
}
@@ -1075,10 +1076,11 @@ void GnomeWMAdaptor::initAtoms()
void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
{
- ByteString aTitle( rWMName, osl_getThreadTextEncoding() );
+ rtl::OString aTitle(rtl::OUStringToOString(rWMName,
+ osl_getThreadTextEncoding()));
if( ! rWMName.Len() && m_aWMName.EqualsAscii( "Dtwm" ) )
- aTitle = " ";
+ aTitle = rtl::OString(' ');
::rtl::OString aWMLocale;
rtl_Locale* pLocale = NULL;
@@ -1140,7 +1142,7 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
}
#endif
- char* pT = const_cast<char*>(aTitle.GetBuffer());
+ char* pT = const_cast<char*>(aTitle.getStr());
XTextProperty aProp = { NULL, None, 0, 0 };
if( bTrustXmb )
{
@@ -1151,10 +1153,10 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
&aProp );
}
- unsigned char* pData = aProp.nitems ? aProp.value : (unsigned char*)aTitle.GetBuffer();
- Atom nType = aProp.nitems ? aProp.encoding : XA_STRING;
- int nFormat = aProp.nitems ? aProp.format : 8;
- int nBytes = aProp.nitems ? aProp.nitems : aTitle.Len();
+ unsigned char* pData = aProp.nitems ? aProp.value : (unsigned char*)aTitle.getStr();
+ Atom nType = aProp.nitems ? aProp.encoding : XA_STRING;
+ int nFormat = aProp.nitems ? aProp.format : 8;
+ int nBytes = aProp.nitems ? aProp.nitems : aTitle.getLength();
const SystemEnvData* pEnv = pFrame->GetSystemData();
XChangeProperty( m_pDisplay,
(XLIB_Window)pEnv->aShellWindow,
@@ -1195,7 +1197,7 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
{
WMAdaptor::setWMName( pFrame, rWMName );
- ByteString aTitle( rWMName, RTL_TEXTENCODING_UTF8 );
+ rtl::OString aTitle(rtl::OUStringToOString(rWMName, RTL_TEXTENCODING_UTF8));
const SystemEnvData* pEnv = pFrame->GetSystemData();
if( m_aWMAtoms[ NET_WM_NAME ] )
XChangeProperty( m_pDisplay,
@@ -1204,8 +1206,8 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
m_aWMAtoms[ UTF8_STRING ],
8,
PropModeReplace,
- (unsigned char*)aTitle.GetBuffer(),
- aTitle.Len()+1 );
+ (unsigned char*)aTitle.getStr(),
+ aTitle.getLength()+1 );
if( m_aWMAtoms[ NET_WM_ICON_NAME ] )
XChangeProperty( m_pDisplay,
(XLIB_Window)pEnv->aShellWindow,
@@ -1213,8 +1215,8 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
m_aWMAtoms[ UTF8_STRING ],
8,
PropModeReplace,
- (unsigned char*)aTitle.GetBuffer(),
- aTitle.Len()+1 );
+ (unsigned char*)aTitle.getStr(),
+ aTitle.getLength()+1 );
// The +1 copies the terminating null byte. Although
// the spec says, this should not be necessary
// at least the kwin implementation seems to depend
diff --git a/vcl/unx/generic/fontmanager/fontcache.cxx b/vcl/unx/generic/fontmanager/fontcache.cxx
index e7a4008f07f0..e47c95ec07ca 100644
--- a/vcl/unx/generic/fontmanager/fontcache.cxx
+++ b/vcl/unx/generic/fontmanager/fontcache.cxx
@@ -40,6 +40,8 @@
#include "tools/stream.hxx"
+#include <rtl/strbuf.hxx>
+
#include <unistd.h>
#include <sys/stat.h>
@@ -132,13 +134,14 @@ void FontCache::flush()
const FontDirMap& rDir( dir_it->second.m_aEntries );
ByteString aDirectory( rManager.getDirectory( dir_it->first ) );
- ByteString aLine( "FontCacheDirectory:" );
- aLine.Append( ByteString::CreateFromInt64( dir_it->second.m_nTimestamp ) );
- aLine.Append( ':' );
- aLine.Append( aDirectory );
+ rtl::OStringBuffer aLine(
+ RTL_CONSTASCII_STRINGPARAM("FontCacheDirectory:"));
+ aLine.append(dir_it->second.m_nTimestamp);
+ aLine.append(':');
+ aLine.append(aDirectory);
if( rDir.empty() && dir_it->second.m_bNoFiles )
- aLine.Insert( "Empty", 0 );
- aStream.WriteLine( aLine );
+ aLine.insert(0, RTL_CONSTASCII_STRINGPARAM("Empty"));
+ aStream.WriteLine(ByteString(aLine.makeStringAndClear()));
for( FontDirMap::const_iterator entry_it = rDir.begin(); entry_it != rDir.end(); ++entry_it )
{
@@ -147,16 +150,16 @@ void FontCache::flush()
if( rEntry.begin() == rEntry.end() )
continue;
- aLine = "File:";
- aLine.Append( ByteString( entry_it->first ) );
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("File:"));
+ aLine.append(entry_it->first);
+ aStream.WriteLine(ByteString(aLine.makeStringAndClear()));
int nEntrySize = entry_it->second.m_aEntry.size();
// write: type;nfonts
- aLine = ByteString::CreateFromInt32( rEntry.front()->m_eType );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( nEntrySize ) );
- aStream.WriteLine( aLine );
+ aLine.append(static_cast<sal_Int32>(rEntry.front()->m_eType));
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>(nEntrySize));
+ aStream.WriteLine(ByteString(aLine.makeStringAndClear()));
sal_Int32 nSubEntry = 0;
for( FontCacheEntry::const_iterator it = rEntry.begin(); it != rEntry.end(); ++it, nSubEntry++ )
@@ -171,73 +174,73 @@ void FontCache::flush()
else
nSubEntry = -1;
- aLine = OUStringToOString( pAtoms->getString( ATOM_FAMILYNAME, (*it)->m_nFamilyName ), RTL_TEXTENCODING_UTF8 );
+ aLine.append(OUStringToOString(pAtoms->getString( ATOM_FAMILYNAME, (*it)->m_nFamilyName), RTL_TEXTENCODING_UTF8));
for( ::std::list< int >::const_iterator name_it = (*it)->m_aAliases.begin(); name_it != (*it)->m_aAliases.end(); ++name_it )
{
const OUString& rAdd( pAtoms->getString( ATOM_FAMILYNAME, *name_it ) );
if( rAdd.getLength() )
{
- aLine.Append( ';' );
- aLine.Append( ByteString( String( rAdd ), RTL_TEXTENCODING_UTF8 ) );
+ aLine.append(';');
+ aLine.append(OUStringToOString(rAdd, RTL_TEXTENCODING_UTF8));
}
}
- aStream.WriteLine( aLine );
+ aStream.WriteLine(ByteString(aLine.makeStringAndClear()));
const OUString& rPSName( pAtoms->getString( ATOM_PSNAME, (*it)->m_nPSName ) );
- aLine = ByteString::CreateFromInt32( nSubEntry );
- aLine.Append( ';' );
- aLine.Append( ByteString( String( rPSName ), RTL_TEXTENCODING_UTF8 ) );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( (*it)->m_eItalic ) );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( (*it)->m_eWeight ) );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( (*it)->m_eWidth ) );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( (*it)->m_ePitch ) );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( (*it)->m_aEncoding ) );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( (*it)->m_nAscend ) );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( (*it)->m_nDescend ) );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( (*it)->m_nLeading ) );
- aLine.Append( ';' );
- aLine.Append( (*it)->m_bHaveVerticalSubstitutedGlyphs ? "1" : "0" );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricX.width ) );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricX.height ) );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricY.width ) );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricY.height ) );
- aLine.Append( ';' );
- aLine.Append( (*it)->m_bUserOverride ? "1" : "0" );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( 0 ) );
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( 0 ) );
+ aLine.append(nSubEntry);
+ aLine.append(';');
+ aLine.append(OUStringToOString(rPSName, RTL_TEXTENCODING_UTF8));
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>((*it)->m_eItalic));
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>((*it)->m_eWeight));
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>((*it)->m_eWidth));
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>((*it)->m_ePitch));
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>((*it)->m_aEncoding));
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>((*it)->m_nAscend));
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>((*it)->m_nDescend));
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>((*it)->m_nLeading));
+ aLine.append(';');
+ aLine.append((*it)->m_bHaveVerticalSubstitutedGlyphs ? '1' : '0');
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricX.width ));
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricX.height));
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricY.width ));
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricY.height));
+ aLine.append(';');
+ aLine.append((*it)->m_bUserOverride ? '1' : '0');
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>(0));
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>(0));
switch( (*it)->m_eType )
{
case fonttype::Type1:
- aLine.Append( ';' );
- aLine.Append( ByteString( static_cast<const PrintFontManager::Type1FontFile*>(*it)->m_aMetricFile ) );
+ aLine.append(';');
+ aLine.append(static_cast<const PrintFontManager::Type1FontFile*>(*it)->m_aMetricFile);
break;
case fonttype::TrueType:
- aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( static_cast<const PrintFontManager::TrueTypeFontFile*>(*it)->m_nTypeFlags ) );
+ aLine.append(';');
+ aLine.append(static_cast<sal_Int32>(static_cast<const PrintFontManager::TrueTypeFontFile*>(*it)->m_nTypeFlags));
break;
default: break;
}
if( (*it)->m_aStyleName.getLength() )
{
- aLine.Append( ';' );
- aLine.Append( ByteString( String( (*it)->m_aStyleName ), RTL_TEXTENCODING_UTF8 ) );
+ aLine.append(';');
+ aLine.append(OUStringToOString((*it)->m_aStyleName, RTL_TEXTENCODING_UTF8));
}
- aStream.WriteLine( aLine );
+ aStream.WriteLine(ByteString(aLine.makeStringAndClear()));
}
aStream.WriteLine( ByteString() );
}
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index c1d506d91d83..38a5e93e56f3 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -36,53 +36,40 @@
using namespace psp;
-#ifdef ENABLE_FONTCONFIG
- #include <fontconfig/fontconfig.h>
- #include <ft2build.h>
- #include <fontconfig/fcfreetype.h>
- // allow compile on baseline (currently with fontconfig 2.2.0)
- #ifndef FC_WEIGHT_BOOK // TODO: remove when baseline moves to fc>=2.2.1
- #define FC_WEIGHT_BOOK 75
- #endif
- #ifndef FC_EMBEDDED_BITMAP // TODO: remove when baseline moves to fc>=2.3.92
- #define FC_EMBEDDED_BITMAP "embeddedbitmap"
- #endif
- #ifndef FC_FAMILYLANG // TODO: remove when baseline moves to fc>=2.2.97
- #define FC_FAMILYLANG "familylang"
- #endif
- #ifndef FC_CAPABILITY // TODO: remove when baseline moves to fc>=2.2.97
- #define FC_CAPABILITY "capability"
- #endif
- #ifndef FC_STYLELANG // TODO: remove when baseline moves to fc>=2.2.97
- #define FC_STYLELANG "stylelang"
- #endif
- #ifndef FC_HINT_STYLE // TODO: remove when baseline moves to fc>=2.2.91
- #define FC_HINT_STYLE "hintstyle"
- #define FC_HINT_NONE 0
- #define FC_HINT_SLIGHT 1
- #define FC_HINT_MEDIUM 2
- #define FC_HINT_FULL 3
- #endif
- #ifndef FC_FT_FACE
- #define FC_FT_FACE "ftface"
- #endif
- #ifndef FC_EMBOLDEN
- #define FC_EMBOLDEN "embolden"
- #endif
-#else
- typedef void FcConfig;
- typedef void FcObjectSet;
- typedef void FcPattern;
- typedef void FcFontSet;
- typedef void FcCharSet;
- typedef int FcResult;
- typedef int FcBool;
- typedef int FcMatchKind;
- typedef char FcChar8;
- typedef int FcChar32;
- typedef unsigned int FT_UInt;
- typedef void* FT_Face;
- typedef int FcSetName;
+#include <fontconfig/fontconfig.h>
+#include <ft2build.h>
+#include <fontconfig/fcfreetype.h>
+// allow compile on baseline (currently with fontconfig 2.2.0)
+#ifndef FC_WEIGHT_BOOK // TODO: remove when baseline moves to fc>=2.2.1
+ #define FC_WEIGHT_BOOK 75
+#endif
+#ifndef FC_EMBEDDED_BITMAP // TODO: remove when baseline moves to fc>=2.3.92
+ #define FC_EMBEDDED_BITMAP "embeddedbitmap"
+#endif
+#ifndef FC_FAMILYLANG // TODO: remove when baseline moves to fc>=2.2.97
+ #define FC_FAMILYLANG "familylang"
+#endif
+#ifndef FC_CAPABILITY // TODO: remove when baseline moves to fc>=2.2.97
+ #define FC_CAPABILITY "capability"
+#endif
+#ifndef FC_STYLELANG // TODO: remove when baseline moves to fc>=2.2.97
+ #define FC_STYLELANG "stylelang"
+#endif
+#ifndef FC_HINT_STYLE // TODO: remove when baseline moves to fc>=2.2.91
+ #define FC_HINT_STYLE "hintstyle"
+ #define FC_HINT_NONE 0
+ #define FC_HINT_SLIGHT 1
+ #define FC_HINT_MEDIUM 2
+ #define FC_HINT_FULL 3
+#endif
+#ifndef FC_FT_FACE
+ #define FC_FT_FACE "ftface"
+#endif
+#ifndef FC_EMBOLDEN
+ #define FC_EMBOLDEN "embolden"
+#endif
+#ifndef FC_FONTFORMAT
+ #define FC_FONTFORMAT "fontformat"
#endif
#include <cstdio>
@@ -114,53 +101,8 @@ namespace
class FontCfgWrapper
{
- oslModule m_pLib;
FcFontSet* m_pOutlineSet;
- int m_nFcVersion;
- FcBool (*m_pFcInit)();
- void (*m_pFcFini)();
- int (*m_pFcGetVersion)();
- FcConfig* (*m_pFcConfigGetCurrent)();
- FcObjectSet* (*m_pFcObjectSetVaBuild)(const char*,va_list);
- void (*m_pFcObjectSetDestroy)(FcObjectSet* pSet);
- FcPattern* (*m_pFcPatternCreate)();
- void (*m_pFcPatternDestroy)(FcPattern*);
- FcBool (*m_pFcPatternEqual)(const FcPattern*,const FcPattern*);
- FcFontSet* (*m_pFcConfigGetFonts)(FcConfig*,FcSetName);
- FcFontSet* (*m_pFcFontSetCreate)();
- FcCharSet* (*m_pFcCharSetCreate)();
- FcBool (*m_pFcCharSetAddChar)(FcCharSet *, FcChar32);
- FcBool (*m_pFcCharSetHasChar)(FcCharSet *, FcChar32);
- void (*m_pFcCharSetDestroy)(FcCharSet*);
- void (*m_pFcFontSetDestroy)(FcFontSet*);
- FcBool (*m_pFcFontSetAdd)(FcFontSet*,FcPattern*);
- void (*m_pFcPatternReference)(FcPattern*);
- FcResult (*m_pFcPatternGetCharSet)(const FcPattern*,const char*,int,FcCharSet**);
- FcResult (*m_pFcPatternGetString)(const FcPattern*,const char*,int,FcChar8**);
- FcResult (*m_pFcPatternGetInteger)(const FcPattern*,const char*,int,int*);
- FcResult (*m_pFcPatternGetDouble)(const FcPattern*,const char*,int,double*);
- FcResult (*m_pFcPatternGetBool)(const FcPattern*,const char*,int,FcBool*);
- void (*m_pFcDefaultSubstitute)(FcPattern *);
- FcPattern* (*m_pFcFontSetMatch)(FcConfig*,FcFontSet**, int, FcPattern*,FcResult*);
- FcPattern* (*m_pFcFontMatch)(FcConfig*,FcPattern*,FcResult*);
- FcBool (*m_pFcConfigAppFontAddFile)(FcConfig*, const FcChar8*);
- FcBool (*m_pFcConfigAppFontAddDir)(FcConfig*, const FcChar8*);
- FcBool (*m_pFcConfigParseAndLoad)(FcConfig*,const FcChar8*,FcBool);
- FcBool (*m_pFcConfigSubstitute)(FcConfig*,FcPattern*,FcMatchKind);
-
- FcPattern* (*m_pFcPatternDuplicate)(const FcPattern*);
- FcBool (*m_pFcPatternAddInteger)(FcPattern*,const char*,int);
- FcBool (*m_pFcPatternAddDouble)(FcPattern*,const char*,double);
- FcBool (*m_pFcPatternAddBool)(FcPattern*,const char*,FcBool);
- FcBool (*m_pFcPatternAddCharSet)(FcPattern*,const char*,const FcCharSet*);
- FcBool (*m_pFcPatternAddString)(FcPattern*,const char*,const FcChar8*);
- FcBool (*m_pFcPatternDel)(FcPattern*,const char*);
-
- FT_UInt (*m_pFcFreeTypeCharIndex)(FT_Face,FcChar32);
- FcBool (*m_pFcPatternAddFTFace)(FcPattern*,const char*,const FT_Face);
-
- oslGenericFunction loadSymbol( const char* );
void addFontSet( FcSetName );
FontCfgWrapper();
@@ -170,127 +112,8 @@ public:
static FontCfgWrapper& get();
static void release();
- bool isValid() const
- { return m_pLib != NULL;}
-
FcFontSet* getFontSet();
- FcBool FcInit()
- { return m_pFcInit(); }
-
- void FcFini()
- {
- //To-Do: get gtk vclplug smoketest to pass
- //if (m_pFcFini) m_pFcFini();
- }
-
- int FcGetVersion()
- { return m_pFcGetVersion(); }
-
- FcConfig* FcConfigGetCurrent()
- { return m_pFcConfigGetCurrent(); }
-
- FcObjectSet* FcObjectSetBuild( const char* first, ... )
- {
- va_list ap;
- va_start( ap, first );
- FcObjectSet* pSet = m_pFcObjectSetVaBuild( first, ap );
- va_end( ap );
- return pSet;
- }
-
- void FcObjectSetDestroy( FcObjectSet* pSet )
- { m_pFcObjectSetDestroy( pSet ); }
-
- FcPattern* FcPatternCreate()
- { return m_pFcPatternCreate(); }
-
- void FcPatternDestroy( FcPattern* pPattern )
- { if (m_pFcPatternDestroy) m_pFcPatternDestroy( pPattern ); }
-
- FcBool FcPatternEqual( const FcPattern* pPatternA, const FcPattern *pPatternB )
- { return m_pFcPatternEqual( pPatternA, pPatternB ); }
-
- FcFontSet* FcConfigGetFonts( FcConfig* pConfig, FcSetName eSet)
- { return m_pFcConfigGetFonts( pConfig, eSet ); }
-
- FcFontSet* FcFontSetCreate()
- { return m_pFcFontSetCreate(); }
-
- FcCharSet* FcCharSetCreate()
- { return m_pFcCharSetCreate(); }
-
- FcBool FcCharSetAddChar(FcCharSet *fcs, FcChar32 ucs4)
- { return m_pFcCharSetAddChar(fcs, ucs4); }
-
- FcBool FcCharSetHasChar(FcCharSet *fcs, FcChar32 ucs4)
- { return m_pFcCharSetHasChar(fcs, ucs4); }
-
- void FcCharSetDestroy( FcCharSet* pSet )
- { m_pFcCharSetDestroy( pSet );}
-
- void FcFontSetDestroy( FcFontSet* pSet )
- { m_pFcFontSetDestroy( pSet );}
-
- FcBool FcFontSetAdd( FcFontSet* pSet, FcPattern* pPattern )
- { return m_pFcFontSetAdd( pSet, pPattern ); }
-
- void FcPatternReference( FcPattern* pPattern )
- { m_pFcPatternReference( pPattern ); }
-
- FcResult FcPatternGetCharSet( const FcPattern* pPattern, const char* object, int n, FcCharSet** s )
- { return m_pFcPatternGetCharSet( pPattern, object, n, s ); }
-
- FcResult FcPatternGetString( const FcPattern* pPattern, const char* object, int n, FcChar8** s )
- { return m_pFcPatternGetString( pPattern, object, n, s ); }
-
- FcResult FcPatternGetInteger( const FcPattern* pPattern, const char* object, int n, int* s )
- { return m_pFcPatternGetInteger( pPattern, object, n, s ); }
-
- FcResult FcPatternGetDouble( const FcPattern* pPattern, const char* object, int n, double* s )
- { return m_pFcPatternGetDouble( pPattern, object, n, s ); }
-
- FcResult FcPatternGetBool( const FcPattern* pPattern, const char* object, int n, FcBool* s )
- { return m_pFcPatternGetBool( pPattern, object, n, s ); }
- FcBool FcConfigAppFontAddFile( FcConfig* pConfig, const FcChar8* pFileName )
- { return m_pFcConfigAppFontAddFile( pConfig, pFileName ); }
- FcBool FcConfigAppFontAddDir(FcConfig* pConfig, const FcChar8* pDirName )
- { return m_pFcConfigAppFontAddDir( pConfig, pDirName ); }
- FcBool FcConfigParseAndLoad( FcConfig* pConfig, const FcChar8* pFileName, FcBool bComplain )
- { return m_pFcConfigParseAndLoad( pConfig, pFileName, bComplain ); }
-
- void FcDefaultSubstitute( FcPattern* pPattern )
- { m_pFcDefaultSubstitute( pPattern ); }
- FcPattern* FcFontSetMatch( FcConfig* pConfig, FcFontSet **ppFontSet, int nset, FcPattern* pPattern, FcResult* pResult )
- { return m_pFcFontSetMatch ? m_pFcFontSetMatch( pConfig, ppFontSet, nset, pPattern, pResult ) : 0; }
- FcPattern* FcFontMatch( FcConfig* pConfig, FcPattern* pPattern, FcResult* pResult )
- { return m_pFcFontMatch( pConfig, pPattern, pResult ); }
- FcBool FcConfigSubstitute( FcConfig* pConfig, FcPattern* pPattern, FcMatchKind eKind )
- { return m_pFcConfigSubstitute( pConfig, pPattern, eKind ); }
-
- FcPattern* FcPatternDuplicate( const FcPattern* pPattern ) const
- { return m_pFcPatternDuplicate( pPattern ); }
- FcBool FcPatternAddInteger( FcPattern* pPattern, const char* pObject, int nValue )
- { return m_pFcPatternAddInteger( pPattern, pObject, nValue ); }
- FcBool FcPatternAddDouble( FcPattern* pPattern, const char* pObject, double nValue )
- { return m_pFcPatternAddDouble( pPattern, pObject, nValue ); }
- FcBool FcPatternAddString( FcPattern* pPattern, const char* pObject, const FcChar8* pString )
- { return m_pFcPatternAddString( pPattern, pObject, pString ); }
- FcBool FcPatternAddBool( FcPattern* pPattern, const char* pObject, bool nValue )
- { return m_pFcPatternAddBool( pPattern, pObject, nValue ); }
- FcBool FcPatternAddCharSet(FcPattern* pPattern,const char* pObject,const FcCharSet*pCharSet)
- { return m_pFcPatternAddCharSet(pPattern,pObject,pCharSet); }
- FcBool FcPatternDel(FcPattern* pPattern, const char* object)
- { return m_pFcPatternDel( pPattern, object); }
-
- FT_UInt FcFreeTypeCharIndex( FT_Face face, FcChar32 ucs4 )
- { return m_pFcFreeTypeCharIndex ? m_pFcFreeTypeCharIndex( face, ucs4 ) : 0; }
- FcBool FcPatternAddFTFace( FcPattern* pPattern, const char* pObject, const FT_Face nValue )
- {
- return m_pFcPatternAddFTFace
- ? m_pFcPatternAddFTFace( pPattern, pObject, nValue )
- : false;
- }
public:
FcResult LocalizedElementFromPattern(FcPattern* pPattern, FcChar8 **family,
const char *elementtype, const char *elementlangtype);
@@ -301,189 +124,14 @@ private:
void cacheLocalizedFontNames(FcChar8 *origfontname, FcChar8 *bestfontname, const std::vector< lang_and_element > &lang_and_elements);
};
-oslGenericFunction FontCfgWrapper::loadSymbol( const char* pSymbol )
-{
- OUString aSym( OUString::createFromAscii( pSymbol ) );
- oslGenericFunction pSym = osl_getFunctionSymbol( m_pLib, aSym.pData );
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "%s %s\n", pSymbol, pSym ? "found" : "not found" );
-#endif
- return pSym;
-}
-
FontCfgWrapper::FontCfgWrapper()
- : m_pLib( NULL ),
- m_pOutlineSet( NULL ),
- m_nFcVersion( 0 )
+ : m_pOutlineSet( NULL )
{
- OUString aLib( RTL_CONSTASCII_USTRINGPARAM( "libfontconfig.so.1" ) );
- m_pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY );
- if( !m_pLib )
- {
- aLib = OUString( RTL_CONSTASCII_USTRINGPARAM( "libfontconfig.so" ) );
- m_pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY );
- }
-
- if( ! m_pLib )
- {
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "no libfontconfig\n" );
-#endif
- return;
- }
-
- m_pFcInit = (FcBool(*)())
- loadSymbol( "FcInit" );
- m_pFcFini = (void(*)())
- loadSymbol( "FcFini" );
- m_pFcGetVersion = (int(*)())
- loadSymbol( "FcGetVersion" );
- m_pFcConfigGetCurrent = (FcConfig *(*)())
- loadSymbol( "FcConfigGetCurrent" );
- m_pFcObjectSetVaBuild = (FcObjectSet*(*)(const char*,va_list))
- loadSymbol( "FcObjectSetVaBuild" );
- m_pFcObjectSetDestroy = (void(*)(FcObjectSet*))
- loadSymbol( "FcObjectSetDestroy" );
- m_pFcPatternCreate = (FcPattern*(*)())
- loadSymbol( "FcPatternCreate" );
- m_pFcPatternDestroy = (void(*)(FcPattern*))
- loadSymbol( "FcPatternDestroy" );
- m_pFcPatternEqual = (FcBool(*)(const FcPattern*,const FcPattern*))
- loadSymbol( "FcPatternEqual" );
- m_pFcConfigGetFonts = (FcFontSet*(*)(FcConfig*,FcSetName))
- loadSymbol( "FcConfigGetFonts" );
- m_pFcFontSetCreate = (FcFontSet*(*)())
- loadSymbol( "FcFontSetCreate" );
- m_pFcCharSetCreate = (FcCharSet*(*)())
- loadSymbol( "FcCharSetCreate" );
- m_pFcCharSetAddChar = (FcBool(*)(FcCharSet*, FcChar32))
- loadSymbol( "FcCharSetAddChar" );
- m_pFcCharSetHasChar = (FcBool(*)(FcCharSet*, FcChar32))
- loadSymbol( "FcCharSetHasChar" );
- m_pFcCharSetDestroy = (void(*)(FcCharSet*))
- loadSymbol( "FcCharSetDestroy" );
- m_pFcFontSetDestroy = (void(*)(FcFontSet*))
- loadSymbol( "FcFontSetDestroy" );
- m_pFcFontSetAdd = (FcBool(*)(FcFontSet*,FcPattern*))
- loadSymbol( "FcFontSetAdd" );
- m_pFcPatternReference = (void(*)(FcPattern*))
- loadSymbol( "FcPatternReference" );
- m_pFcPatternGetCharSet = (FcResult(*)(const FcPattern*,const char*,int,FcCharSet**))
- loadSymbol( "FcPatternGetCharSet" );
- m_pFcPatternGetString = (FcResult(*)(const FcPattern*,const char*,int,FcChar8**))
- loadSymbol( "FcPatternGetString" );
- m_pFcPatternGetInteger = (FcResult(*)(const FcPattern*,const char*,int,int*))
- loadSymbol( "FcPatternGetInteger" );
- m_pFcPatternGetDouble = (FcResult(*)(const FcPattern*,const char*,int,double*))
- loadSymbol( "FcPatternGetDouble" );
- m_pFcPatternGetBool = (FcResult(*)(const FcPattern*,const char*,int,FcBool*))
- loadSymbol( "FcPatternGetBool" );
- m_pFcConfigAppFontAddFile = (FcBool(*)(FcConfig*, const FcChar8*))
- loadSymbol( "FcConfigAppFontAddFile" );
- m_pFcConfigAppFontAddDir = (FcBool(*)(FcConfig*, const FcChar8*))
- loadSymbol( "FcConfigAppFontAddDir" );
- m_pFcConfigParseAndLoad = (FcBool(*)(FcConfig*, const FcChar8*, FcBool))
- loadSymbol( "FcConfigParseAndLoad" );
- m_pFcDefaultSubstitute = (void(*)(FcPattern *))
- loadSymbol( "FcDefaultSubstitute" );
- m_pFcFontSetMatch = (FcPattern*(*)(FcConfig*,FcFontSet**,int,FcPattern*,FcResult*))
- loadSymbol( "FcFontSetMatch" );
- m_pFcFontMatch = (FcPattern*(*)(FcConfig*,FcPattern*,FcResult*))
- loadSymbol( "FcFontMatch" );
- m_pFcConfigSubstitute = (FcBool(*)(FcConfig*,FcPattern*,FcMatchKind))
- loadSymbol( "FcConfigSubstitute" );
-
- m_pFcPatternDuplicate = (FcPattern*(*)(const FcPattern*))
- loadSymbol( "FcPatternDuplicate" );
- m_pFcPatternAddInteger = (FcBool(*)(FcPattern*,const char*,int))
- loadSymbol( "FcPatternAddInteger" );
- m_pFcPatternAddDouble = (FcBool(*)(FcPattern*,const char*,double))
- loadSymbol( "FcPatternAddDouble" );
- m_pFcPatternAddBool = (FcBool(*)(FcPattern*,const char*,FcBool))
- loadSymbol( "FcPatternAddBool" );
- m_pFcPatternAddCharSet = (FcBool(*)(FcPattern*,const char*,const FcCharSet *))
- loadSymbol( "FcPatternAddCharSet" );
- m_pFcPatternAddString = (FcBool(*)(FcPattern*,const char*,const FcChar8*))
- loadSymbol( "FcPatternAddString" );
- m_pFcPatternDel = (FcBool(*)(FcPattern*,const char*))
- loadSymbol( "FcPatternDel" );
-
- m_pFcFreeTypeCharIndex = (FT_UInt(*)(FT_Face,FcChar32))
- loadSymbol( "FcFreeTypeCharIndex" );
- m_pFcPatternAddFTFace = (FcBool(*)(FcPattern*,const char*,const FT_Face))
- loadSymbol( "FcPatternAddFTFace" );
-
- m_nFcVersion = FcGetVersion();
-#if (OSL_DEBUG_LEVEL > 1)
- fprintf( stderr,"FC_VERSION = %05d\n", m_nFcVersion );
-#endif
- // make minimum version configurable
- const char* pMinFcVersion = getenv( "SAL_MIN_FC_VERSION");
- if( pMinFcVersion )
- {
- const int nMinFcVersion = atoi( pMinFcVersion );
- if( m_nFcVersion < nMinFcVersion )
- m_pFcInit = NULL;
- }
-
- if( ! (
- m_pFcInit &&
- m_pFcGetVersion &&
- m_pFcConfigGetCurrent &&
- m_pFcObjectSetVaBuild &&
- m_pFcObjectSetDestroy &&
- m_pFcPatternCreate &&
- m_pFcPatternDestroy &&
- m_pFcPatternEqual &&
- m_pFcConfigGetFonts &&
- m_pFcFontSetCreate &&
- m_pFcCharSetCreate &&
- m_pFcCharSetAddChar &&
- m_pFcCharSetHasChar &&
- m_pFcCharSetDestroy &&
- m_pFcFontSetDestroy &&
- m_pFcFontSetAdd &&
- m_pFcPatternReference &&
- m_pFcPatternGetCharSet &&
- m_pFcPatternGetString &&
- m_pFcPatternGetInteger &&
- m_pFcPatternGetDouble &&
- m_pFcPatternGetBool &&
- m_pFcConfigAppFontAddFile &&
- m_pFcConfigAppFontAddDir &&
- m_pFcConfigParseAndLoad &&
- m_pFcFontMatch &&
- m_pFcDefaultSubstitute &&
- m_pFcConfigSubstitute &&
- m_pFcPatternDuplicate &&
- m_pFcPatternAddInteger &&
- m_pFcPatternAddDouble &&
- m_pFcPatternAddCharSet &&
- m_pFcPatternAddBool &&
- m_pFcPatternAddString &&
- m_pFcPatternDel
- ) )
- {
- osl_unloadModule( (oslModule)m_pLib );
- m_pLib = NULL;
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "not all needed symbols were found in libfontconfig\n" );
-#endif
- return;
- }
-
-
FcInit();
- if( ! FcConfigGetCurrent() )
- {
- osl_unloadModule( (oslModule)m_pLib );
- m_pLib = NULL;
- }
}
void FontCfgWrapper::addFontSet( FcSetName eSetName )
{
- #ifdef ENABLE_FONTCONFIG
/*
add only acceptable outlined fonts to our config,
for future fontconfig use
@@ -506,20 +154,16 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName )
}
// TODO?: FcFontSetDestroy( pOrig );
- #else
- (void)eSetName; // prevent compiler warning about unused parameter
- #endif
}
-#ifdef ENABLE_FONTCONFIG
namespace
{
- int compareFontNames(FontCfgWrapper& rWrapper, const FcPattern *a, const FcPattern *b)
+ int compareFontNames(const FcPattern *a, const FcPattern *b)
{
FcChar8 *pNameA=NULL, *pNameB=NULL;
- bool bHaveA = rWrapper.FcPatternGetString(a, FC_FAMILY, 0, &pNameA) == FcResultMatch;
- bool bHaveB = rWrapper.FcPatternGetString(b, FC_FAMILY, 0, &pNameB) == FcResultMatch;
+ bool bHaveA = FcPatternGetString(a, FC_FAMILY, 0, &pNameA) == FcResultMatch;
+ bool bHaveB = FcPatternGetString(b, FC_FAMILY, 0, &pNameB) == FcResultMatch;
if (bHaveA && bHaveB)
return strcmp((const char*)pNameA, (const char*)pNameB);
@@ -531,21 +175,17 @@ namespace
//those with higher version numbers first
class SortFont : public ::std::binary_function< const FcPattern*, const FcPattern*, bool >
{
- private:
- FontCfgWrapper& m_rWrapper;
public:
- SortFont(FontCfgWrapper& rWrapper) : m_rWrapper(rWrapper) {}
-
bool operator()(const FcPattern *a, const FcPattern *b)
{
- int comp = compareFontNames(m_rWrapper, a, b);
+ int comp = compareFontNames(a, b);
if (comp != 0)
return comp < 0;
int nVersionA=0, nVersionB=0;
- bool bHaveA = m_rWrapper.FcPatternGetInteger(a, FC_FONTVERSION, 0, &nVersionA) == FcResultMatch;
- bool bHaveB = m_rWrapper.FcPatternGetInteger(b, FC_FONTVERSION, 0, &nVersionB) == FcResultMatch;
+ bool bHaveA = FcPatternGetInteger(a, FC_FONTVERSION, 0, &nVersionA) == FcResultMatch;
+ bool bHaveB = FcPatternGetInteger(b, FC_FONTVERSION, 0, &nVersionB) == FcResultMatch;
if (bHaveA && bHaveB)
return nVersionA > nVersionB;
@@ -560,7 +200,7 @@ namespace
//See if this font is a duplicate with equal attributes which has already been
//inserted, or if it an older version of an inserted fonts. Depends on FcFontSet
//on being sorted with SortFont
- bool isPreviouslyDuplicateOrObsoleted(FontCfgWrapper& rWrapper, FcFontSet *pFSet, int i)
+ bool isPreviouslyDuplicateOrObsoleted(FcFontSet *pFSet, int i)
{
if (i == 0)
return false;
@@ -568,46 +208,41 @@ namespace
const FcPattern *a = pFSet->fonts[i];
const FcPattern *b = pFSet->fonts[i-1];
- if (compareFontNames(rWrapper, a, b) != 0)
+ if (compareFontNames(a, b) != 0)
return false;
- FcPattern* pTestPatternA = rWrapper.FcPatternDuplicate(a);
- rWrapper.FcPatternDel(pTestPatternA, FC_FILE);
- rWrapper.FcPatternDel(pTestPatternA, FC_CHARSET);
- rWrapper.FcPatternDel(pTestPatternA, FC_CAPABILITY);
- rWrapper.FcPatternDel(pTestPatternA, FC_FONTVERSION);
+ FcPattern* pTestPatternA = FcPatternDuplicate(a);
+ FcPatternDel(pTestPatternA, FC_FILE);
+ FcPatternDel(pTestPatternA, FC_CHARSET);
+ FcPatternDel(pTestPatternA, FC_CAPABILITY);
+ FcPatternDel(pTestPatternA, FC_FONTVERSION);
- FcPattern* pTestPatternB = rWrapper.FcPatternDuplicate(b);
- rWrapper.FcPatternDel(pTestPatternB, FC_FILE);
- rWrapper.FcPatternDel(pTestPatternB, FC_CHARSET);
- rWrapper.FcPatternDel(pTestPatternB, FC_CAPABILITY);
- rWrapper.FcPatternDel(pTestPatternB, FC_FONTVERSION);
+ FcPattern* pTestPatternB = FcPatternDuplicate(b);
+ FcPatternDel(pTestPatternB, FC_FILE);
+ FcPatternDel(pTestPatternB, FC_CHARSET);
+ FcPatternDel(pTestPatternB, FC_CAPABILITY);
+ FcPatternDel(pTestPatternB, FC_FONTVERSION);
- bool bIsDup = false;
- if (rWrapper.FcPatternEqual(pTestPatternA, pTestPatternB))
- bIsDup = true;
+ bool bIsDup = FcPatternEqual(pTestPatternA, pTestPatternB);
- rWrapper.FcPatternDestroy(pTestPatternB);
- rWrapper.FcPatternDestroy(pTestPatternA);
+ FcPatternDestroy(pTestPatternB);
+ FcPatternDestroy(pTestPatternA);
return bIsDup;
}
}
-#endif
FcFontSet* FontCfgWrapper::getFontSet()
{
- #ifdef ENABLE_FONTCONFIG
if( !m_pOutlineSet )
{
m_pOutlineSet = FcFontSetCreate();
addFontSet( FcSetSystem );
- if( m_nFcVersion > 20400 ) // #i85462# prevent crashes
+ if( FcGetVersion() > 20400 ) // #i85462# prevent crashes
addFontSet( FcSetApplication );
- ::std::sort(m_pOutlineSet->fonts,m_pOutlineSet->fonts+m_pOutlineSet->nfont,SortFont(*this));
+ ::std::sort(m_pOutlineSet->fonts,m_pOutlineSet->fonts+m_pOutlineSet->nfont,SortFont());
}
- #endif
return m_pOutlineSet;
}
@@ -616,9 +251,8 @@ FontCfgWrapper::~FontCfgWrapper()
{
if( m_pOutlineSet )
FcFontSetDestroy( m_pOutlineSet );
- FcFini();
- if( m_pLib )
- osl_unloadModule( (oslModule)m_pLib );
+ //To-Do: get gtk vclplug smoketest to pass
+ //FcFini();
}
static FontCfgWrapper* pOneInstance = NULL;
@@ -639,7 +273,6 @@ void FontCfgWrapper::release()
}
}
-#ifdef ENABLE_FONTCONFIG
namespace
{
class localizedsorter
@@ -749,9 +382,7 @@ FcResult FontCfgWrapper::LocalizedElementFromPattern(FcPattern* pPattern, FcChar
*/
bool PrintFontManager::initFontconfig()
{
- FontCfgWrapper& rWrapper = FontCfgWrapper::get();
- if( ! rWrapper.isValid() )
- return false;
+ FontCfgWrapper::get();
return true;
}
@@ -827,8 +458,6 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i
int nFonts = 0;
FontCfgWrapper& rWrapper = FontCfgWrapper::get();
- if( !rWrapper.isValid() )
- return 0;
FcFontSet* pFSet = rWrapper.getFontSet();
if( pFSet )
@@ -841,20 +470,22 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i
FcChar8* file = NULL;
FcChar8* family = NULL;
FcChar8* style = NULL;
+ FcChar8* format = NULL;
int slant = 0;
int weight = 0;
int spacing = 0;
int nCollectionEntry = -1;
FcBool outline = false;
- FcResult eFileRes = rWrapper.FcPatternGetString( pFSet->fonts[i], FC_FILE, 0, &file );
+ FcResult eFileRes = FcPatternGetString(pFSet->fonts[i], FC_FILE, 0, &file);
FcResult eFamilyRes = rWrapper.LocalizedElementFromPattern( pFSet->fonts[i], &family, FC_FAMILY, FC_FAMILYLANG );
FcResult eStyleRes = rWrapper.LocalizedElementFromPattern( pFSet->fonts[i], &style, FC_STYLE, FC_STYLELANG );
- FcResult eSlantRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_SLANT, 0, &slant );
- FcResult eWeightRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_WEIGHT, 0, &weight );
- FcResult eSpacRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_SPACING, 0, &spacing );
- FcResult eOutRes = rWrapper.FcPatternGetBool( pFSet->fonts[i], FC_OUTLINE, 0, &outline );
- FcResult eIndexRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_INDEX, 0, &nCollectionEntry );
+ FcResult eSlantRes = FcPatternGetInteger(pFSet->fonts[i], FC_SLANT, 0, &slant);
+ FcResult eWeightRes = FcPatternGetInteger(pFSet->fonts[i], FC_WEIGHT, 0, &weight);
+ FcResult eSpacRes = FcPatternGetInteger(pFSet->fonts[i], FC_SPACING, 0, &spacing);
+ FcResult eOutRes = FcPatternGetBool(pFSet->fonts[i], FC_OUTLINE, 0, &outline);
+ FcResult eIndexRes = FcPatternGetInteger(pFSet->fonts[i], FC_INDEX, 0, &nCollectionEntry);
+ FcResult eFormatRes = FcPatternGetString(pFSet->fonts[i], FC_FONTFORMAT, 0, &format);
if( eFileRes != FcResultMatch || eFamilyRes != FcResultMatch || eOutRes != FcResultMatch )
continue;
@@ -862,13 +493,14 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i
#if (OSL_DEBUG_LEVEL > 2)
fprintf( stderr, "found font \"%s\" in file %s\n"
" weight = %d, slant = %d, style = \"%s\"\n"
- " spacing = %d, outline = %d\n"
+ " spacing = %d, outline = %d, format %s\n"
, family, file
, eWeightRes == FcResultMatch ? weight : -1
, eSpacRes == FcResultMatch ? slant : -1
, eStyleRes == FcResultMatch ? (const char*) style : "<nil>"
, eSpacRes == FcResultMatch ? spacing : -1
, eOutRes == FcResultMatch ? outline : -1
+ , eFormatRes == FcResultMatch ? (const char*)format : "<unknown>"
);
#endif
@@ -878,7 +510,7 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i
if( eOutRes == FcResultMatch && ! outline )
continue;
- if (isPreviouslyDuplicateOrObsoleted(rWrapper, pFSet, i))
+ if (isPreviouslyDuplicateOrObsoleted(pFSet, i))
{
#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "Ditching %s as duplicate/obsolete\n", file);
@@ -903,7 +535,9 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i
// not known, analyze font file to get attributes
// not described by fontconfig (e.g. alias names, PSName)
std::list< OString > aDummy;
- analyzeFontFile( nDirID, aBase, aDummy, aFonts );
+ if (eFormatRes != FcResultMatch)
+ format = NULL;
+ analyzeFontFile( nDirID, aBase, aDummy, aFonts, (const char*)format );
#if OSL_DEBUG_LEVEL > 1
if( aFonts.empty() )
fprintf( stderr, "Warning: file \"%s\" is unusable to psprint\n", aOrgPath.getStr() );
@@ -1004,25 +638,15 @@ void PrintFontManager::deinitFontconfig()
FontCfgWrapper::release();
}
-int PrintFontManager::FreeTypeCharIndex( void *pFace, sal_uInt32 aChar )
-{
- FontCfgWrapper& rWrapper = FontCfgWrapper::get();
- return rWrapper.isValid() ? rWrapper.FcFreeTypeCharIndex( (FT_Face)pFace, aChar ) : 0;
-}
-
bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName )
{
- FontCfgWrapper& rWrapper = FontCfgWrapper::get();
- if( ! rWrapper.isValid() )
- return false;
-
// workaround for a stability problems in older FC versions
// when handling application specifc fonts
- const int nVersion = rWrapper.FcGetVersion();
+ const int nVersion = FcGetVersion();
if( nVersion <= 20400 )
return false;
const char* pDirName = (const char*)rDirName.getStr();
- bool bDirOk = (rWrapper.FcConfigAppFontAddDir( rWrapper.FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue);
+ bool bDirOk = (FcConfigAppFontAddDir(FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue);
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "FcConfigAppFontAddDir( \"%s\") => %d\n", pDirName, bDirOk );
@@ -1037,8 +661,8 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName )
if( pCfgFile )
{
fclose( pCfgFile);
- bool bCfgOk = rWrapper.FcConfigParseAndLoad( rWrapper.FcConfigGetCurrent(),
- (FcChar8*)aConfFileName.getStr(), FcTrue );
+ bool bCfgOk = FcConfigParseAndLoad(FcConfigGetCurrent(),
+ (FcChar8*)aConfFileName.getStr(), FcTrue);
if( !bCfgOk )
fprintf( stderr, "FcConfigParseAndLoad( \"%s\") => %d\n", aConfFileName.getStr(), bCfgOk );
}
@@ -1046,7 +670,7 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName )
return true;
}
-static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern,
+static void addtopattern(FcPattern *pPattern,
FontItalic eItalic, FontWeight eWeight, FontWidth eWidth, FontPitch ePitch)
{
if( eItalic != ITALIC_DONTKNOW )
@@ -1054,12 +678,16 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern,
int nSlant = FC_SLANT_ROMAN;
switch( eItalic )
{
- case ITALIC_NORMAL: nSlant = FC_SLANT_ITALIC;break;
- case ITALIC_OBLIQUE: nSlant = FC_SLANT_OBLIQUE;break;
+ case ITALIC_NORMAL:
+ nSlant = FC_SLANT_ITALIC;
+ break;
+ case ITALIC_OBLIQUE:
+ nSlant = FC_SLANT_OBLIQUE;
+ break;
default:
break;
}
- rWrapper.FcPatternAddInteger( pPattern, FC_SLANT, nSlant );
+ FcPatternAddInteger(pPattern, FC_SLANT, nSlant);
}
if( eWeight != WEIGHT_DONTKNOW )
{
@@ -1079,7 +707,7 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern,
default:
break;
}
- rWrapper.FcPatternAddInteger( pPattern, FC_WEIGHT, nWeight );
+ FcPatternAddInteger(pPattern, FC_WEIGHT, nWeight);
}
if( eWidth != WIDTH_DONTKNOW )
{
@@ -1098,7 +726,7 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern,
default:
break;
}
- rWrapper.FcPatternAddInteger( pPattern, FC_WIDTH, nWidth );
+ FcPatternAddInteger(pPattern, FC_WIDTH, nWidth);
}
if( ePitch != PITCH_DONTKNOW )
{
@@ -1110,9 +738,9 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern,
default:
break;
}
- rWrapper.FcPatternAddInteger( pPattern, FC_SPACING, nSpacing );
+ FcPatternAddInteger(pPattern, FC_SPACING, nSpacing);
if (nSpacing == FC_MONO)
- rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)"monospace");
+ FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)"monospace");
}
}
@@ -1123,18 +751,16 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
{
rtl::OUString aName;
FontCfgWrapper& rWrapper = FontCfgWrapper::get();
- if( ! rWrapper.isValid() )
- return aName;
// build pattern argument for fontconfig query
- FcPattern* pPattern = rWrapper.FcPatternCreate();
+ FcPattern* pPattern = FcPatternCreate();
// Prefer scalable fonts
- rWrapper.FcPatternAddBool( pPattern, FC_SCALABLE, FcTrue );
+ FcPatternAddBool(pPattern, FC_SCALABLE, FcTrue);
const rtl::OString aTargetName = rtl::OUStringToOString( rFontName, RTL_TEXTENCODING_UTF8 );
const FcChar8* pTargetNameUtf8 = (FcChar8*)aTargetName.getStr();
- rWrapper.FcPatternAddString( pPattern, FC_FAMILY, pTargetNameUtf8 );
+ FcPatternAddString(pPattern, FC_FAMILY, pTargetNameUtf8);
if( rLangAttrib.getLength() )
{
@@ -1143,42 +769,42 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
pLangAttribUtf8 = (FcChar8*)"pa";
else
pLangAttribUtf8 = (FcChar8*)rLangAttrib.getStr();
- rWrapper.FcPatternAddString( pPattern, FC_LANG, pLangAttribUtf8 );
+ FcPatternAddString(pPattern, FC_LANG, pLangAttribUtf8);
}
// Add required Unicode characters, if any
if ( rMissingCodes.getLength() )
{
- FcCharSet *unicodes = rWrapper.FcCharSetCreate();
+ FcCharSet *unicodes = FcCharSetCreate();
for( sal_Int32 nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); )
{
// also handle unicode surrogates
const sal_uInt32 nCode = rMissingCodes.iterateCodePoints( &nStrIndex );
- rWrapper.FcCharSetAddChar( unicodes, nCode );
+ FcCharSetAddChar( unicodes, nCode );
}
- rWrapper.FcPatternAddCharSet( pPattern, FC_CHARSET, unicodes);
- rWrapper.FcCharSetDestroy( unicodes );
+ FcPatternAddCharSet(pPattern, FC_CHARSET, unicodes);
+ FcCharSetDestroy(unicodes);
}
- addtopattern(rWrapper, pPattern, rItalic, rWeight, rWidth, rPitch);
+ addtopattern(pPattern, rItalic, rWeight, rWidth, rPitch);
// query fontconfig for a substitute
- rWrapper.FcConfigSubstitute( rWrapper.FcConfigGetCurrent(), pPattern, FcMatchPattern );
- rWrapper.FcDefaultSubstitute( pPattern );
+ FcConfigSubstitute(FcConfigGetCurrent(), pPattern, FcMatchPattern);
+ FcDefaultSubstitute(pPattern);
// process the result of the fontconfig query
FcResult eResult = FcResultNoMatch;
FcFontSet* pFontSet = rWrapper.getFontSet();
- FcPattern* pResult = rWrapper.FcFontSetMatch( rWrapper.FcConfigGetCurrent(), &pFontSet, 1, pPattern, &eResult );
- rWrapper.FcPatternDestroy( pPattern );
+ FcPattern* pResult = FcFontSetMatch(FcConfigGetCurrent(), &pFontSet, 1, pPattern, &eResult);
+ FcPatternDestroy( pPattern );
FcFontSet* pSet = NULL;
if( pResult )
{
- pSet = rWrapper.FcFontSetCreate();
+ pSet = FcFontSetCreate();
// info: destroying the pSet destroys pResult implicitly
// since pResult was "added" to pSet
- rWrapper.FcFontSetAdd( pSet, pResult );
+ FcFontSetAdd( pSet, pResult );
}
if( pSet )
@@ -1187,7 +813,7 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
{
//extract the closest match
FcChar8* family = NULL;
- FcResult eFileRes = rWrapper.FcPatternGetString( pSet->fonts[0], FC_FAMILY, 0, &family );
+ FcResult eFileRes = FcPatternGetString( pSet->fonts[0], FC_FAMILY, 0, &family );
// get the family name
if( eFileRes == FcResultMatch )
@@ -1200,13 +826,13 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
int val = 0;
- if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WEIGHT, 0, &val))
+ if (FcResultMatch == FcPatternGetInteger(pSet->fonts[0], FC_WEIGHT, 0, &val))
rWeight = convertWeight(val);
- if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SLANT, 0, &val))
+ if (FcResultMatch == FcPatternGetInteger(pSet->fonts[0], FC_SLANT, 0, &val))
rItalic = convertSlant(val);
- if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SPACING, 0, &val))
+ if (FcResultMatch == FcPatternGetInteger(pSet->fonts[0], FC_SPACING, 0, &val))
rPitch = convertSpacing(val);
- if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WIDTH, 0, &val))
+ if (FcResultMatch == FcPatternGetInteger(pSet->fonts[0], FC_WIDTH, 0, &val))
rWidth = convertWidth(val);
}
@@ -1216,13 +842,13 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
sal_uInt32* pRemainingCodes = (sal_uInt32*)alloca( rMissingCodes.getLength() * sizeof(sal_uInt32) );
int nRemainingLen = 0;
FcCharSet* unicodes;
- if( !rWrapper.FcPatternGetCharSet( pSet->fonts[0], FC_CHARSET, 0, &unicodes ) )
+ if (!FcPatternGetCharSet(pSet->fonts[0], FC_CHARSET, 0, &unicodes))
{
for( sal_Int32 nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); )
{
// also handle unicode surrogates
const sal_uInt32 nCode = rMissingCodes.iterateCodePoints( &nStrIndex );
- if( rWrapper.FcCharSetHasChar( unicodes, nCode ) != FcTrue )
+ if (FcCharSetHasChar(unicodes, nCode) != FcTrue)
pRemainingCodes[ nRemainingLen++ ] = nCode;
}
}
@@ -1230,7 +856,7 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
}
}
- rWrapper.FcFontSetDestroy( pSet );
+ FcFontSetDestroy( pSet );
}
return aName;
@@ -1242,18 +868,15 @@ public:
FontConfigFontOptions() : mpPattern(0) {}
~FontConfigFontOptions()
{
- FontCfgWrapper& rWrapper = FontCfgWrapper::get();
- if( rWrapper.isValid() )
- rWrapper.FcPatternDestroy( mpPattern );
+ FcPatternDestroy(mpPattern);
}
virtual void *GetPattern(void * face, bool bEmbolden) const
{
- FontCfgWrapper& rWrapper = FontCfgWrapper::get();
- if( rWrapper.isValid() )
- {
- rWrapper.FcPatternAddFTFace(mpPattern, FC_FT_FACE, static_cast<FT_Face>(face));
- rWrapper.FcPatternAddBool(mpPattern, FC_EMBOLDEN, bEmbolden ? FcTrue : FcFalse);
- }
+ FcValue value;
+ value.type = FcTypeFTFace;
+ value.u.f = face;
+ FcPatternAdd (mpPattern, FC_FT_FACE, value, FcTrue);
+ FcPatternAddBool(mpPattern, FC_EMBOLDEN, bEmbolden ? FcTrue : FcFalse);
return mpPattern;
}
FcPattern* mpPattern;
@@ -1262,17 +885,11 @@ public:
ImplFontOptions* PrintFontManager::getFontOptions(
const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void*)) const
{
-#ifndef ENABLE_FONTCONFIG
- (void)rInfo;(void)nSize;(void)subcallback;(void)rOptions;
- return NULL;
-#else // ENABLE_FONTCONFIG
FontCfgWrapper& rWrapper = FontCfgWrapper::get();
- if( ! rWrapper.isValid() )
- return NULL;
FontConfigFontOptions* pOptions = NULL;
- FcConfig* pConfig = rWrapper.FcConfigGetCurrent();
- FcPattern* pPattern = rWrapper.FcPatternCreate();
+ FcConfig* pConfig = FcConfigGetCurrent();
+ FcPattern* pPattern = FcPatternCreate();
OString sFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 );
@@ -1280,32 +897,33 @@ ImplFontOptions* PrintFontManager::getFontOptions(
if (aI != rWrapper.m_aLocalizedToCanonical.end())
sFamily = aI->second;
if( sFamily.getLength() )
- rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)sFamily.getStr() );
+ FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)sFamily.getStr());
- addtopattern(rWrapper, pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch);
- rWrapper.FcPatternAddDouble( pPattern, FC_PIXEL_SIZE, nSize);
+ addtopattern(pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch);
+ FcPatternAddDouble(pPattern, FC_PIXEL_SIZE, nSize);
FcBool embitmap = true, antialias = true, autohint = true, hinting = true;
int hintstyle = FC_HINT_FULL;
- rWrapper.FcConfigSubstitute( pConfig, pPattern, FcMatchPattern );
- if (subcallback) subcallback(pPattern);
- rWrapper.FcDefaultSubstitute( pPattern );
+ FcConfigSubstitute(pConfig, pPattern, FcMatchPattern);
+ if (subcallback)
+ subcallback(pPattern);
+ FcDefaultSubstitute(pPattern);
FcResult eResult = FcResultNoMatch;
FcFontSet* pFontSet = rWrapper.getFontSet();
- FcPattern* pResult = rWrapper.FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult );
+ FcPattern* pResult = FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult );
if( pResult )
{
- FcResult eEmbeddedBitmap = rWrapper.FcPatternGetBool(pResult,
+ FcResult eEmbeddedBitmap = FcPatternGetBool(pResult,
FC_EMBEDDED_BITMAP, 0, &embitmap);
- FcResult eAntialias = rWrapper.FcPatternGetBool(pResult,
+ FcResult eAntialias = FcPatternGetBool(pResult,
FC_ANTIALIAS, 0, &antialias);
- FcResult eAutoHint = rWrapper.FcPatternGetBool(pResult,
+ FcResult eAutoHint = FcPatternGetBool(pResult,
FC_AUTOHINT, 0, &autohint);
- FcResult eHinting = rWrapper.FcPatternGetBool(pResult,
+ FcResult eHinting = FcPatternGetBool(pResult,
FC_HINTING, 0, &hinting);
- /*FcResult eHintStyle =*/ rWrapper.FcPatternGetInteger(pResult,
+ /*FcResult eHintStyle =*/ FcPatternGetInteger(pResult,
FC_HINT_STYLE, 0, &hintstyle);
pOptions = new FontConfigFontOptions;
@@ -1331,20 +949,17 @@ ImplFontOptions* PrintFontManager::getFontOptions(
}
// cleanup
- rWrapper.FcPatternDestroy( pPattern );
+ FcPatternDestroy( pPattern );
return pOptions;
-#endif
}
bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale )
{
FontCfgWrapper& rWrapper = FontCfgWrapper::get();
- if( ! rWrapper.isValid() )
- return false;
- FcConfig* pConfig = rWrapper.FcConfigGetCurrent();
- FcPattern* pPattern = rWrapper.FcPatternCreate();
+ FcConfig* pConfig = FcConfigGetCurrent();
+ FcPattern* pPattern = FcPatternCreate();
OString aLangAttrib;
// populate pattern with font characteristics
@@ -1360,29 +975,29 @@ bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star
aLangAttrib = OUStringToOString( aLang.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
}
if( aLangAttrib.getLength() )
- rWrapper.FcPatternAddString( pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr() );
+ 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() );
+ FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)aFamily.getStr());
- addtopattern(rWrapper, pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch);
+ addtopattern(pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch);
- rWrapper.FcConfigSubstitute( pConfig, pPattern, FcMatchPattern );
- rWrapper.FcDefaultSubstitute( pPattern );
+ FcConfigSubstitute(pConfig, pPattern, FcMatchPattern);
+ FcDefaultSubstitute(pPattern);
FcResult eResult = FcResultNoMatch;
FcFontSet *pFontSet = rWrapper.getFontSet();
- FcPattern* pResult = rWrapper.FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult );
+ FcPattern* pResult = FcFontSetMatch(pConfig, &pFontSet, 1, pPattern, &eResult);
bool bSuccess = false;
if( pResult )
{
- FcFontSet* pSet = rWrapper.FcFontSetCreate();
- rWrapper.FcFontSetAdd( pSet, pResult );
+ FcFontSet* pSet = FcFontSetCreate();
+ FcFontSetAdd( pSet, pResult );
if( pSet->nfont > 0 )
{
//extract the closest match
FcChar8* file = NULL;
- FcResult eFileRes = rWrapper.FcPatternGetString( pSet->fonts[0], FC_FILE, 0, &file );
+ FcResult eFileRes = FcPatternGetString(pSet->fonts[0], FC_FILE, 0, &file);
if( eFileRes == FcResultMatch )
{
OString aDir, aBase, aOrgPath( (sal_Char*)file );
@@ -1395,52 +1010,13 @@ bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star
}
// info: destroying the pSet destroys pResult implicitly
// since pResult was "added" to pSet
- rWrapper.FcFontSetDestroy( pSet );
+ FcFontSetDestroy( pSet );
}
// cleanup
- rWrapper.FcPatternDestroy( pPattern );
+ FcPatternDestroy( pPattern );
return bSuccess;
}
-#else // ENABLE_FONTCONFIG not defined
-
-bool PrintFontManager::initFontconfig()
-{
- return false;
-}
-
-int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, int, rtl::OStringHash>& )
-{
- return 0;
-}
-
-void PrintFontManager::deinitFontconfig()
-{}
-
-bool PrintFontManager::addFontconfigDir( const rtl::OString& )
-{
- return false;
-}
-
-bool PrintFontManager::matchFont( FastPrintFontInfo&, const com::sun::star::lang::Locale& )
-{
- return false;
-}
-
-int PrintFontManager::FreeTypeCharIndex( void*, sal_uInt32 )
-{
- return 0;
-}
-
-rtl::OUString PrintFontManager::Substitute( const rtl::OUString&,
- rtl::OUString&, const rtl::OString&, FontItalic, FontWeight, FontWidth, FontPitch) const
-{
- rtl::OUString aName;
- return aName;
-}
-
-#endif // ENABLE_FONTCONFIG
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx
index 1427daedb193..8936df327aeb 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -1281,9 +1281,12 @@ int PrintFontManager::addFontFile( const ::rtl::OString& rFileName, int /*nFaceN
return nFontId;
}
-// -------------------------------------------------------------------------
+enum fontFormat
+{
+ UNKNOWN, TRUETYPE, CFF, TYPE1, AFM
+};
-bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, const ::std::list<OString>& rXLFDs, ::std::list< PrintFontManager::PrintFont* >& rNewFonts ) const
+bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, const ::std::list<OString>& rXLFDs, ::std::list< PrintFontManager::PrintFont* >& rNewFonts, const char *pFormat ) const
{
rNewFonts.clear();
@@ -1297,8 +1300,32 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co
if( access( aFullPath.getStr(), R_OK ) )
return false;
- ByteString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) );
- if( aExt.EqualsIgnoreCaseAscii( "pfb" ) || aExt.EqualsIgnoreCaseAscii( "pfa" ) )
+ fontFormat eFormat = UNKNOWN;
+ if (pFormat)
+ {
+ if (!strcmp(pFormat, "TrueType"))
+ eFormat = TRUETYPE;
+ else if (!strcmp(pFormat, "CFF"))
+ eFormat = CFF;
+ else if (!strcmp(pFormat, "Type 1"))
+ eFormat = TYPE1;
+ }
+ if (eFormat == UNKNOWN)
+ {
+ ByteString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) );
+ if( aExt.EqualsIgnoreCaseAscii( "pfb" ) || aExt.EqualsIgnoreCaseAscii( "pfa" ) )
+ eFormat = TYPE1;
+ else if( aExt.EqualsIgnoreCaseAscii( "afm" ) )
+ eFormat = AFM;
+ else if( aExt.EqualsIgnoreCaseAscii( "ttf" )
+ || aExt.EqualsIgnoreCaseAscii( "ttc" )
+ || aExt.EqualsIgnoreCaseAscii( "tte" ) ) // #i33947# for Gaiji support
+ eFormat = TRUETYPE;
+ else if( aExt.EqualsIgnoreCaseAscii( "otf" ) ) // check for TTF- and PS-OpenType too
+ eFormat = CFF;
+ }
+
+ if (eFormat == TYPE1)
{
// check for corresponding afm metric
// first look for an adjacent file
@@ -1352,7 +1379,7 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co
}
}
}
- else if( aExt.EqualsIgnoreCaseAscii( "afm" ) )
+ else if (eFormat == AFM)
{
ByteString aFilePath( aDir );
aFilePath.Append( '/' );
@@ -1365,34 +1392,14 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co
else
delete pFont;
}
- else if( aExt.EqualsIgnoreCaseAscii( "ttf" )
- || aExt.EqualsIgnoreCaseAscii( "tte" ) // #i33947# for Gaiji support
- || aExt.EqualsIgnoreCaseAscii( "otf" ) ) // check for TTF- and PS-OpenType too
- {
- TrueTypeFontFile* pFont = new TrueTypeFontFile();
- pFont->m_nDirectory = nDirID;
- pFont->m_aFontFile = rFontFile;
- pFont->m_nCollectionEntry = -1;
-
- if( rXLFDs.size() )
- getFontAttributesFromXLFD( pFont, rXLFDs );
- // need to read the font anyway to get aliases inside the font file
- if( ! analyzeTrueTypeFile( pFont ) )
- {
- delete pFont;
- pFont = NULL;
- }
- else
- rNewFonts.push_back( pFont );
- }
- else if( aExt.EqualsIgnoreCaseAscii( "ttc" ) )
+ else if (eFormat == TRUETYPE || eFormat == CFF)
{
// get number of ttc entries
int nLength = CountTTCFonts( aFullPath.getStr() );
if( nLength )
{
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "%s contains %d fonts\n", aFullPath.getStr(), nLength );
+ fprintf( stderr, "ttc: %s contains %d fonts\n", aFullPath.getStr(), nLength );
#endif
for( int i = 0; i < nLength; i++ )
{
@@ -1411,10 +1418,24 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co
rNewFonts.push_back( pFont );
}
}
-#if OSL_DEBUG_LEVEL > 1
else
- fprintf( stderr, "CountTTCFonts( \"%s/%s\" ) failed\n", getDirectory(nDirID).getStr(), rFontFile.getStr() );
-#endif
+ {
+ TrueTypeFontFile* pFont = new TrueTypeFontFile();
+ pFont->m_nDirectory = nDirID;
+ pFont->m_aFontFile = rFontFile;
+ pFont->m_nCollectionEntry = -1;
+
+ if( rXLFDs.size() )
+ getFontAttributesFromXLFD( pFont, rXLFDs );
+ // need to read the font anyway to get aliases inside the font file
+ if( ! analyzeTrueTypeFile( pFont ) )
+ {
+ delete pFont;
+ pFont = NULL;
+ }
+ else
+ rNewFonts.push_back( pFont );
+ }
}
return ! rNewFonts.empty();
}
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index 3349e6ef3c01..22a5d1eddb26 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -32,6 +32,7 @@
#include <string.h>
#include <stdio.h>
#include <errno.h>
+
#ifdef FREEBSD
#include <sys/types.h>
#endif
@@ -69,14 +70,14 @@ SalBitmap* X11SalInstance::CreateSalBitmap()
}
ImplSalBitmapCache* X11SalBitmap::mpCache = NULL;
-sal_uLong X11SalBitmap::mnCacheInstCount = 0;
+sal_uLong X11SalBitmap::mnCacheInstCount = 0;
// -----------------------------------------------------------------------------
-X11SalBitmap::X11SalBitmap() :
- mpDIB( NULL ),
- mpDDB( NULL ),
- mbGrey( false )
+X11SalBitmap::X11SalBitmap()
+ : mpDIB( NULL )
+ , mpDDB( NULL )
+ , mbGrey( false )
{
}
@@ -115,9 +116,19 @@ void X11SalBitmap::ImplRemovedFromCache()
// -----------------------------------------------------------------------------
-BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal )
-{
- DBG_ASSERT( nBitCount == 1 || nBitCount == 4 || nBitCount == 8 || nBitCount == 16 || nBitCount == 24, "Unsupported BitCount!" );
+BitmapBuffer* X11SalBitmap::ImplCreateDIB(
+ const Size& rSize,
+ sal_uInt16 nBitCount,
+ const BitmapPalette& rPal
+) {
+ DBG_ASSERT(
+ nBitCount == 1
+ || nBitCount == 4
+ || nBitCount == 8
+ || nBitCount == 16
+ || nBitCount == 24
+ , "Unsupported BitCount!"
+ );
BitmapBuffer* pDIB = NULL;
@@ -192,13 +203,16 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, sal_uInt16 nBitCou
// -----------------------------------------------------------------------------
-BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
- int nScreen,
- long nDrawableDepth,
- long nX, long nY,
- long nWidth, long nHeight,
- bool bGrey )
-{
+BitmapBuffer* X11SalBitmap::ImplCreateDIB(
+ Drawable aDrawable,
+ int nScreen,
+ long nDrawableDepth,
+ long nX,
+ long nY,
+ long nWidth,
+ long nHeight,
+ bool bGrey
+) {
BitmapBuffer* pDIB = NULL;
if( aDrawable && nWidth && nHeight && nDrawableDepth )
@@ -221,7 +235,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
{
const SalTwoRect aTwoRect = { 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight };
BitmapBuffer aSrcBuf;
- sal_uLong nDstFormat = BMP_FORMAT_BOTTOM_UP;
+ sal_uLong nDstFormat = BMP_FORMAT_BOTTOM_UP;
const BitmapPalette* pDstPal = NULL;
aSrcBuf.mnFormat = BMP_FORMAT_TOP_DOWN;
@@ -239,14 +253,20 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
{
case( 1 ):
{
- aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_1BIT_LSB_PAL : BMP_FORMAT_1BIT_MSB_PAL );
+ aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order
+ ? BMP_FORMAT_1BIT_LSB_PAL
+ : BMP_FORMAT_1BIT_MSB_PAL
+ );
nDstFormat |= BMP_FORMAT_1BIT_MSB_PAL;
}
break;
case( 4 ):
{
- aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_4BIT_LSN_PAL : BMP_FORMAT_4BIT_MSN_PAL );
+ aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order
+ ? BMP_FORMAT_4BIT_LSN_PAL
+ : BMP_FORMAT_4BIT_MSN_PAL
+ );
nDstFormat |= BMP_FORMAT_4BIT_MSN_PAL;
}
break;
@@ -270,7 +290,6 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
else
{
aSrcBuf.mnFormat |= BMP_FORMAT_16BIT_TC_MSB_MASK;
- // aSrcBuf.maColorMask = ColorMask( pImage->red_mask ), SWAPSHORT( pImage->green_mask ), SWAPSHORT( pImage->blue_mask ) );
}
}
break;
@@ -289,10 +308,15 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
case( 32 ):
{
if( LSBFirst == pImage->byte_order )
- aSrcBuf.mnFormat |= ( pSalDisp->GetVisual(nScreen).red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_RGBA : BMP_FORMAT_32BIT_TC_BGRA );
+ aSrcBuf.mnFormat |= ( pSalDisp->GetVisual(nScreen).red_mask == 0xFF
+ ? BMP_FORMAT_32BIT_TC_RGBA
+ : BMP_FORMAT_32BIT_TC_BGRA
+ );
else
- aSrcBuf.mnFormat |= ( pSalDisp->GetVisual(nScreen).red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_ABGR : BMP_FORMAT_32BIT_TC_ARGB );
-
+ aSrcBuf.mnFormat |= ( pSalDisp->GetVisual(nScreen).red_mask == 0xFF
+ ? BMP_FORMAT_32BIT_TC_ABGR
+ : BMP_FORMAT_32BIT_TC_ARGB
+ );
nDstFormat |= BMP_FORMAT_24BIT_TC_BGR;
}
break;
@@ -326,7 +350,9 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
else if( aSrcBuf.mnBitCount <= 8 )
{
const SalColormap& rColMap = pSalDisp->GetColormap( nScreen );
- const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed(), (sal_uLong)(1 << nDrawableDepth) );
+ const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed()
+ , (sal_uLong)(1 << nDrawableDepth)
+ );
rPal.SetEntryCount( nCols );
pDstPal = &rPal;
@@ -354,7 +380,12 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
// -----------------------------------------------------------------------------
-XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const
+XImage* X11SalBitmap::ImplCreateXImage(
+ SalDisplay *pSalDisp,
+ int nScreen,
+ long nDepth,
+ const SalTwoRect& rTwoRect
+) const
{
XImage* pImage = NULL;
@@ -393,11 +424,17 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long
switch( pImage->bits_per_pixel )
{
case( 1 ):
- nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_1BIT_LSB_PAL : BMP_FORMAT_1BIT_MSB_PAL );
+ nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order
+ ? BMP_FORMAT_1BIT_LSB_PAL
+ : BMP_FORMAT_1BIT_MSB_PAL
+ );
break;
case( 4 ):
- nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_4BIT_LSN_PAL : BMP_FORMAT_4BIT_MSN_PAL );
+ nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order
+ ? BMP_FORMAT_4BIT_LSN_PAL
+ : BMP_FORMAT_4BIT_MSN_PAL
+ );
break;
case( 8 ):
@@ -437,9 +474,15 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long
case( 32 ):
{
if( LSBFirst == pImage->byte_order )
- nDstFormat |= ( pImage->red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_RGBA : BMP_FORMAT_32BIT_TC_BGRA );
+ nDstFormat |= ( pImage->red_mask == 0xFF
+ ? BMP_FORMAT_32BIT_TC_RGBA
+ : BMP_FORMAT_32BIT_TC_BGRA
+ );
else
- nDstFormat |= ( pImage->red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_ABGR : BMP_FORMAT_32BIT_TC_ARGB );
+ nDstFormat |= ( pImage->red_mask == 0xFF
+ ? BMP_FORMAT_32BIT_TC_ABGR
+ : BMP_FORMAT_32BIT_TC_ARGB
+ );
}
break;
}
@@ -467,7 +510,9 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long
else if( pImage->depth <= 8 )
{
const SalColormap& rColMap = pSalDisp->GetColormap( nScreen );
- const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed(), (sal_uLong)(1 << pImage->depth) );
+ const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed()
+ , (sal_uLong)(1 << pImage->depth)
+ );
pPal = new BitmapPalette( nCols );
@@ -506,10 +551,15 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long
}
// -----------------------------------------------------------------------------
-bool X11SalBitmap::ImplCreateFromDrawable( Drawable aDrawable,
- int nScreen, long nDrawableDepth,
- long nX, long nY, long nWidth, long nHeight )
-{
+bool X11SalBitmap::ImplCreateFromDrawable(
+ Drawable aDrawable,
+ int nScreen,
+ long nDrawableDepth,
+ long nX,
+ long nY,
+ long nWidth,
+ long nHeight
+) {
Destroy();
if( aDrawable && nWidth && nHeight && nDrawableDepth )
@@ -519,8 +569,7 @@ bool X11SalBitmap::ImplCreateFromDrawable( Drawable aDrawable,
}
// -----------------------------------------------------------------------------
-bool
-X11SalBitmap::SnapShot (Display* pDisplay, XLIB_Window hWindow)
+bool X11SalBitmap::SnapShot (Display* pDisplay, XLIB_Window hWindow)
{
if (hWindow != None)
{
@@ -598,9 +647,12 @@ X11SalBitmap::SnapShot (Display* pDisplay, XLIB_Window hWindow)
return False;
}
-bool
-X11SalBitmap::ImplCreateFromXImage (Display* pDisplay, XLIB_Window hWindow, int nScreen, XImage* pImage)
-{
+bool X11SalBitmap::ImplCreateFromXImage (
+ Display* pDisplay,
+ XLIB_Window hWindow,
+ int nScreen,
+ XImage* pImage
+) {
Destroy();
if (pImage != NULL && pImage->width != 0 && pImage->height != 0 && pImage->depth != 0)
@@ -611,10 +663,12 @@ X11SalBitmap::ImplCreateFromXImage (Display* pDisplay, XLIB_Window hWindow, int
return False;
}
-ImplSalDDB* X11SalBitmap::ImplGetDDB( Drawable aDrawable,
- int nScreen,
- long nDrawableDepth,
- const SalTwoRect& rTwoRect ) const
+ImplSalDDB* X11SalBitmap::ImplGetDDB(
+ Drawable aDrawable,
+ int nScreen,
+ long nDrawableDepth,
+ const SalTwoRect& rTwoRect
+) const
{
if( !mpDDB || !mpDDB->ImplMatches( nScreen, nDrawableDepth, rTwoRect ) )
{
@@ -708,11 +762,13 @@ ImplSalDDB* X11SalBitmap::ImplGetDDB( Drawable aDrawable,
// -----------------------------------------------------------------------------
-void X11SalBitmap::ImplDraw( Drawable aDrawable,
- int nScreen,
- long nDrawableDepth,
- const SalTwoRect& rTwoRect,
- const GC& rGC ) const
+void X11SalBitmap::ImplDraw(
+ Drawable aDrawable,
+ int nScreen,
+ long nDrawableDepth,
+ const SalTwoRect& rTwoRect,
+ const GC& rGC
+) const
{
ImplGetDDB( aDrawable, nScreen, nDrawableDepth, rTwoRect );
if( mpDDB )
@@ -770,21 +826,26 @@ bool X11SalBitmap::Create( const SalBitmap& rSSalBmp )
bool X11SalBitmap::Create( const SalBitmap&, SalGraphics* )
{
- return sal_False;
+ return false;
}
// -----------------------------------------------------------------------------
bool X11SalBitmap::Create( const SalBitmap&, sal_uInt16 )
{
- return sal_False;
+ return false;
}
// -----------------------------------------------------------------------------
-bool X11SalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, Size& rSize, bool bMask )
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, ::com::sun::star::uno::UNO_QUERY );
+bool X11SalBitmap::Create(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas,
+ Size& rSize,
+ bool bMask
+) {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet >
+ xFastPropertySet( xBitmapCanvas, ::com::sun::star::uno::UNO_QUERY );
+
if( xFastPropertySet.get() ) {
sal_Int32 depth;
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > args;
@@ -794,7 +855,15 @@ bool X11SalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::s
if( ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) ) {
mbGrey = bMask;
- bool bSuccess = ImplCreateFromDrawable( pixmapHandle, 0, depth, 0, 0, (long) rSize.Width(), (long) rSize.Height() );
+ bool bSuccess = ImplCreateFromDrawable(
+ pixmapHandle,
+ 0,
+ depth,
+ 0,
+ 0,
+ (long) rSize.Width(),
+ (long) rSize.Height()
+ );
bool bFreePixmap = false;
if( bSuccess && (args[0] >>= bFreePixmap) && bFreePixmap )
XFreePixmap( GetX11SalData()->GetDisplay()->GetDisplay(), pixmapHandle );
@@ -860,10 +929,15 @@ BitmapBuffer* X11SalBitmap::AcquireBuffer( bool )
{
if( !mpDIB && mpDDB )
{
- mpDIB = ImplCreateDIB( mpDDB->ImplGetPixmap(),
- mpDDB->ImplGetScreen(),
- mpDDB->ImplGetDepth(),
- 0, 0, mpDDB->ImplGetWidth(), mpDDB->ImplGetHeight(), mbGrey );
+ mpDIB = ImplCreateDIB(
+ mpDDB->ImplGetPixmap(),
+ mpDDB->ImplGetScreen(),
+ mpDDB->ImplGetDepth(),
+ 0, 0,
+ mpDDB->ImplGetWidth(),
+ mpDDB->ImplGetHeight(),
+ mbGrey
+ );
}
return mpDIB;
@@ -905,11 +979,11 @@ bool X11SalBitmap::GetSystemData( BitmapSystemData& rData )
// - ImplSalDDB -
// --------------
-ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const SalTwoRect& rTwoRect ) :
- maPixmap ( 0 ),
- maTwoRect ( rTwoRect ),
- mnDepth ( pImage->depth ),
- mnScreen ( nScreen )
+ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const SalTwoRect& rTwoRect )
+ : maPixmap ( 0 )
+ , maTwoRect ( rTwoRect )
+ , mnDepth ( pImage->depth )
+ , mnScreen ( nScreen )
{
SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
Display* pXDisp = pSalDisp->GetDisplay();
@@ -937,8 +1011,8 @@ ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const S
// -----------------------------------------------------------------------------------------
// create from XImage
-ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, int nScreen, XImage* pImage) :
- mnScreen( nScreen )
+ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, int nScreen, XImage* pImage)
+ : mnScreen( nScreen )
{
maPixmap = XCreatePixmap (pDisplay, hWindow, pImage->width, pImage->height, pImage->depth);
if (maPixmap != 0)
@@ -975,9 +1049,16 @@ ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, int nScreen, XIm
// -----------------------------------------------------------------------------
-ImplSalDDB::ImplSalDDB( Drawable aDrawable, int nScreen, long nDrawableDepth, long nX, long nY, long nWidth, long nHeight ) :
- mnDepth( nDrawableDepth ),
- mnScreen( nScreen )
+ImplSalDDB::ImplSalDDB(
+ Drawable aDrawable,
+ int nScreen,
+ long nDrawableDepth,
+ long nX,
+ long nY,
+ long nWidth,
+ long nHeight
+) : mnDepth( nDrawableDepth )
+ , mnScreen( nScreen )
{
SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
Display* pXDisp = pSalDisp->GetDisplay();
@@ -1019,24 +1100,32 @@ ImplSalDDB::~ImplSalDDB()
bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const
{
- bool bRet = sal_False;
+ bool bRet = false;
if( ( maPixmap != 0 ) && ( ( mnDepth == nDepth ) || ( 1 == mnDepth ) ) && nScreen == mnScreen)
{
- if( rTwoRect.mnSrcX == maTwoRect.mnSrcX && rTwoRect.mnSrcY == maTwoRect.mnSrcY &&
- rTwoRect.mnSrcWidth == maTwoRect.mnSrcWidth && rTwoRect.mnSrcHeight == maTwoRect.mnSrcHeight &&
- rTwoRect.mnDestWidth == maTwoRect.mnDestWidth && rTwoRect.mnDestHeight == maTwoRect.mnDestHeight )
+ if ( rTwoRect.mnSrcX == maTwoRect.mnSrcX
+ && rTwoRect.mnSrcY == maTwoRect.mnSrcY
+ && rTwoRect.mnSrcWidth == maTwoRect.mnSrcWidth
+ && rTwoRect.mnSrcHeight == maTwoRect.mnSrcHeight
+ && rTwoRect.mnDestWidth == maTwoRect.mnDestWidth
+ && rTwoRect.mnDestHeight == maTwoRect.mnDestHeight
+ )
{
// absolutely indentically
- bRet = sal_True;
+ bRet = true;
}
- else if( rTwoRect.mnSrcWidth == rTwoRect.mnDestWidth && rTwoRect.mnSrcHeight == rTwoRect.mnDestHeight &&
- maTwoRect.mnSrcWidth == maTwoRect.mnDestWidth && maTwoRect.mnSrcHeight == maTwoRect.mnDestHeight &&
- rTwoRect.mnSrcX >= maTwoRect.mnSrcX && rTwoRect.mnSrcY >= maTwoRect.mnSrcY &&
- ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) <= ( maTwoRect.mnSrcX + maTwoRect.mnSrcWidth ) &&
- ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) <= ( maTwoRect.mnSrcY + maTwoRect.mnSrcHeight ) )
+ else if( rTwoRect.mnSrcWidth == rTwoRect.mnDestWidth
+ && rTwoRect.mnSrcHeight == rTwoRect.mnDestHeight
+ && maTwoRect.mnSrcWidth == maTwoRect.mnDestWidth
+ && maTwoRect.mnSrcHeight == maTwoRect.mnDestHeight
+ && rTwoRect.mnSrcX >= maTwoRect.mnSrcX
+ && rTwoRect.mnSrcY >= maTwoRect.mnSrcY
+ && ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) <= ( maTwoRect.mnSrcX + maTwoRect.mnSrcWidth )
+ && ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) <= ( maTwoRect.mnSrcY + maTwoRect.mnSrcHeight )
+ )
{
- bRet = sal_True;
+ bRet = true;
}
}
@@ -1045,7 +1134,12 @@ bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRe
// -----------------------------------------------------------------------------
-void ImplSalDDB::ImplDraw( Drawable aDrawable, long nDrawableDepth, const SalTwoRect& rTwoRect, const GC& rGC ) const
+void ImplSalDDB::ImplDraw(
+ Drawable aDrawable,
+ long nDrawableDepth,
+ const SalTwoRect& rTwoRect,
+ const GC& rGC
+) const
{
ImplDraw( maPixmap, mnDepth, aDrawable, nDrawableDepth,
rTwoRect.mnSrcX - maTwoRect.mnSrcX, rTwoRect.mnSrcY - maTwoRect.mnSrcY,
@@ -1055,12 +1149,19 @@ void ImplSalDDB::ImplDraw( Drawable aDrawable, long nDrawableDepth, const SalTwo
// -----------------------------------------------------------------------------
-void ImplSalDDB::ImplDraw( Drawable aSrcDrawable, long nSrcDrawableDepth,
- Drawable aDstDrawable, long,
- long nSrcX, long nSrcY,
- long nDestWidth, long nDestHeight,
- long nDestX, long nDestY, const GC& rGC )
-{
+void ImplSalDDB::ImplDraw(
+ Drawable aSrcDrawable,
+ long nSrcDrawableDepth,
+ Drawable aDstDrawable,
+ long,
+ long nSrcX,
+ long nSrcY,
+ long nDestWidth,
+ long nDestHeight,
+ long nDestX,
+ long nDestY,
+ const GC& rGC
+) {
SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
Display* pXDisp = pSalDisp->GetDisplay();
@@ -1108,12 +1209,18 @@ ImplSalBitmapCache::~ImplSalBitmapCache()
void ImplSalBitmapCache::ImplAdd( X11SalBitmap* pBmp, sal_uLong nMemSize, sal_uLong nFlags )
{
- ImplBmpObj* pObj;
- bool bFound = sal_False;
-
- for( pObj = (ImplBmpObj*) maBmpList.Last(); pObj && !bFound; pObj = (ImplBmpObj*) maBmpList.Prev() )
+ ImplBmpObj* pObj = NULL;
+ bool bFound = false;
+
+ for(
+ BmpList_impl::iterator it = maBmpList.begin();
+ (it != maBmpList.end() ) && !bFound ;
+ ++it
+ ) {
+ pObj = *it;
if( pObj->mpBmp == pBmp )
- bFound = sal_True;
+ bFound = true;
+ }
mnTotalSize += nMemSize;
@@ -1123,21 +1230,24 @@ void ImplSalBitmapCache::ImplAdd( X11SalBitmap* pBmp, sal_uLong nMemSize, sal_uL
pObj->mnMemSize = nMemSize, pObj->mnFlags = nFlags;
}
else
- maBmpList.Insert( new ImplBmpObj( pBmp, nMemSize, nFlags ), LIST_APPEND );
+ maBmpList.push_back( new ImplBmpObj( pBmp, nMemSize, nFlags ) );
}
// -----------------------------------------------------------------------------
void ImplSalBitmapCache::ImplRemove( X11SalBitmap* pBmp )
{
- for( ImplBmpObj* pObj = (ImplBmpObj*) maBmpList.Last(); pObj; pObj = (ImplBmpObj*) maBmpList.Prev() )
- {
- if( pObj->mpBmp == pBmp )
+ for(
+ BmpList_impl::iterator it = maBmpList.begin();
+ it != maBmpList.end();
+ ++it
+ ) {
+ if( (*it)->mpBmp == pBmp )
{
- maBmpList.Remove( pObj );
- pObj->mpBmp->ImplRemovedFromCache();
- mnTotalSize -= pObj->mnMemSize;
- delete pObj;
+ (*it)->mpBmp->ImplRemovedFromCache();
+ mnTotalSize -= (*it)->mnMemSize;
+ delete *it;
+ maBmpList.erase( it );
break;
}
}
@@ -1147,13 +1257,15 @@ void ImplSalBitmapCache::ImplRemove( X11SalBitmap* pBmp )
void ImplSalBitmapCache::ImplClear()
{
- for( ImplBmpObj* pObj = (ImplBmpObj*) maBmpList.First(); pObj; pObj = (ImplBmpObj*) maBmpList.Next() )
- {
- pObj->mpBmp->ImplRemovedFromCache();
- delete pObj;
+ for(
+ BmpList_impl::iterator it = maBmpList.begin();
+ it != maBmpList.end();
+ ++it
+ ) {
+ (*it)->mpBmp->ImplRemovedFromCache();
+ delete *it;
}
-
- maBmpList.Clear();
+ maBmpList.clear();
mnTotalSize = 0;
}
diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx
index dce2e5ccb793..4934ed7f83fa 100644
--- a/vcl/unx/generic/gdi/salgdi3.cxx
+++ b/vcl/unx/generic/gdi/salgdi3.cxx
@@ -78,28 +78,21 @@
#include "salframe.hxx"
#include "outdev.h"
-
-
#ifdef ENABLE_GRAPHITE
#include <graphite_layout.hxx>
#include <graphite_serverfont.hxx>
#endif
-struct cairo_surface_t;
-struct cairo_t;
-struct cairo_font_face_t;
-typedef void* FT_Face;
-struct cairo_matrix_t {
- double xx; double yx;
- double xy; double yy;
- double x0; double y0;
-};
-struct cairo_glyph_t
-{
- unsigned long index;
- double x;
- double y;
-};
+#ifdef SYSTEM_CAIRO
+#include <cairo.h>
+#include <cairo-ft.h>
+#include <cairo-xlib-xrender.h>
+#else
+#include <cairo/cairo.h>
+#include <cairo/cairo-ft.h>
+#include <cairo/cairo-xlib-xrender.h>
+#endif
+
struct BOX
{
short x1, x2, y1, y2;
@@ -249,179 +242,12 @@ void ImplServerFontEntry::HandleFontOptions( void )
//--------------------------------------------------------------------------
-namespace {
-
-class CairoWrapper
-{
-private:
- osl::Module mpCairoLib;
-
- cairo_surface_t* (*mp_xlib_surface_create_with_xrender_format)(Display *, Drawable , Screen *, XRenderPictFormat *, int , int );
- void (*mp_surface_destroy)(cairo_surface_t *);
- cairo_t* (*mp_create)(cairo_surface_t *);
- void (*mp_destroy)(cairo_t*);
- void (*mp_clip)(cairo_t*);
- void (*mp_rectangle)(cairo_t*, double, double, double, double);
- cairo_font_face_t * (*mp_ft_font_face_create_for_ft_face)(FT_Face, int);
- cairo_font_face_t * (*mp_ft_font_face_create_for_pattern)(void*);
- void (*mp_set_font_face)(cairo_t *, cairo_font_face_t *);
- void (*mp_font_face_destroy)(cairo_font_face_t *);
- void (*mp_matrix_init_identity)(cairo_matrix_t *);
- void (*mp_matrix_scale)(cairo_matrix_t *, double, double);
- void (*mp_matrix_rotate)(cairo_matrix_t *, double);
- void (*mp_set_font_matrix)(cairo_t *, const cairo_matrix_t *);
- void (*mp_show_glyphs)(cairo_t *, const cairo_glyph_t *, int );
- void (*mp_set_source_rgb)(cairo_t *, double , double , double );
- void (*mp_set_font_options)(cairo_t *, const void *);
- void (*mp_ft_font_options_substitute)(const void*, void*);
-
- bool canEmbolden() const { return mp_ft_font_face_create_for_pattern != NULL; }
-
- CairoWrapper();
-public:
- static CairoWrapper& get();
- bool isValid() const { return (mpCairoLib != NULL); }
- bool isCairoRenderable(const ServerFont& rFont);
-
- cairo_surface_t* xlib_surface_create_with_xrender_format(Display *pDisplay, Drawable drawable, Screen *pScreen, XRenderPictFormat *pFormat, int width, int height)
- { return (*mp_xlib_surface_create_with_xrender_format)(pDisplay, drawable, pScreen, pFormat, width, height); }
- void surface_destroy(cairo_surface_t *surface) { (*mp_surface_destroy)(surface); }
- cairo_t* create(cairo_surface_t *surface) { return (*mp_create)(surface); }
- void destroy(cairo_t *cr) { (*mp_destroy)(cr); }
- void clip(cairo_t *cr) { (*mp_clip)(cr); }
- void rectangle(cairo_t *cr, double x, double y, double width, double height)
- { (*mp_rectangle)(cr, x, y, width, height); }
- cairo_font_face_t* ft_font_face_create_for_ft_face(FT_Face face, int load_flags)
- { return (*mp_ft_font_face_create_for_ft_face)(face, load_flags); }
- cairo_font_face_t* ft_font_face_create_for_pattern(void *pattern)
- {
- return mp_ft_font_face_create_for_pattern
- ? (*mp_ft_font_face_create_for_pattern)(pattern)
- : NULL;
- }
- void set_font_face(cairo_t *cr, cairo_font_face_t *font_face)
- { (*mp_set_font_face)(cr, font_face); }
- void font_face_destroy(cairo_font_face_t *font_face)
- { (*mp_font_face_destroy)(font_face); }
- void matrix_init_identity(cairo_matrix_t *matrix)
- { (*mp_matrix_init_identity)(matrix); }
- void matrix_scale(cairo_matrix_t *matrix, double sx, double sy)
- { (*mp_matrix_scale)(matrix, sx, sy); }
- void matrix_rotate(cairo_matrix_t *matrix, double radians)
- { (*mp_matrix_rotate)(matrix, radians); }
- void set_font_matrix(cairo_t *cr, const cairo_matrix_t *matrix)
- { (*mp_set_font_matrix)(cr, matrix); }
- void show_glyphs(cairo_t *cr, const cairo_glyph_t *glyphs, int no_glyphs)
- { (*mp_show_glyphs)(cr, glyphs, no_glyphs); }
- void set_source_rgb(cairo_t *cr, double red, double green, double blue)
- { (*mp_set_source_rgb)(cr, red, green, blue); }
- void set_font_options(cairo_t *cr, const void *options)
- { (*mp_set_font_options)(cr, options); }
- void ft_font_options_substitute(const void *options, void *pattern)
- { (*mp_ft_font_options_substitute)(options, pattern); }
-};
-
-static CairoWrapper* pCairoInstance = NULL;
-
-CairoWrapper& CairoWrapper::get()
-{
- if( ! pCairoInstance )
- pCairoInstance = new CairoWrapper();
- return *pCairoInstance;
-}
-
-CairoWrapper::CairoWrapper()
+namespace
{
- static const char* pDisableCairoText = getenv( "SAL_DISABLE_CAIROTEXT" );
- if( pDisableCairoText && (pDisableCairoText[0] != '0') )
- return;
-
- int nDummy;
- if( !XQueryExtension( GetX11SalData()->GetDisplay()->GetDisplay(), "RENDER", &nDummy, &nDummy, &nDummy ) )
- return;
-
- OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libcairo.so.2" ));
- if ( !mpCairoLib.load( aLibName, SAL_LOADMODULE_DEFAULT ) )
- return;
-
-#ifdef DEBUG
- // check cairo version
- int (*p_version)();
- p_version = (int(*)()) osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_version" );
- const int nVersion = p_version ? (*p_version)() : 0;
- fprintf( stderr, "CAIRO version=%d\n", nVersion );
-#endif
-
- mp_xlib_surface_create_with_xrender_format = (cairo_surface_t* (*)(Display *, Drawable , Screen *, XRenderPictFormat *, int , int ))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_xlib_surface_create_with_xrender_format" );
- mp_surface_destroy = (void(*)(cairo_surface_t*))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_surface_destroy" );
- mp_create = (cairo_t*(*)(cairo_surface_t*))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_create" );
- mp_destroy = (void(*)(cairo_t*))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_destroy" );
- mp_clip = (void(*)(cairo_t*))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_clip" );
- mp_rectangle = (void(*)(cairo_t*, double, double, double, double))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_rectangle" );
- mp_ft_font_face_create_for_ft_face = (cairo_font_face_t * (*)(FT_Face, int))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_face_create_for_ft_face" );
- mp_ft_font_face_create_for_pattern = (cairo_font_face_t * (*)(void*))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_face_create_for_pattern" );
- mp_set_font_face = (void (*)(cairo_t *, cairo_font_face_t *))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_face" );
- mp_font_face_destroy = (void (*)(cairo_font_face_t *))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_font_face_destroy" );
- mp_matrix_init_identity = (void (*)(cairo_matrix_t *))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_init_identity" );
- mp_matrix_scale = (void (*)(cairo_matrix_t *, double, double))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_scale" );
- mp_matrix_rotate = (void (*)(cairo_matrix_t *, double))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_matrix_rotate" );
- mp_set_font_matrix = (void (*)(cairo_t *, const cairo_matrix_t *))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_matrix" );
- mp_show_glyphs = (void (*)(cairo_t *, const cairo_glyph_t *, int ))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_show_glyphs" );
- mp_set_source_rgb = (void (*)(cairo_t *, double , double , double ))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_source_rgb" );
- mp_set_font_options = (void (*)(cairo_t *, const void *options ))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_options" );
- mp_ft_font_options_substitute = (void (*)(const void *, void *))
- osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_options_substitute" );
-
- if( !(
- mp_xlib_surface_create_with_xrender_format &&
- mp_surface_destroy &&
- mp_create &&
- mp_destroy &&
- mp_clip &&
- mp_rectangle &&
- mp_ft_font_face_create_for_ft_face &&
- mp_set_font_face &&
- mp_font_face_destroy &&
- mp_matrix_init_identity &&
- mp_matrix_scale &&
- mp_matrix_rotate &&
- mp_set_font_matrix &&
- mp_show_glyphs &&
- mp_set_source_rgb &&
- mp_set_font_options &&
- mp_ft_font_options_substitute
- ) )
+ bool isCairoRenderable(const ServerFont& rFont)
{
- mpCairoLib.unload();
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "not all needed symbols were found\n" );
-#endif
+ return rFont.GetFtFace();
}
-}
-
-bool CairoWrapper::isCairoRenderable(const ServerFont& rFont)
-{
- return rFont.GetFtFace() && isValid() && rFont.GetAntialiasAdvice() &&
- (rFont.NeedsArtificialBold() ? canEmbolden() : true);
-}
-
} //namespace
CairoFontsCache::LRUFonts CairoFontsCache::maLRUFonts;
@@ -437,10 +263,9 @@ CairoFontsCache::~CairoFontsCache()
--mnRefCount;
if (!mnRefCount && !maLRUFonts.empty())
{
- CairoWrapper &rCairo = CairoWrapper::get();
LRUFonts::iterator aEnd = maLRUFonts.end();
for (LRUFonts::iterator aI = maLRUFonts.begin(); aI != aEnd; ++aI)
- rCairo.font_face_destroy((cairo_font_face_t*)aI->first);
+ cairo_font_face_destroy((cairo_font_face_t*)aI->first);
}
}
@@ -449,8 +274,7 @@ void CairoFontsCache::CacheFont(void *pFont, const CairoFontsCache::CacheId &rId
maLRUFonts.push_front( std::pair<void*, CairoFontsCache::CacheId>(pFont, rId) );
if (maLRUFonts.size() > 8)
{
- CairoWrapper &rCairo = CairoWrapper::get();
- rCairo.font_face_destroy((cairo_font_face_t*)maLRUFonts.back().first);
+ cairo_font_face_destroy((cairo_font_face_t*)maLRUFonts.back().first);
maLRUFonts.pop_back();
}
}
@@ -464,9 +288,18 @@ void* CairoFontsCache::FindCachedFont(const CairoFontsCache::CacheId &rId)
return NULL;
}
+namespace
+{
+ bool hasRotation(int nRotation)
+ {
+ return nRotation != 0;
+ }
+}
+
void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
{
std::vector<cairo_glyph_t> cairo_glyphs;
+ std::vector<int> glyph_extrarotation;
cairo_glyphs.reserve( 256 );
Point aPos;
@@ -478,6 +311,19 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
aGlyph.x = aPos.X();
aGlyph.y = aPos.Y();
cairo_glyphs.push_back(aGlyph);
+
+ switch (aGlyphId & GF_ROTMASK)
+ {
+ case GF_ROTL: // left
+ glyph_extrarotation.push_back(900);
+ break;
+ case GF_ROTR: // right
+ glyph_extrarotation.push_back(-900);
+ break;
+ default:
+ glyph_extrarotation.push_back(0);
+ break;
+ }
}
if (cairo_glyphs.empty())
@@ -489,11 +335,9 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
if( !pVisualFormat )
return;
- CairoWrapper &rCairo = CairoWrapper::get();
-
Display* pDisplay = GetXDisplay();
- cairo_surface_t *surface = rCairo.xlib_surface_create_with_xrender_format (pDisplay,
+ cairo_surface_t *surface = cairo_xlib_surface_create_with_xrender_format (pDisplay,
hDrawable_, ScreenOfDisplay(pDisplay, m_nScreen), pVisualFormat, SAL_MAX_INT16, SAL_MAX_INT16);
/*
@@ -502,26 +346,26 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
* least change the SalFrame etc impls to dtor the SalGraphics *before* the
* destruction of the windows they reference
*/
- cairo_t *cr = rCairo.create(surface);
- rCairo.surface_destroy(surface);
+ cairo_t *cr = cairo_create(surface);
+ cairo_surface_destroy(surface);
if (const void *pOptions = Application::GetSettings().GetStyleSettings().GetCairoFontOptions())
- rCairo.set_font_options( cr, pOptions);
+ cairo_set_font_options(cr, static_cast<const cairo_font_options_t*>(pOptions));
if( mpClipRegion && !XEmptyRegion( mpClipRegion ) )
{
for (long i = 0; i < mpClipRegion->numRects; ++i)
{
- rCairo.rectangle(cr,
- mpClipRegion->rects[i].x1,
- mpClipRegion->rects[i].y1,
- mpClipRegion->rects[i].x2 - mpClipRegion->rects[i].x1,
- mpClipRegion->rects[i].y2 - mpClipRegion->rects[i].y1);
+ cairo_rectangle(cr,
+ mpClipRegion->rects[i].x1,
+ mpClipRegion->rects[i].y1,
+ mpClipRegion->rects[i].x2 - mpClipRegion->rects[i].x1,
+ mpClipRegion->rects[i].y2 - mpClipRegion->rects[i].y1);
}
- rCairo.clip(cr);
+ cairo_clip(cr);
}
- rCairo.set_source_rgb(cr,
+ cairo_set_source_rgb(cr,
SALCOLOR_RED(nTextColor_)/255.0,
SALCOLOR_GREEN(nTextColor_)/255.0,
SALCOLOR_BLUE(nTextColor_)/255.0);
@@ -541,30 +385,67 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
const ImplFontOptions *pOptions = rFont.GetFontOptions().get();
void *pPattern = pOptions ? pOptions->GetPattern(pFace, aId.mbEmbolden) : NULL;
if (pPattern)
- font_face = rCairo.ft_font_face_create_for_pattern(pPattern);
+ font_face = cairo_ft_font_face_create_for_pattern(reinterpret_cast<FcPattern*>(pPattern));
if (!font_face)
- font_face = rCairo.ft_font_face_create_for_ft_face(pFace, rFont.GetLoadFlags());
+ font_face = cairo_ft_font_face_create_for_ft_face(reinterpret_cast<FT_Face>(pFace), rFont.GetLoadFlags());
m_aCairoFontsCache.CacheFont(font_face, aId);
}
- rCairo.set_font_face(cr, font_face);
+ cairo_set_font_face(cr, font_face);
cairo_matrix_t m;
const ImplFontSelectData& rFSD = rFont.GetFontSelData();
- int nWidth = rFSD.mnWidth ? rFSD.mnWidth : rFSD.mnHeight;
+ int nHeight = rFSD.mnHeight;
+ int nWidth = rFSD.mnWidth ? rFSD.mnWidth : nHeight;
+
+ std::vector<int>::const_iterator aEnd = glyph_extrarotation.end();
+ std::vector<int>::const_iterator aStart = glyph_extrarotation.begin();
+ std::vector<int>::const_iterator aI = aStart;
+ while (aI != aEnd)
+ {
+ int nGlyphRotation = *aI;
+
+ std::vector<int>::const_iterator aNext = std::find_if(aI+1, aEnd, hasRotation);
+
+ cairo_matrix_init_identity(&m);
+
+ if (rFont.NeedsArtificialItalic())
+ m.xy = -m.xx * 0x6000L / 0x10000L;
+
+ if (rLayout.GetOrientation())
+ cairo_matrix_rotate(&m, (3600 - rLayout.GetOrientation()) * M_PI / 1800.0);
- rCairo.matrix_init_identity(&m);
+ cairo_matrix_scale(&m, nWidth, nHeight);
- if (rLayout.GetOrientation())
- rCairo.matrix_rotate(&m, (3600 - rLayout.GetOrientation()) * M_PI / 1800.0);
+ if (nGlyphRotation)
+ {
+ cairo_matrix_rotate(&m, (3600 - nGlyphRotation) * M_PI / 1800.0);
+
+ cairo_font_extents_t extents;
+ cairo_font_extents(cr, &extents);
+ //gives the same positions as pre-cairo conversion, but I don't like them
+ double xdiff = -extents.descent/(extents.height+extents.descent);
+ cairo_matrix_translate(&m, xdiff, 1);
+ }
- rCairo.matrix_scale(&m, nWidth, rFSD.mnHeight);
- if (rFont.NeedsArtificialItalic())
- m.xy = -m.xx * 0x6000L / 0x10000L;
+ cairo_set_font_matrix(cr, &m);
+ size_t nStartIndex = std::distance(aStart, aI);
+ size_t nLen = std::distance(aI, aNext);
+ cairo_show_glyphs(cr, &cairo_glyphs[nStartIndex], nLen);
+
+#if OSL_DEBUG_LEVEL > 2
+ //draw origin
+ cairo_save (cr);
+ cairo_rectangle (cr, cairo_glyphs[nStartIndex].x, cairo_glyphs[nStartIndex].y, 5, 5);
+ cairo_set_source_rgba (cr, 1, 0, 0, 0.80);
+ cairo_fill (cr);
+ cairo_restore (cr);
+#endif
- rCairo.set_font_matrix(cr, &m);
- rCairo.show_glyphs(cr, &cairo_glyphs[0], cairo_glyphs.size());
- rCairo.destroy(cr);
+ aI = aNext;
+ }
+
+ cairo_destroy(cr);
}
//--------------------------------------------------------------------------
@@ -924,7 +805,7 @@ void X11SalGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout )
ServerFont& rFont = rLayout.GetServerFont();
const bool bVertical = rFont.GetFontSelData().mbVertical;
- if( !bVertical && CairoWrapper::get().isCairoRenderable(rFont) )
+ if( !bVertical && isCairoRenderable(rFont) )
DrawCairoAAFontString( rLayout );
else
{
@@ -1083,16 +964,14 @@ void X11SalGraphics::GetDevFontSubstList( OutputDevice* )
// ----------------------------------------------------------------------------
-void cairosubcallback( void* pPattern )
+void cairosubcallback(void* pPattern)
{
- CairoWrapper& rCairo = CairoWrapper::get();
- if( !rCairo.isValid() )
- return;
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
const void* pFontOptions = rStyleSettings.GetCairoFontOptions();
if( !pFontOptions )
return;
- rCairo.ft_font_options_substitute( pFontOptions, pPattern );
+ cairo_ft_font_options_substitute(static_cast<const cairo_font_options_t*>(pFontOptions),
+ static_cast<FcPattern*>(pPattern));
}
ImplFontOptions* GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize)
diff --git a/vcl/unx/generic/gdi/salprnpsp.cxx b/vcl/unx/generic/gdi/salprnpsp.cxx
index 009621a9e22e..dbee65c589dc 100644
--- a/vcl/unx/generic/gdi/salprnpsp.cxx
+++ b/vcl/unx/generic/gdi/salprnpsp.cxx
@@ -271,11 +271,16 @@ static bool passFileToCommandLine( const String& rFilename, const String& rComma
close( fd[0] );
char aBuffer[ 2048 ];
FILE* fp = fopen( aFilename.GetBuffer(), "r" );
- while( fp && ! feof( fp ) )
+ while (fp && !feof(fp))
{
- int nBytes = fread( aBuffer, 1, sizeof( aBuffer ), fp );
- if( nBytes )
- write( fd[ 1 ], aBuffer, nBytes );
+ size_t nBytesRead = fread(aBuffer, 1, sizeof( aBuffer ), fp);
+ if (nBytesRead )
+ {
+ size_t nBytesWritten = write(fd[1], aBuffer, nBytesRead);
+ OSL_ENSURE(nBytesWritten == nBytesRead, "short write");
+ if (nBytesWritten != nBytesRead)
+ break;
+ }
}
fclose( fp );
close( fd[ 1 ] );
@@ -1342,7 +1347,12 @@ sal_Bool PspSalPrinter::StartJob( const String* i_pFileName, const String& i_rJo
{
osl_readFile( pFile, &buffer[0], buffer.size(), &nBytesRead );
if( nBytesRead > 0 )
- fwrite( &buffer[0], 1, nBytesRead, fp );
+ {
+ size_t nBytesWritten = fwrite(&buffer[0], 1, nBytesRead, fp);
+ OSL_ENSURE(nBytesRead == nBytesWritten, "short write");
+ if (nBytesRead != nBytesWritten)
+ break;
+ }
} while( nBytesRead == buffer.size() );
rtl::OUStringBuffer aBuf( i_rJobName.Len() + 8 );
aBuf.append( i_rJobName );
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx
index 3235aa9a58fa..8cadab79b0a7 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -272,7 +272,7 @@ void SalAbort( const XubString& rErrorText )
if( !rErrorText.Len() )
std::fprintf( stderr, "Application Error\n" );
else
- std::fprintf( stderr, "%s\n", ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() );
+ std::fprintf( stderr, "%s\n", rtl::OUStringToOString(rErrorText, gsl_getSystemTextEncoding()).getStr() );
exit(-1);
}
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index a850ec14bb28..1e8c378c8166 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -436,7 +436,7 @@ extern "C"
{
static void lcl_signal_action(int nSignal)
{
- fprintf( stderr, "Signal %d during fontconfig initialization called, ignoring fontconfig\n", nSignal );
+ fprintf( stderr, "Signal %d during cups initialization called, ignoring cups\n", nSignal );
siglongjmp( aViolationBuffer, 1 );
}
}
diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx
index 03d676470ecb..872e880adc61 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -34,7 +34,8 @@
#include "tools/stream.hxx"
-#include "sal/alloca.h"
+#include <sal/alloca.h>
+#include <rtl/strbuf.hxx>
using namespace psp;
@@ -122,48 +123,52 @@ bool JobData::getStreamBuffer( void*& pData, int& bytes )
return false;
SvMemoryStream aStream;
- ByteString aLine;
// write header job data
aStream.WriteLine( "JobData 1" );
- aLine = "printer=";
- aLine += ByteString( String( m_aPrinterName ), RTL_TEXTENCODING_UTF8 );
- aStream.WriteLine( aLine );
+ rtl::OStringBuffer aLine;
+
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("printer="));
+ aLine.append(rtl::OUStringToOString(m_aPrinterName, RTL_TEXTENCODING_UTF8));
+ aStream.WriteLine(aLine.makeStringAndClear());
- aLine = "orientation=";
- aLine += m_eOrientation == orientation::Landscape ? "Landscape" : "Portrait";
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("orientation="));
+ if (m_eOrientation == orientation::Landscape)
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("Landscape"));
+ else
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("Portrait"));
+ aStream.WriteLine(aLine.makeStringAndClear());
- aLine = "copies=";
- aLine += ByteString::CreateFromInt32( m_nCopies );
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("copies="));
+ aLine.append(static_cast<sal_Int32>(m_nCopies));
+ aStream.WriteLine(aLine.makeStringAndClear());
- aLine = "margindajustment=";
- aLine += ByteString::CreateFromInt32( m_nLeftMarginAdjust );
- aLine += ',';
- aLine += ByteString::CreateFromInt32( m_nRightMarginAdjust );
- aLine += ',';
- aLine += ByteString::CreateFromInt32( m_nTopMarginAdjust );
- aLine += ',';
- aLine += ByteString::CreateFromInt32( m_nBottomMarginAdjust );
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("margindajustment="));
+ aLine.append(static_cast<sal_Int32>(m_nLeftMarginAdjust));
+ aLine.append(',');
+ aLine.append(static_cast<sal_Int32>(m_nRightMarginAdjust));
+ aLine.append(',');
+ aLine.append(static_cast<sal_Int32>(m_nTopMarginAdjust));
+ aLine.append(',');
+ aLine.append(static_cast<sal_Int32>(m_nBottomMarginAdjust));
+ aStream.WriteLine(aLine.makeStringAndClear());
- aLine = "colordepth=";
- aLine += ByteString::CreateFromInt32( m_nColorDepth );
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("colordepth="));
+ aLine.append(static_cast<sal_Int32>(m_nColorDepth));
+ aStream.WriteLine(aLine.makeStringAndClear());
- aLine = "pslevel=";
- aLine += ByteString::CreateFromInt32( m_nPSLevel );
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("pslevel="));
+ aLine.append(static_cast<sal_Int32>(m_nPSLevel));
+ aStream.WriteLine(aLine.makeStringAndClear());
- aLine = "pdfdevice=";
- aLine += ByteString::CreateFromInt32( m_nPDFDevice );
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("pdfdevice="));
+ aLine.append(static_cast<sal_Int32>(m_nPDFDevice));
+ aStream.WriteLine(aLine.makeStringAndClear());
- aLine = "colordevice=";
- aLine += ByteString::CreateFromInt32( m_nColorDevice );
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("colordevice="));
+ aLine.append(static_cast<sal_Int32>(m_nColorDevice));
+ aStream.WriteLine(aLine.makeStringAndClear());
// now append the PPDContext stream buffer
aStream.WriteLine( "PPDContexData" );
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 3246e18fc806..91643d6646b2 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -696,7 +696,7 @@ PPDParser::PPDParser( const String& rFile ) :
m_pTranslator( new PPDTranslator() )
{
// read in the file
- std::list< ByteString > aLines;
+ std::list< rtl::OString > aLines;
PPDDecompressStream aStream( m_aFile );
bool bLanguageEncoding = false;
if( aStream.IsOpen() )
@@ -897,11 +897,11 @@ static sal_uInt8 getNibble( sal_Char cChar )
return nRet;
}
-String PPDParser::handleTranslation( const ByteString& i_rString, bool bIsGlobalized )
+String PPDParser::handleTranslation(const rtl::OString& i_rString, bool bIsGlobalized)
{
- int nOrigLen = i_rString.Len();
+ sal_Int32 nOrigLen = i_rString.getLength();
OStringBuffer aTrans( nOrigLen );
- const sal_Char* pStr = i_rString.GetBuffer();
+ const sal_Char* pStr = i_rString.getStr();
const sal_Char* pEnd = pStr + nOrigLen;
while( pStr < pEnd )
{
@@ -923,9 +923,9 @@ String PPDParser::handleTranslation( const ByteString& i_rString, bool bIsGlobal
return OStringToOUString( aTrans.makeStringAndClear(), bIsGlobalized ? RTL_TEXTENCODING_UTF8 : m_aFileEncoding );
}
-void PPDParser::parse( ::std::list< ByteString >& rLines )
+void PPDParser::parse( ::std::list< rtl::OString >& rLines )
{
- std::list< ByteString >::iterator line = rLines.begin();
+ std::list< rtl::OString >::iterator line = rLines.begin();
PPDParser::hash_type::const_iterator keyit;
while( line != rLines.end() )
{
@@ -1027,7 +1027,7 @@ void PPDParser::parse( ::std::list< ByteString >& rLines )
{
// copy the newlines also
aLine += '\n';
- aLine += *line;
+ aLine += ByteString(*line);
++line;
}
}
@@ -1142,7 +1142,9 @@ void PPDParser::parse( ::std::list< ByteString >& rLines )
if( nPos != STRING_NOTFOUND )
{
aKey.Erase( nPos );
- String aOption( WhitespaceToSpace( aLine.Copy( nPos+9 ) ), RTL_TEXTENCODING_MS_1252 );
+ rtl::OUString aOption(rtl::OStringToOUString(
+ WhitespaceToSpace(aLine.Copy(nPos+9)),
+ RTL_TEXTENCODING_MS_1252));
keyit = m_aKeys.find( aKey );
if( keyit != m_aKeys.end() )
{
@@ -1171,7 +1173,7 @@ void PPDParser::parse( ::std::list< ByteString >& rLines )
}
}
-void PPDParser::parseOpenUI( const ByteString& rLine )
+void PPDParser::parseOpenUI(const rtl::OString& rLine)
{
String aTranslation;
ByteString aKey = rLine;
@@ -1202,7 +1204,8 @@ void PPDParser::parseOpenUI( const ByteString& rLine )
pKey->m_bUIOption = true;
m_pTranslator->insertKey( pKey->getKey(), aTranslation );
- ByteString aValue = WhitespaceToSpace( rLine.GetToken( 1, ':' ) );
+ sal_Int32 nIndex = 0;
+ ByteString aValue = WhitespaceToSpace( rLine.getToken( 1, ':', nIndex ) );
if( aValue.CompareIgnoreCaseToAscii( "boolean" ) == COMPARE_EQUAL )
pKey->m_eUIType = PPDKey::Boolean;
else if( aValue.CompareIgnoreCaseToAscii( "pickmany" ) == COMPARE_EQUAL )
@@ -1211,16 +1214,16 @@ void PPDParser::parseOpenUI( const ByteString& rLine )
pKey->m_eUIType = PPDKey::PickOne;
}
-void PPDParser::parseOrderDependency( const ByteString& rLine )
+void PPDParser::parseOrderDependency(const rtl::OString& rLine)
{
- ByteString aLine( rLine );
- int nPos = aLine.Search( ':' );
- if( nPos != STRING_NOTFOUND )
- aLine.Erase( 0, nPos+1 );
+ rtl::OString aLine(rLine);
+ sal_Int32 nPos = aLine.indexOf(':');
+ if( nPos != -1 )
+ aLine = aLine.copy( nPos+1 );
- int nOrder = GetCommandLineToken( 0, aLine ).ToInt32();
+ sal_Int32 nOrder = GetCommandLineToken( 0, aLine ).toInt32();
ByteString aSetup = GetCommandLineToken( 1, aLine );
- String aKey( GetCommandLineToken( 2, aLine ), RTL_TEXTENCODING_MS_1252 );
+ String aKey(rtl::OStringToOUString(GetCommandLineToken(2, aLine), RTL_TEXTENCODING_MS_1252));
if( aKey.GetChar( 0 ) != '*' )
return; // invalid order depency
aKey.Erase( 0, 1 );
@@ -1250,12 +1253,12 @@ void PPDParser::parseOrderDependency( const ByteString& rLine )
pKey->m_eSetupType = PPDKey::AnySetup;
}
-void PPDParser::parseConstraint( const ByteString& rLine )
+void PPDParser::parseConstraint( const rtl::OString& rLine )
{
bool bFailed = false;
- String aLine( rLine, RTL_TEXTENCODING_MS_1252 );
- aLine.Erase( 0, rLine.Search( ':' )+1 );
+ String aLine(rtl::OStringToOUString(rLine, RTL_TEXTENCODING_MS_1252));
+ aLine.Erase(0, rLine.indexOf(':') + 1);
PPDConstraint aConstraint;
int nTokens = GetCommandLineTokenCount( aLine );
for( int i = 0; i < nTokens; i++ )
@@ -1291,7 +1294,7 @@ void PPDParser::parseConstraint( const ByteString& rLine )
if( ! aConstraint.m_pKey1 || ! aConstraint.m_pKey2 || bFailed )
{
#ifdef __DEBUG
- fprintf( stderr, "Warning: constraint \"%s\" is invalid\n", rLine.GetStr() );
+ fprintf( stderr, "Warning: constraint \"%s\" is invalid\n", rLine.getStr() );
#endif
}
else
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index e29855c939d1..144821173962 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -772,30 +772,30 @@ bool PrinterInfoManager::writePrinterConfig()
pConfig->DeleteGroup( it->second.m_aGroup ); // else some old keys may remain
pConfig->SetGroup( it->second.m_aGroup );
- ByteString aValue( String( it->second.m_aInfo.m_aDriverName ), RTL_TEXTENCODING_UTF8 );
- aValue += '/';
- aValue += ByteString( String( it->first ), RTL_TEXTENCODING_UTF8 );
- pConfig->WriteKey( "Printer", aValue );
+ rtl::OStringBuffer aValue(rtl::OUStringToOString(it->second.m_aInfo.m_aDriverName, RTL_TEXTENCODING_UTF8));
+ aValue.append('/');
+ aValue.append(rtl::OUStringToOString(it->first, RTL_TEXTENCODING_UTF8));
+ pConfig->WriteKey("Printer", aValue.makeStringAndClear());
pConfig->WriteKey( "DefaultPrinter", it->first == m_aDefaultPrinter ? "1" : "0" );
pConfig->WriteKey( "Location", ByteString( String( it->second.m_aInfo.m_aLocation ), RTL_TEXTENCODING_UTF8 ) );
pConfig->WriteKey( "Comment", ByteString( String( it->second.m_aInfo.m_aComment ), RTL_TEXTENCODING_UTF8 ) );
pConfig->WriteKey( "Command", ByteString( String( it->second.m_aInfo.m_aCommand ), RTL_TEXTENCODING_UTF8 ) );
pConfig->WriteKey( "QuickCommand", ByteString( String( it->second.m_aInfo.m_aQuickCommand ), RTL_TEXTENCODING_UTF8 ) );
pConfig->WriteKey( "Features", ByteString( String( it->second.m_aInfo.m_aFeatures ), RTL_TEXTENCODING_UTF8 ) );
- pConfig->WriteKey( "Copies", ByteString::CreateFromInt32( it->second.m_aInfo.m_nCopies ) );
+ pConfig->WriteKey("Copies", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nCopies)));
pConfig->WriteKey( "Orientation", it->second.m_aInfo.m_eOrientation == orientation::Landscape ? "Landscape" : "Portrait" );
- pConfig->WriteKey( "PSLevel", ByteString::CreateFromInt32( it->second.m_aInfo.m_nPSLevel ) );
- pConfig->WriteKey( "PDFDevice", ByteString::CreateFromInt32( it->second.m_aInfo.m_nPDFDevice ) );
- pConfig->WriteKey( "ColorDevice", ByteString::CreateFromInt32( it->second.m_aInfo.m_nColorDevice ) );
- pConfig->WriteKey( "ColorDepth", ByteString::CreateFromInt32( it->second.m_aInfo.m_nColorDepth ) );
- aValue = ByteString::CreateFromInt32( it->second.m_aInfo.m_nLeftMarginAdjust );
- aValue += ',';
- aValue += ByteString::CreateFromInt32( it->second.m_aInfo.m_nRightMarginAdjust );
- aValue += ',';
- aValue += ByteString::CreateFromInt32( it->second.m_aInfo.m_nTopMarginAdjust );
- aValue += ',';
- aValue += ByteString::CreateFromInt32( it->second.m_aInfo.m_nBottomMarginAdjust );
- pConfig->WriteKey( "MarginAdjust", aValue );
+ pConfig->WriteKey("PSLevel", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nPSLevel)));
+ pConfig->WriteKey("PDFDevice", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nPDFDevice)));
+ pConfig->WriteKey("ColorDevice", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nColorDevice)));
+ pConfig->WriteKey("ColorDepth", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nColorDepth)));
+ aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nLeftMarginAdjust));
+ aValue.append(',');
+ aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nRightMarginAdjust));
+ aValue.append(',');
+ aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nTopMarginAdjust));
+ aValue.append(',');
+ aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nBottomMarginAdjust));
+ pConfig->WriteKey("MarginAdjust", aValue.makeStringAndClear());
if( it->second.m_aInfo.m_aDriverName.compareToAscii( "CUPS:", 5 ) != 0 )
{
@@ -807,8 +807,11 @@ bool PrinterInfoManager::writePrinterConfig()
aKey += ByteString( pKey->getKey(), RTL_TEXTENCODING_ISO_8859_1 );
const PPDValue* pValue = it->second.m_aInfo.m_aContext.getValue( pKey );
- aValue = pValue ? ByteString( pValue->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ) : ByteString( "*nil" );
- pConfig->WriteKey( aKey, aValue );
+ if (pValue)
+ aValue.append(rtl::OUStringToOString(pValue->m_aOption, RTL_TEXTENCODING_ISO_8859_1));
+ else
+ aValue.append(RTL_CONSTASCII_STRINGPARAM("*nil"));
+ pConfig->WriteKey(aKey, aValue.makeStringAndClear());
}
}
diff --git a/vcl/unx/generic/printergfx/common_gfx.cxx b/vcl/unx/generic/printergfx/common_gfx.cxx
index 7cae4586bf6e..71ae6962ad73 100644
--- a/vcl/unx/generic/printergfx/common_gfx.cxx
+++ b/vcl/unx/generic/printergfx/common_gfx.cxx
@@ -1230,7 +1230,7 @@ PrinterGfx::DrawEPS( const Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize
static sal_uInt16 nEps = 0;
if( ! aDocTitle.Len() )
- aDocTitle = ByteString::CreateFromInt32( (sal_Int32)(nEps++) );
+ aDocTitle = rtl::OString::valueOf(static_cast<sal_Int32>(nEps++));
if( fLeft != fRight && fTop != fBottom )
{
diff --git a/vcl/unx/generic/printergfx/printerjob.cxx b/vcl/unx/generic/printergfx/printerjob.cxx
index 827b5c7cf269..9fb50947bcf4 100644
--- a/vcl/unx/generic/printergfx/printerjob.cxx
+++ b/vcl/unx/generic/printergfx/printerjob.cxx
@@ -1191,12 +1191,13 @@ bool PrinterJob::writeSetup( osl::File* pFile, const JobData& rJob )
if( ! bExternalDialog && rJob.m_nCopies > 1 )
{
// setup code
- ByteString aLine( "/#copies " );
- aLine += ByteString::CreateFromInt32( rJob.m_nCopies );
- aLine += " def\n";
+ rtl::OStringBuffer aLine(RTL_CONSTASCII_STRINGPARAM("/#copies "));
+ aLine.append(static_cast<sal_Int32>(rJob.m_nCopies));
+ aLine.append(RTL_CONSTASCII_STRINGPARAM(" def\n"));
sal_uInt64 nWritten = 0;
- bSuccess = pFile->write( aLine.GetBuffer(), aLine.Len(), nWritten )
- || nWritten != aLine.Len() ? false : true;
+ bSuccess = pFile->write(aLine.getStr(), aLine.getLength(), nWritten)
+ || nWritten != static_cast<sal_uInt64>(aLine.getLength()) ?
+ false : true;
if( bSuccess && GetPostscriptLevel( &rJob ) >= 2 )
WritePS (pFile, "<< /NumCopies null /Policies << /NumCopies 1 >> >> setpagedevice\n" );
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 1fdfc02c3916..2c1c94ae46c3 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -4241,7 +4241,7 @@ long X11SalFrame::Dispatch( XEvent *pEvent )
CaptureMouse( sal_True );
#ifdef DBG_UTIL
if( -1 != nCaptured_ )
- pDisplay_->PrintEvent( "Captured", pEvent );
+ pDisplay_->DbgPrintDisplayEvent("Captured", pEvent);
#endif
}