View | Details | Raw Unified | Return to issue 19214
Collapse All | Expand All

(-)source/glyphs/gcach_ftyp.cxx (-53 / +149 lines)
Lines 348-354 Link Here
348
    const unsigned char* p = pBuffer + 12;
348
    const unsigned char* p = pBuffer + 12;
349
    if( nFormat == 0x74746366 )         // TTC_MAGIC
349
    if( nFormat == 0x74746366 )         // TTC_MAGIC
350
        p += GetUInt( p + 4 * mnFaceNum );
350
        p += GetUInt( p + 4 * mnFaceNum );
351
    else if( nFormat != 0x00010000 )    // TTF_MAGIC
351
    else if( (nFormat!=0x00010000) && (nFormat!=0x74727565) )    // TTF_MAGIC and Apple TTF Magic
352
        return NULL;
352
        return NULL;
353
353
354
    // walk table directory until match
354
    // walk table directory until match
Lines 495-502 Link Here
495
495
496
            // TODO: prefer unicode names if available
496
            // TODO: prefer unicode names if available
497
            // TODO: prefer locale specific names if available?
497
            // TODO: prefer locale specific names if available?
498
            aFontData.maName        = String::CreateFromAscii( aFaceFT->family_name );
498
/* DAN - some fonts returned NULL names, resulting in crash here. */
499
            aFontData.maStyleName   = String::CreateFromAscii( aFaceFT->style_name );
499
            if ( aFaceFT->family_name )
500
                aFontData.maName        = String::CreateFromAscii( aFaceFT->family_name );
501
            else
502
                aFontData.maName        = String::CreateFromAscii( "\0" );
503
504
            if ( aFaceFT->style_name )
505
                aFontData.maStyleName   = String::CreateFromAscii( aFaceFT->style_name );
506
            else
507
                aFontData.maStyleName   = String::CreateFromAscii( "\0" );
508
509
/* DAN - old non-modified code here
510
             aFontData.maName        = String::CreateFromAscii( aFaceFT->family_name );
511
             aFontData.maStyleName   = String::CreateFromAscii( aFaceFT->style_name );
512
*/
500
513
501
            aFontData.mnWidth   = 0;
514
            aFontData.mnWidth   = 0;
502
            aFontData.mnHeight  = 0;
515
            aFontData.mnHeight  = 0;
Lines 1442-1512 Link Here
1442
    const FT_Byte* pBuffer = pKern;
1455
    const FT_Byte* pBuffer = pKern;
1443
    USHORT nVersion = GetUShort( pBuffer+0 );
1456
    USHORT nVersion = GetUShort( pBuffer+0 );
1444
    USHORT nTableCnt = GetUShort( pBuffer+2 );
1457
    USHORT nTableCnt = GetUShort( pBuffer+2 );
1445
    pBuffer += 4;
1458
1446
    if( nVersion != 0 )     // ignore Apple's versions for now
1459
    // Microsoft/Old TrueType style kern table
1447
        nTableCnt = 0;
1460
    if ( nVersion == 0 )
1448
    for( USHORT nTableIdx = 0; nTableIdx < nTableCnt; ++nTableIdx )
1461
    {
1449
    {
1462
        pBuffer += 4;
1450
        USHORT nSubVersion  = GetUShort( pBuffer+0 );
1463
1451
        USHORT nSubLength   = GetUShort( pBuffer+2 );
1464
        for( USHORT nTableIdx = 0; nTableIdx < nTableCnt; ++nTableIdx )
1452
        USHORT nSubCoverage = GetUShort( pBuffer+4 );
1453
        pBuffer += 6;
1454
        if( (nSubCoverage&0x03) != 0x01 )   // no interest in minimum info here
1455
            continue;
1456
        switch( nSubCoverage >> 8 )
1457
        {
1465
        {
1458
            case 0: // version 0, kerning format 0
1466
            USHORT nSubVersion  = GetUShort( pBuffer+0 );
1467
            USHORT nSubLength   = GetUShort( pBuffer+2 );
1468
            USHORT nSubCoverage = GetUShort( pBuffer+4 );
1469
            pBuffer += 6;
1470
            if( (nSubCoverage&0x03) != 0x01 )   // no interest in minimum info here
1471
                continue;
1472
            switch( nSubCoverage >> 8 )
1459
            {
1473
            {
1460
                USHORT nPairs = GetUShort( pBuffer );
1474
                case 0: // version 0, kerning format 0
1461
                pBuffer += 8;   // skip search hints
1475
                {
1462
                aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs );
1476
                    USHORT nPairs = GetUShort( pBuffer );
1463
                for( int i = 0; i < nPairs; ++i )
1477
                    pBuffer += 8;   // skip search hints
1478
                    aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs );
1479
                    for( int i = 0; i < nPairs; ++i )
1480
                    {
1481
                        aKernPair.mnChar1 = GetUShort( pBuffer+0 );
1482
                        aKernPair.mnChar2 = GetUShort( pBuffer+2 );
1483
                        //long nUnscaledKern= GetSShort( pBuffer );
1484
                        pBuffer += 6;
1485
                        aKernGlyphVector.push_back( aKernPair );
1486
                    }
1487
                }
1488
                break;
1489
1490
                case 2: // version 0, kerning format 2
1464
                {
1491
                {
1465
                    aKernPair.mnChar1 = GetUShort( pBuffer+0 );
1492
                    const FT_Byte* pSubTable = pBuffer;
1466
                    aKernPair.mnChar2 = GetUShort( pBuffer+2 );
1493
                    //USHORT nRowWidth  = GetUShort( pBuffer+0 );
1467
                    //long nUnscaledKern= GetSShort( pBuffer );
1494
                    USHORT nOfsLeft     = GetUShort( pBuffer+2 );
1468
                    pBuffer += 6;
1495
                    USHORT nOfsRight    = GetUShort( pBuffer+4 );
1469
                    aKernGlyphVector.push_back( aKernPair );
1496
                    USHORT nOfsArray    = GetUShort( pBuffer+6 );
1497
                    pBuffer += 8;
1498
1499
                    const FT_Byte* pTmp = pSubTable + nOfsLeft;
1500
                    USHORT nFirstLeft   = GetUShort( pTmp+0 );
1501
                    USHORT nLastLeft    = GetUShort( pTmp+2 ) + nFirstLeft - 1;
1502
1503
                    pTmp = pSubTable + nOfsRight;
1504
                    USHORT nFirstRight  = GetUShort( pTmp+0 );
1505
                    USHORT nLastRight   = GetUShort( pTmp+2 ) + nFirstRight - 1;
1506
1507
                    ULONG nPairs = (ULONG)(nLastLeft - nFirstLeft + 1) * (nLastRight - nFirstRight + 1);
1508
                    aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs );
1509
1510
                    pTmp = pSubTable + nOfsArray;
1511
                    for( int nLeft = nFirstLeft; nLeft < nLastLeft; ++nLeft )
1512
                    {
1513
                        aKernPair.mnChar1 = nLeft;
1514
                        for( int nRight = 0; nRight < nLastRight; ++nRight )
1515
                        {
1516
                            if( GetUShort( pTmp ) != 0 )
1517
                            {
1518
                                aKernPair.mnChar2 = nRight;
1519
                                aKernGlyphVector.push_back( aKernPair );
1520
                            }
1521
                            pTmp += 2;
1522
                        }
1523
                    }
1470
                }
1524
                }
1525
                break;
1471
            }
1526
            }
1472
            break;
1527
        }
1528
    }
1473
1529
1474
            case 2: // version 0, kerning format 2
1530
    // Apple New style kern table
1475
            {
1531
    pBuffer = pKern;
1476
                const FT_Byte* pSubTable = pBuffer;
1532
    nVersion = NEXT_ULong( pBuffer );
1477
                //USHORT nRowWidth  = GetUShort( pBuffer+0 );
1533
    nTableCnt = NEXT_ULong( pBuffer );
1478
                USHORT nOfsLeft     = GetUShort( pBuffer+2 );
1534
    if ( nVersion == 0x00010000 )
1479
                USHORT nOfsRight    = GetUShort( pBuffer+4 );
1535
    {
1480
                USHORT nOfsArray    = GetUShort( pBuffer+6 );
1536
        for( USHORT nTableIdx = 0; nTableIdx < nTableCnt; ++nTableIdx )
1481
                pBuffer += 8;
1537
        {
1482
1538
            ULONG  nLength  = NEXT_ULong( pBuffer );
1483
                const FT_Byte* pTmp = pSubTable + nOfsLeft;
1539
            USHORT nCoverage   = NEXT_UShort( pBuffer );
1484
                USHORT nFirstLeft   = GetUShort( pTmp+0 );
1540
            USHORT nTupleIndex = NEXT_UShort( pBuffer );
1485
                USHORT nLastLeft    = GetUShort( pTmp+2 ) + nFirstLeft - 1;
1541
1486
1542
            // Get kerning type
1487
                pTmp = pSubTable + nOfsRight;
1543
            sal_Bool bKernVertical     = nCoverage & 0x8000;
1488
                USHORT nFirstRight  = GetUShort( pTmp+0 );
1544
            sal_Bool bKernCrossStream  = nCoverage & 0x4000;
1489
                USHORT nLastRight   = GetUShort( pTmp+2 ) + nFirstRight - 1;
1545
            sal_Bool bKernVariation    = nCoverage & 0x2000;
1490
1546
1491
                ULONG nPairs = (ULONG)(nLastLeft - nFirstLeft + 1) * (nLastRight - nFirstRight + 1);
1547
            // Kerning sub-table format, 0 through 3
1492
                aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs );
1548
            sal_uInt8 nSubTableFormat  = nCoverage & 0x00FF;
1493
1549
1494
                pTmp = pSubTable + nOfsArray;
1550
            switch( nSubTableFormat )
1495
                for( int nLeft = nFirstLeft; nLeft < nLastLeft; ++nLeft )
1551
            {
1552
                case 0: // version 0, kerning format 0
1496
                {
1553
                {
1497
                    aKernPair.mnChar1 = nLeft;
1554
                    USHORT nPairs = NEXT_UShort( pBuffer );
1498
                    for( int nRight = 0; nRight < nLastRight; ++nRight )
1555
                    pBuffer += 6;   // skip search hints
1556
                    aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs );
1557
                    for( int i = 0; i < nPairs; ++i )
1499
                    {
1558
                    {
1500
                        if( GetUShort( pTmp ) != 0 )
1559
                        aKernPair.mnChar1 = NEXT_UShort( pBuffer );
1560
                        aKernPair.mnChar2 = NEXT_UShort( pBuffer );
1561
                        /*long nUnscaledKern=*/ NEXT_Short( pBuffer );
1562
                        aKernGlyphVector.push_back( aKernPair );
1563
                    }
1564
                }
1565
                break;
1566
1567
                case 2:	// version 0, kerning format 2
1568
                {
1569
                    const FT_Byte* pSubTable = pBuffer;
1570
                    /*USHORT nRowWidth	=*/ NEXT_UShort( pBuffer );
1571
                    USHORT nOfsLeft     = NEXT_UShort( pBuffer );
1572
                    USHORT nOfsRight    = NEXT_UShort( pBuffer );
1573
                    USHORT nOfsArray    = NEXT_UShort( pBuffer );
1574
1575
                    const FT_Byte* pTmp = pSubTable + nOfsLeft;
1576
                    USHORT nFirstLeft   = NEXT_UShort( pTmp );
1577
                    USHORT nLastLeft    = NEXT_UShort( pTmp ) + nFirstLeft - 1;
1578
1579
                    pTmp = pSubTable + nOfsRight;
1580
                    USHORT nFirstRight  = NEXT_UShort( pTmp );
1581
                    USHORT nLastRight   = NEXT_UShort( pTmp ) + nFirstRight - 1;
1582
1583
                    ULONG nPairs = (ULONG)(nLastLeft - nFirstLeft + 1) * (nLastRight - nFirstRight + 1);
1584
                    aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs );
1585
1586
                    pTmp = pSubTable + nOfsArray;
1587
                    for( int nLeft = nFirstLeft; nLeft < nLastLeft; ++nLeft )
1588
                    {
1589
                        aKernPair.mnChar1 = nLeft;
1590
                        for( int nRight = 0; nRight < nLastRight; ++nRight )
1501
                        {
1591
                        {
1502
                            aKernPair.mnChar2 = nRight;
1592
                            if( NEXT_Short( pTmp ) != 0 )
1503
                            aKernGlyphVector.push_back( aKernPair );
1593
                            {
1594
                                aKernPair.mnChar2 = nRight;
1595
                                aKernGlyphVector.push_back( aKernPair );
1596
                            }
1504
                        }
1597
                        }
1505
                        pTmp += 2;
1506
                    }
1598
                    }
1507
                }
1599
                }
1600
                break;
1601
1602
                default:
1603
                    fprintf( stderr, "gcach_ftyp.cxx:  Found unsupported Apple-style kern subtable type %d.\n", nSubTableFormat );
1604
                    break;
1508
            }
1605
            }
1509
            break;
1510
        }
1606
        }
1511
    }
1607
    }
1512
1608
(-)unx/source/app/i18n_im.cxx (+56 lines)
Lines 82-87 Link Here
82
#include <i18n_status.hxx>
82
#include <i18n_status.hxx>
83
#endif
83
#endif
84
84
85
#ifdef MACOSX
86
#include <osl/process.h>
87
#include <tools/string.hxx>
88
#endif
89
85
using namespace vcl;
90
using namespace vcl;
86
91
87
#ifndef _SAL_I18N_CALLBACK_HXX
92
#ifndef _SAL_I18N_CALLBACK_HXX
Lines 223-234 Link Here
223
SetSystemLocale( const char* p_inlocale )
228
SetSystemLocale( const char* p_inlocale )
224
{
229
{
225
	char *p_outlocale;
230
	char *p_outlocale;
231
232
#ifdef MACOSX
233
	// If p_inlocale is NULL, use current locale from libsal since
234
    // setlocale() always returns NULL when you pass NULL on Mac OS X
235
	if ( p_inlocale == NULL || *p_inlocale == NULL )
236
	{
237
		rtl_Locale* pLocale = NULL;
238
		osl_getProcessLocale( &pLocale );
239
		if ( pLocale ) 
240
		{
241
			ByteString aLocaleString( String( pLocale->Language ), RTL_TEXTENCODING_ASCII_US );
242
			ByteString aCountry( String( pLocale->Country ), RTL_TEXTENCODING_ASCII_US );
243
			ByteString aVariant( String( pLocale->Variant ), RTL_TEXTENCODING_ASCII_US );
244
 
245
			if( aCountry.Len() )
246
			{
247
				aLocaleString += "_";
248
				aLocaleString += aCountry;
249
			}
250
			if( aVariant.Len() )
251
			{
252
				aLocaleString += ".";
253
				aLocaleString += aVariant;
254
			}
255
256
			p_inlocale = aLocaleString.GetBuffer();
257
		}
258
	}
259
260
	// FIXME
261
	// setlocale() doesn't do much on Darwin 5 or 6.  Here, since setlocale() is
262
	// #defined to _Xsetlocale() by our <X11/Xlocale.h>, it still doesn't work.
263
	// NOTE:  On MacOS X, we can't set the locale anyway because its set in 
264
	// the System Preferences application, under the International control panel.
265
	// Thus, the locale that we get from osl_getProcessLocale() is always valid as
266
	// its the locale that's already set.
267
	// NOTE 2:  This setlocale() is still valid for Darwin though.
226
	if ( (p_outlocale = setlocale(LC_ALL, p_inlocale)) == NULL )
268
	if ( (p_outlocale = setlocale(LC_ALL, p_inlocale)) == NULL )
269
          p_outlocale = p_inlocale;		// Hack it so we return a good locale anyway	
270
271
#else
272
     if ( (p_outlocale = setlocale(LC_ALL, p_inlocale)) == NULL )
227
	{
273
	{
228
		fprintf( stderr,
274
		fprintf( stderr,
229
			"I18N: Operating system doesn't support locale \"%s\"\n",
275
			"I18N: Operating system doesn't support locale \"%s\"\n",
230
			p_inlocale );
276
			p_inlocale );
231
	}
277
	}
278
#endif
232
279
233
	return p_outlocale;
280
	return p_outlocale;
234
}
281
}
Lines 437-442 Link Here
437
			if ( XGetIMValues(maMethod,
484
			if ( XGetIMValues(maMethod,
438
					XNMultiLingualInput, &mbMultiLingual, NULL ) != NULL )
485
					XNMultiLingualInput, &mbMultiLingual, NULL ) != NULL )
439
				mbMultiLingual = False;
486
				mbMultiLingual = False;
487
488
           #ifdef MACOSX
489
                // FIXME
490
                // For whatever reason, the XvaOpenIM call always returns NULL
491
                // on MacOS X/Darwin. ÊWe know we've got multi-lingual support
492
                // anyway so hack it to true so we can type international characters.
493
                mbMultiLingual = True;
494
           #endif
495
440
            if( mbMultiLingual )
496
            if( mbMultiLingual )
441
            {
497
            {
442
                XIMUnicodeCharacterSubsets* subsets;
498
                XIMUnicodeCharacterSubsets* subsets;
(-)unx/source/gdi/salgdi3.cxx (-1 / +7 lines)
Lines 1349-1358 Link Here
1349
1349
1350
        if( aX11GlyphPeer.GetGlyphSet( rFont ) )
1350
        if( aX11GlyphPeer.GetGlyphSet( rFont ) )
1351
            DrawServerAAFontString( rLayout );
1351
            DrawServerAAFontString( rLayout );
1352
        else if( aX11GlyphPeer.ForcedAntialiasing( rFont ) )
1352
        else
1353
#ifdef MACOSX
1354
            /* Simply draw everything antialiased, even the UI */
1355
		  DrawServerAAForcedString( rLayout );
1356
#else
1357
        if( aX11GlyphPeer.ForcedAntialiasing( rFont ) )
1353
            DrawServerAAForcedString( rLayout );
1358
            DrawServerAAForcedString( rLayout );
1354
        else
1359
        else
1355
            DrawServerSimpleFontString( rLayout );
1360
            DrawServerSimpleFontString( rLayout );
1361
#endif
1356
    }
1362
    }
1357
}
1363
}
1358
1364
(-)unx/source/gdi/salprnpsp.cxx (-21 / +109 lines)
Lines 101-106 Link Here
101
#include <saldata.hxx>
101
#include <saldata.hxx>
102
#endif
102
#endif
103
103
104
#ifdef MACOSX
105
#include <rtl/ustring.hxx>
106
#include <osl/module.h>
107
#endif
108
104
#ifndef _PSPRINT_PRINTERINFOMANAGER_HXX_
109
#ifndef _PSPRINT_PRINTERINFOMANAGER_HXX_
105
#include <psprint/printerinfomanager.hxx>
110
#include <psprint/printerinfomanager.hxx>
106
#endif
111
#endif
Lines 112-117 Link Here
112
 *	static helpers
117
 *	static helpers
113
 */
118
 */
114
119
120
#ifndef MACOSX
115
// NETBSD has no RTLD_GLOBAL
121
// NETBSD has no RTLD_GLOBAL
116
#ifndef RTLD_GLOBAL
122
#ifndef RTLD_GLOBAL
117
#define DLOPEN_MODE (RTLD_LAZY)
123
#define DLOPEN_MODE (RTLD_LAZY)
Lines 119-124 Link Here
119
#define DLOPEN_MODE (RTLD_GLOBAL | RTLD_LAZY)
125
#define DLOPEN_MODE (RTLD_GLOBAL | RTLD_LAZY)
120
#endif
126
#endif
121
#include <dlfcn.h>
127
#include <dlfcn.h>
128
#endif
122
#include <rtsname.hxx>
129
#include <rtsname.hxx>
123
130
124
static void* driverLib						= NULL;
131
static void* driverLib						= NULL;
Lines 150-172 Link Here
150
157
151
	if( ! driverLib )
158
	if( ! driverLib )
152
	{
159
	{
153
		driverLib	= dlopen( _XSALSET_LIBNAME, DLOPEN_MODE );
160
		#ifdef MACOSX
154
		pErr		= dlerror();
161
			// Use OSL module loading for MacOS X
155
		if ( !driverLib )
162
			OUString		printerDriverLibName( RTL_CONSTASCII_USTRINGPARAM(_XSALSET_LIBNAME) );
156
		{
163
			oslModule		pPrinterDriverLib = osl_loadModule( printerDriverLibName.pData, SAL_LOADMODULE_DEFAULT );
157
			fprintf( stderr, "%s: when opening %s\n", pErr, _XSALSET_LIBNAME );
164
			if( !pPrinterDriverLib )
158
			return;
165
			{
159
		}
166
				fprintf( stderr, "salprnpsp.cxx: Cannot load printer setup library %s.\n", printerDriverLibName.pData );
167
				return;
168
			}
169
170
			// Get the address of Sal_SetupPrinterDriver
171
			OUString		setupPrinterDriverFuncName( RTL_CONSTASCII_USTRINGPARAM("Sal_SetupPrinterDriver") );
172
			void			*pSetupPrinterDriverFunc;
173
			pSetupPrinterDriverFunc = osl_getSymbol( pPrinterDriverLib, setupPrinterDriverFuncName.pData );
174
			if( !pSetupPrinterDriverFunc )
175
			{
176
				fprintf( stderr, "salprnpsp.cxx: Cannot get address of symbol 'Sal_SetupPrinterDriver'.\n" );
177
				return;
178
			}
179
			pSetupFunction = (int(*)(PrinterInfo&))pSetupPrinterDriverFunc;
180
181
			// Get the address of Sal_queryFaxNumber
182
			OUString		queryFaxNumFuncName( RTL_CONSTASCII_USTRINGPARAM("Sal_queryFaxNumber") );
183
			void			*pQueryFaxNumFunc;
184
			pQueryFaxNumFunc = osl_getSymbol( pPrinterDriverLib, queryFaxNumFuncName.pData );
185
			if( !pQueryFaxNumFunc )
186
			{
187
				fprintf( stderr, "salprnpsp.cxx: Cannot get address of symbol 'Sal_queryFaxNumber'.\n" );
188
				return;
189
			}
190
			pFaxNrFunction = (int(*)(String&))pQueryFaxNumFunc;
160
191
161
		pSetupFunction	= (int(*)(PrinterInfo&))dlsym( driverLib, "Sal_SetupPrinterDriver" );
192
		#else
162
		pErr		= dlerror();
193
			driverLib	= dlopen( _XSALSET_LIBNAME, DLOPEN_MODE );
163
		if ( !pSetupFunction )
194
			pErr		= dlerror();
164
			fprintf( stderr, "%s: when getting Sal_SetupPrinterDriver\n", pErr );
195
			if ( !driverLib )
165
196
			{
166
		pFaxNrFunction = (int(*)(String&))dlsym( driverLib, "Sal_queryFaxNumber" );
197
				fprintf( stderr, "%s: when opening %s\n", pErr, _XSALSET_LIBNAME );
167
		pErr		= dlerror();
198
				return;
168
		if ( !pFaxNrFunction )
199
			}
169
			fprintf( stderr, "%s: when getting Sal_queryFaxNumber\n", pErr );
200
201
			pSetupFunction	= (int(*)(PrinterInfo&))dlsym( driverLib, "Sal_SetupPrinterDriver" );
202
			pErr		= dlerror();
203
			if ( !pSetupFunction )
204
				fprintf( stderr, "%s: when getting Sal_SetupPrinterDriver\n", pErr );
205
206
			pFaxNrFunction = (int(*)(String&))dlsym( driverLib, "Sal_queryFaxNumber" );
207
			pErr		= dlerror();
208
			if ( !pFaxNrFunction )
209
				fprintf( stderr, "%s: when getting Sal_queryFaxNumber\n", pErr );
210
		#endif
170
	}
211
	}
171
}
212
}
172
213
Lines 680-691 Link Here
680
                nHeight	= pJobSetup->mnPaperWidth;
721
                nHeight	= pJobSetup->mnPaperWidth;
681
            }
722
            }
682
			String aPaper;
723
			String aPaper;
683
			if( pJobSetup->mePaperFormat == PAPER_USER )
724
684
				aPaper = aData.m_pParser->matchPaper(
725
#ifdef MACOSX
685
					TenMuToPt( pJobSetup->mnPaperWidth ),
726
			// For Mac OS X, many printers are directly attached
686
					TenMuToPt( pJobSetup->mnPaperHeight ) );
727
			// USB/Serial printers with a stripped-down PPD that gives us
728
			// problems.  We need to do PS->PDF conversion for these printers
729
			// but they are not able to handle multiple page sizes in the same
730
			// document at all, since we must pass -o media=... to them to get
731
			// a good printout.
732
			// So, we must find a match between the paper size from OOo and what
733
			// the PPD of the printer has, and pass that paper size to -o media=...
734
			// If a match cannot be found (ie the paper size from Format->Page is
735
			// nowhere near anything in the PPD), we default to what has been
736
			// chosen in File->Print->Properties.
737
			//
738
			// For printers capable of directly accepting PostScript data, none
739
			// of this occurs and we default to the normal OOo behavior.
740
			const PPDKey	*pCupsFilterKey;
741
			const PPDValue	*pCupsFilterValue;
742
			BOOL			bIsCUPSPrinter = TRUE;
743
744
			// Printers that need PS->PDF conversion have a "cupsFilter" key and
745
			// a value of "application/pdf" in that key
746
			pCupsFilterKey = aData.m_pParser->getKey( String(RTL_CONSTASCII_USTRINGPARAM("cupsFilter")) );
747
			pCupsFilterValue = pCupsFilterKey != NULL ? aData.m_aContext.getValue( pCupsFilterKey ) : NULL;
748
			if ( pCupsFilterValue )
749
			{
750
				// PPD had a cupsFilter key, check for PS->PDF conversion requirement
751
				ByteString    aCupsFilterString( pCupsFilterValue->m_aOption, RTL_TEXTENCODING_ISO_8859_1 );
752
				if ( aCupsFilterString.Search("application/pdf") == 0 )
753
					bIsCUPSPrinter = FALSE;
754
			}
687
			else
755
			else
688
				aPaper = String( ByteString( aPaperTab[ pJobSetup->mePaperFormat ].name ), RTL_TEXTENCODING_ISO_8859_1 );
756
				bIsCUPSPrinter = FALSE;
757
758
			if ( TRUE == bIsCUPSPrinter )
759
			{
760
				// If its a directly attached printer, with a
761
				// stripped down PPD (most OS X printers are) always
762
				// match the paper size.
763
 				aPaper = aData.m_pParser->matchPaper(
764
 					TenMuToPt( pJobSetup->mnPaperWidth ),
765
 					TenMuToPt( pJobSetup->mnPaperHeight ) );
766
			}
767
 			else
768
#endif
769
			{
770
				if( pJobSetup->mePaperFormat == PAPER_USER )
771
					aPaper = aData.m_pParser->matchPaper(
772
						TenMuToPt( pJobSetup->mnPaperWidth ),
773
						TenMuToPt( pJobSetup->mnPaperHeight ) );
774
				else
775
					aPaper = String( ByteString( aPaperTab[ pJobSetup->mePaperFormat ].name ), RTL_TEXTENCODING_ISO_8859_1 );
776
			}
689
			pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) );
777
			pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) );
690
			pValue = pKey ? pKey->getValue( aPaper ) : NULL;
778
			pValue = pKey ? pKey->getValue( aPaper ) : NULL;
691
			if( ! ( pKey && pValue && aData.m_aContext.setValue( pKey, pValue, false ) == pValue ) )
779
			if( ! ( pKey && pValue && aData.m_aContext.setValue( pKey, pValue, false ) == pValue ) )
(-)unx/source/window/salframe.cxx (+3 lines)
Lines 2745-2753 Link Here
2745
2745
2746
	rtl_TextEncoding nEncoding;
2746
	rtl_TextEncoding nEncoding;
2747
2747
2748
    // encoding is always platform encoding on OS X window managers at this point
2749
#ifndef MACOSX
2748
    if (mpInputContext != NULL && mpInputContext->IsMultiLingual() )
2750
    if (mpInputContext != NULL && mpInputContext->IsMultiLingual() )
2749
        nEncoding = RTL_TEXTENCODING_UTF8;
2751
        nEncoding = RTL_TEXTENCODING_UTF8;
2750
    else
2752
    else
2753
#endif
2751
        nEncoding = osl_getThreadTextEncoding();
2754
        nEncoding = osl_getThreadTextEncoding();
2752
2755
2753
	sal_Unicode *pBuffer;
2756
	sal_Unicode *pBuffer;

Return to issue 19214