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

(-)ood680-m1/psprint/inc/psprint/fontmanager.hxx (+9 lines)
Lines 49-54 Link Here
49
#ifndef _PSPRINT_HELPER_HXX_
49
#ifndef _PSPRINT_HELPER_HXX_
50
#include <psprint/helper.hxx>
50
#include <psprint/helper.hxx>
51
#endif
51
#endif
52
#ifndef _STRING_HXX
53
#include <tools/string.hxx>
54
#endif
52
55
53
#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
56
#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
54
#include <com/sun/star/lang/Locale.hpp>
57
#include <com/sun/star/lang/Locale.hpp>
Lines 414-419 Link Here
414
    std::hash_multimap< sal_uInt8, sal_Unicode >	m_aAdobecodeToUnicode;
417
    std::hash_multimap< sal_uInt8, sal_Unicode >	m_aAdobecodeToUnicode;
415
418
416
    mutable FontCache*							m_pFontCache;
419
    mutable FontCache*							m_pFontCache;
420
    bool m_bFontconfigSuccess;
417
        
421
        
418
    rtl::OString getAfmFile( PrintFont* pFont ) const;
422
    rtl::OString getAfmFile( PrintFont* pFont ) const;
419
    rtl::OString getFontFile( PrintFont* pFont ) const;
423
    rtl::OString getFontFile( PrintFont* pFont ) const;
Lines 724-729 Link Here
724
    false else
728
    false else
725
     */
729
     */
726
    bool matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale );
730
    bool matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale );
731
732
    String Substitute(const std::vector<String> &rNames, const std::vector<sal_Unicode> &rGlyphs, 
733
        const ByteString &rLangAttrib, italic::type eItalic, weight::type eWeight, 
734
        width::type eWidth, pitch::type ePitch) const;
735
    bool hasFontconfig() const { return m_bFontconfigSuccess; }
727
};
736
};
728
737
729
} // namespace
738
} // namespace
(-)ood680-m1/psprint/source/fontmanager/fontcache.cxx (-1 / +1 lines)
Lines 679-687 Link Here
679
        FontDirMap::const_iterator entry = dir->second.m_aEntries.find( rFile );
679
        FontDirMap::const_iterator entry = dir->second.m_aEntries.find( rFile );
680
        if( entry != dir->second.m_aEntries.end() )
680
        if( entry != dir->second.m_aEntries.end() )
681
        {
681
        {
682
            bSuccess = true;
683
            for( FontCacheEntry::const_iterator font = entry->second.m_aEntry.begin(); font != entry->second.m_aEntry.end(); ++font )
682
            for( FontCacheEntry::const_iterator font = entry->second.m_aEntry.begin(); font != entry->second.m_aEntry.end(); ++font )
684
            {
683
            {
684
                bSuccess = true;
685
                PrintFontManager::PrintFont* pFont = clonePrintFont( *font );
685
                PrintFontManager::PrintFont* pFont = clonePrintFont( *font );
686
                rNewFonts.push_back( pFont );
686
                rNewFonts.push_back( pFont );
687
            }
687
            }
(-)ood680-m1/psprint/source/fontmanager/fontconfig.cxx (-53 / +200 lines)
Lines 44-53 Link Here
44
typedef void FcObjectSet;
44
typedef void FcObjectSet;
45
typedef void FcPattern;
45
typedef void FcPattern;
46
typedef void FcFontSet;
46
typedef void FcFontSet;
47
typedef void FcCharSet;
47
typedef int FcResult;
48
typedef int FcResult;
48
typedef int FcBool;
49
typedef int FcBool;
49
typedef int FcMatchKind;
50
typedef int FcMatchKind;
50
typedef char FcChar8;
51
typedef char FcChar8;
52
typedef sal_Int32 FcChar32;
51
#endif
53
#endif
52
54
53
#include <cstdio>
55
#include <cstdio>
Lines 80-85 Link Here
80
{
82
{
81
    oslModule		m_pLib;
83
    oslModule		m_pLib;
82
    FcConfig*		m_pDefConfig;
84
    FcConfig*		m_pDefConfig;
85
    FcFontSet*      m_pOutlineSet;
83
86
84
	FcBool          (*m_pFcInit)();
87
	FcBool          (*m_pFcInit)();
85
    FcConfig*		(*m_pFcConfigGetCurrent)();
88
    FcConfig*		(*m_pFcConfigGetCurrent)();
Lines 88-105 Link Here
88
    FcPattern*		(*m_pFcPatternCreate)();
91
    FcPattern*		(*m_pFcPatternCreate)();
89
    void			(*m_pFcPatternDestroy)(FcPattern*);
92
    void			(*m_pFcPatternDestroy)(FcPattern*);
90
    FcFontSet*		(*m_pFcFontList)(FcConfig*,FcPattern*,FcObjectSet*);
93
    FcFontSet*		(*m_pFcFontList)(FcConfig*,FcPattern*,FcObjectSet*);
94
    FcFontSet*      (*m_pFcConfigGetFonts)(FcConfig*,FcSetName);
91
    FcFontSet*		(*m_pFcFontSetCreate)();
95
    FcFontSet*		(*m_pFcFontSetCreate)();
96
    FcCharSet*                (*m_pFcCharSetCreate)();
97
    FcBool                    (*m_pFcCharSetAddChar)(FcCharSet *, FcChar32);
92
    void			(*m_pFcFontSetDestroy)(FcFontSet*);
98
    void			(*m_pFcFontSetDestroy)(FcFontSet*);
93
    FcBool			(*m_pFcFontSetAdd)(FcFontSet*,FcPattern*);
99
    FcBool			(*m_pFcFontSetAdd)(FcFontSet*,FcPattern*);
100
    void            (*m_pFcPatternReference)(FcPattern*);
94
    FcResult		(*m_pFcPatternGetString)(const FcPattern*,const char*,int,FcChar8**);
101
    FcResult		(*m_pFcPatternGetString)(const FcPattern*,const char*,int,FcChar8**);
95
    FcResult		(*m_pFcPatternGetInteger)(const FcPattern*,const char*,int,int*);
102
    FcResult		(*m_pFcPatternGetInteger)(const FcPattern*,const char*,int,int*);
96
    FcResult		(*m_pFcPatternGetDouble)(const FcPattern*,const char*,int,double*);
103
    FcResult		(*m_pFcPatternGetDouble)(const FcPattern*,const char*,int,double*);
97
    FcResult		(*m_pFcPatternGetBool)(const FcPattern*,const char*,int,FcBool*);
104
    FcResult		(*m_pFcPatternGetBool)(const FcPattern*,const char*,int,FcBool*);
98
    void			(*m_pFcDefaultSubstitute)(FcPattern *);
105
    void			(*m_pFcDefaultSubstitute)(FcPattern *);
99
    FcPattern*		(*m_pFcFontMatch)(FcConfig*,FcPattern*,FcResult*);    
100
    FcPattern*		(*m_pFcFontSetMatch)(FcConfig*,FcFontSet**, int, FcPattern*,FcResult*);    
106
    FcPattern*		(*m_pFcFontSetMatch)(FcConfig*,FcFontSet**, int, FcPattern*,FcResult*);    
101
    FcBool			(*m_pFcConfigSubstitute)(FcConfig*,FcPattern*,FcMatchKind);
107
    FcBool			(*m_pFcConfigSubstitute)(FcConfig*,FcPattern*,FcMatchKind);
102
    FcBool			(*m_pFcPatternAddInteger)(FcPattern*,const char*,int);
108
    FcBool			(*m_pFcPatternAddInteger)(FcPattern*,const char*,int);
109
    FcBool                    (*m_pFcPatternAddBool)(FcPattern*,const char*,FcBool);
110
    FcBool                    (*m_pFcPatternAddCharSet)(FcPattern*,const char*,const FcCharSet*);
103
    FcBool			(*m_pFcPatternAddString)(FcPattern*,const char*,const FcChar8*);
111
    FcBool			(*m_pFcPatternAddString)(FcPattern*,const char*,const FcChar8*);
104
112
105
    oslGenericFunction loadSymbol( const char* );
113
    oslGenericFunction loadSymbol( const char* );
Lines 115-120 Link Here
115
    { return m_pLib != NULL;}
123
    { return m_pLib != NULL;}
116
124
117
    FcConfig* getDefConfig() { return m_pDefConfig; }
125
    FcConfig* getDefConfig() { return m_pDefConfig; }
126
    FcFontSet* getFontSet() { return m_pOutlineSet; }
118
127
119
    FcBool FcInit()
128
    FcBool FcInit()
120
    { return m_pFcInit(); }
129
    { return m_pFcInit(); }
Lines 144-157 Link Here
144
    
153
    
145
    FcFontSet* FcFontList( FcConfig* pConfig, FcPattern* pPattern, FcObjectSet* pSet )
154
    FcFontSet* FcFontList( FcConfig* pConfig, FcPattern* pPattern, FcObjectSet* pSet )
146
    { return m_pFcFontList( pConfig, pPattern, pSet ); }
155
    { return m_pFcFontList( pConfig, pPattern, pSet ); }
147
    
156
157
    FcFontSet* FcConfigGetFonts( FcConfig* pConfig, FcSetName eSet)
158
    { return m_pFcConfigGetFonts( pConfig, eSet ); }
159
148
    FcFontSet* FcFontSetCreate()
160
    FcFontSet* FcFontSetCreate()
149
    { return m_pFcFontSetCreate(); }
161
    { return m_pFcFontSetCreate(); }
162
163
    FcCharSet* FcCharSetCreate()
164
    { return m_pFcCharSetCreate(); }
165
166
    FcBool FcCharSetAddChar(FcCharSet *fcs, FcChar32 ucs4)
167
    { return m_pFcCharSetAddChar(fcs, ucs4); }
168
150
    void FcFontSetDestroy( FcFontSet* pSet )
169
    void FcFontSetDestroy( FcFontSet* pSet )
151
    { m_pFcFontSetDestroy( pSet );}
170
    { m_pFcFontSetDestroy( pSet );}
171
152
    FcBool FcFontSetAdd( FcFontSet* pSet, FcPattern* pPattern )
172
    FcBool FcFontSetAdd( FcFontSet* pSet, FcPattern* pPattern )
153
    { return m_pFcFontSetAdd( pSet, pPattern ); }
173
    { return m_pFcFontSetAdd( pSet, pPattern ); }
154
174
175
    void FcPatternReference( FcPattern* pPattern )
176
    { m_pFcPatternReference( pPattern ); }
177
155
    FcResult FcPatternGetString( const FcPattern* pPattern, const char* object, int n, FcChar8** s )
178
    FcResult FcPatternGetString( const FcPattern* pPattern, const char* object, int n, FcChar8** s )
156
    { return m_pFcPatternGetString( pPattern, object, n, s ); }
179
    { return m_pFcPatternGetString( pPattern, object, n, s ); }
157
180
Lines 165-172 Link Here
165
    { return m_pFcPatternGetBool( pPattern, object, n, s ); }
188
    { return m_pFcPatternGetBool( pPattern, object, n, s ); }
166
    void FcDefaultSubstitute( FcPattern* pPattern )
189
    void FcDefaultSubstitute( FcPattern* pPattern )
167
    { m_pFcDefaultSubstitute( pPattern ); }
190
    { m_pFcDefaultSubstitute( pPattern ); }
168
    FcPattern* FcFontMatch( FcConfig* pConfig, FcPattern* pPattern, FcResult* pResult )
169
    { return m_pFcFontMatch( pConfig, pPattern, pResult ); }
170
    FcPattern* FcFontSetMatch( FcConfig* pConfig, FcFontSet **ppFontSet, int nset, FcPattern* pPattern, FcResult* pResult )
191
    FcPattern* FcFontSetMatch( FcConfig* pConfig, FcFontSet **ppFontSet, int nset, FcPattern* pPattern, FcResult* pResult )
171
    { return m_pFcFontSetMatch ? m_pFcFontSetMatch( pConfig, ppFontSet, nset, pPattern, pResult ) : 0; }
192
    { return m_pFcFontSetMatch ? m_pFcFontSetMatch( pConfig, ppFontSet, nset, pPattern, pResult ) : 0; }
172
    FcBool FcConfigSubstitute( FcConfig* pConfig, FcPattern* pPattern, FcMatchKind eKind )
193
    FcBool FcConfigSubstitute( FcConfig* pConfig, FcPattern* pPattern, FcMatchKind eKind )
Lines 175-180 Link Here
175
    { return m_pFcPatternAddInteger( pPattern, pObject, nValue ); }
196
    { return m_pFcPatternAddInteger( pPattern, pObject, nValue ); }
176
    FcBool FcPatternAddString( FcPattern* pPattern, const char* pObject, const FcChar8* pString )
197
    FcBool FcPatternAddString( FcPattern* pPattern, const char* pObject, const FcChar8* pString )
177
    { return m_pFcPatternAddString( pPattern, pObject, pString ); }
198
    { return m_pFcPatternAddString( pPattern, pObject, pString ); }
199
    FcBool FcPatternAddBool( FcPattern* pPattern, const char* pObject, bool nValue )
200
    { return m_pFcPatternAddBool( pPattern, pObject, nValue ); }
201
    FcBool FcPatternAddCharSet(FcPattern* pPattern,const char* pObject,const FcCharSet*pCharSet)
202
    { return m_pFcPatternAddCharSet(pPattern,pObject,pCharSet); }
178
};
203
};
179
204
180
oslGenericFunction FontCfgWrapper::loadSymbol( const char* pSymbol )
205
oslGenericFunction FontCfgWrapper::loadSymbol( const char* pSymbol )
Lines 189-195 Link Here
189
214
190
FontCfgWrapper::FontCfgWrapper()
215
FontCfgWrapper::FontCfgWrapper()
191
        : m_pLib( NULL ),
216
        : m_pLib( NULL ),
192
          m_pDefConfig( NULL )
217
          m_pDefConfig( NULL ),
218
          m_pOutlineSet( NULL )
193
{
219
{
194
#ifdef ENABLE_FONTCONFIG
220
#ifdef ENABLE_FONTCONFIG
195
    OUString aLib( RTL_CONSTASCII_USTRINGPARAM( "libfontconfig.so.1" ) );
221
    OUString aLib( RTL_CONSTASCII_USTRINGPARAM( "libfontconfig.so.1" ) );
Lines 223-234 Link Here
223
        loadSymbol( "FcPatternDestroy" );
249
        loadSymbol( "FcPatternDestroy" );
224
    m_pFcFontList = (FcFontSet*(*)(FcConfig*,FcPattern*,FcObjectSet*))
250
    m_pFcFontList = (FcFontSet*(*)(FcConfig*,FcPattern*,FcObjectSet*))
225
        loadSymbol( "FcFontList" );
251
        loadSymbol( "FcFontList" );
252
    m_pFcConfigGetFonts = (FcFontSet*(*)(FcConfig*,FcSetName))
253
        loadSymbol( "FcConfigGetFonts" );
226
    m_pFcFontSetCreate = (FcFontSet*(*)())
254
    m_pFcFontSetCreate = (FcFontSet*(*)())
227
        loadSymbol( "FcFontSetCreate" );
255
        loadSymbol( "FcFontSetCreate" );
256
    m_pFcCharSetCreate = (FcCharSet*(*)())
257
        loadSymbol( "FcCharSetCreate" );
258
    m_pFcCharSetAddChar = (FcBool(*)(FcCharSet*, FcChar32))
259
        loadSymbol( "FcCharSetAddChar" );
228
    m_pFcFontSetDestroy = (void(*)(FcFontSet*))
260
    m_pFcFontSetDestroy = (void(*)(FcFontSet*))
229
        loadSymbol( "FcFontSetDestroy" );
261
        loadSymbol( "FcFontSetDestroy" );
230
    m_pFcFontSetAdd = (FcBool(*)(FcFontSet*,FcPattern*))
262
    m_pFcFontSetAdd = (FcBool(*)(FcFontSet*,FcPattern*))
231
        loadSymbol( "FcFontSetAdd" );
263
        loadSymbol( "FcFontSetAdd" );
264
    m_pFcPatternReference = (void(*)(FcPattern*))
265
        loadSymbol( "FcPatternReference" );
232
    m_pFcPatternGetString = (FcResult(*)(const FcPattern*,const char*,int,FcChar8**))
266
    m_pFcPatternGetString = (FcResult(*)(const FcPattern*,const char*,int,FcChar8**))
233
        loadSymbol( "FcPatternGetString" );
267
        loadSymbol( "FcPatternGetString" );
234
    m_pFcPatternGetInteger = (FcResult(*)(const FcPattern*,const char*,int,int*))
268
    m_pFcPatternGetInteger = (FcResult(*)(const FcPattern*,const char*,int,int*))
Lines 239-252 Link Here
239
        loadSymbol( "FcPatternGetBool" );
273
        loadSymbol( "FcPatternGetBool" );
240
    m_pFcDefaultSubstitute = (void(*)(FcPattern *))
274
    m_pFcDefaultSubstitute = (void(*)(FcPattern *))
241
        loadSymbol( "FcDefaultSubstitute" );
275
        loadSymbol( "FcDefaultSubstitute" );
242
    m_pFcFontMatch = (FcPattern*(*)(FcConfig*,FcPattern*,FcResult*))
243
        loadSymbol( "FcFontMatch" );
244
    m_pFcFontSetMatch = (FcPattern*(*)(FcConfig*,FcFontSet**,int,FcPattern*,FcResult*))
276
    m_pFcFontSetMatch = (FcPattern*(*)(FcConfig*,FcFontSet**,int,FcPattern*,FcResult*))
245
        loadSymbol( "FcFontSetMatch" );
277
        loadSymbol( "FcFontSetMatch" );
246
    m_pFcConfigSubstitute = (FcBool(*)(FcConfig*,FcPattern*,FcMatchKind))
278
    m_pFcConfigSubstitute = (FcBool(*)(FcConfig*,FcPattern*,FcMatchKind))
247
        loadSymbol( "FcConfigSubstitute" );
279
        loadSymbol( "FcConfigSubstitute" );
248
    m_pFcPatternAddInteger = (FcBool(*)(FcPattern*,const char*,int))
280
    m_pFcPatternAddInteger = (FcBool(*)(FcPattern*,const char*,int))
249
        loadSymbol( "FcPatternAddInteger" );
281
        loadSymbol( "FcPatternAddInteger" );
282
    m_pFcPatternAddBool = (FcBool(*)(FcPattern*,const char*,FcBool))
283
        loadSymbol( "FcPatternAddBool" );
284
    m_pFcPatternAddCharSet = (FcBool(*)(FcPattern*,const char*,const FcCharSet *))
285
        loadSymbol( "FcPatternAddCharSet" );
250
    m_pFcPatternAddString = (FcBool(*)(FcPattern*,const char*,const FcChar8*))
286
    m_pFcPatternAddString = (FcBool(*)(FcPattern*,const char*,const FcChar8*))
251
        loadSymbol( "FcPatternAddString" );
287
        loadSymbol( "FcPatternAddString" );
252
288
Lines 258-274 Link Here
258
            m_pFcPatternCreate				&&
294
            m_pFcPatternCreate				&&
259
            m_pFcPatternDestroy				&&
295
            m_pFcPatternDestroy				&&
260
            m_pFcFontList					&&
296
            m_pFcFontList					&&
297
            m_pFcConfigGetFonts             &&
261
            m_pFcFontSetCreate				&&
298
            m_pFcFontSetCreate				&&
299
            m_pFcCharSetCreate				&&
300
            m_pFcCharSetAddChar 			&&
262
            m_pFcFontSetDestroy				&&
301
            m_pFcFontSetDestroy				&&
263
            m_pFcFontSetAdd					&&
302
            m_pFcFontSetAdd					&&
303
            m_pFcPatternReference           &&
264
            m_pFcPatternGetString			&&
304
            m_pFcPatternGetString			&&
265
            m_pFcPatternGetInteger			&&
305
            m_pFcPatternGetInteger			&&
266
            m_pFcPatternGetDouble			&&
306
            m_pFcPatternGetDouble			&&
267
            m_pFcPatternGetBool				&&
307
            m_pFcPatternGetBool				&&
268
            m_pFcDefaultSubstitute			&&
308
            m_pFcDefaultSubstitute			&&
269
            m_pFcFontMatch					&&
270
            m_pFcConfigSubstitute			&&
309
            m_pFcConfigSubstitute			&&
271
            m_pFcPatternAddInteger			&&
310
            m_pFcPatternAddInteger			&&
311
            m_pFcPatternAddCharSet			&&
312
            m_pFcPatternAddBool 			&&
272
            m_pFcPatternAddString
313
            m_pFcPatternAddString
273
            ) )
314
            ) )
274
    {
315
    {
Lines 286-295 Link Here
286
        osl_unloadModule( (oslModule)m_pLib );
327
        osl_unloadModule( (oslModule)m_pLib );
287
        m_pLib = NULL;
328
        m_pLib = NULL;
288
    }
329
    }
330
331
    m_pOutlineSet = FcFontSetCreate();
332
333
    /*
334
      add only acceptable outlined fonts to our config, 
335
      for future fontconfig use
336
    */
337
    FcFontSet *pOrig = FcConfigGetFonts(NULL, FcSetSystem);
338
339
    if (!pOrig)
340
        return;
341
342
    for( int i = 0; i < pOrig->nfont; ++i )
343
    {
344
        FcBool outline = false;
345
        FcPattern *pOutlinePattern = pOrig->fonts[i];
346
        FcResult eOutRes = 
347
			FcPatternGetBool( pOutlinePattern, FC_OUTLINE, 0, &outline );
348
        if (eOutRes == FcResultMatch && !outline)
349
            continue;
350
        FcPatternReference(pOutlinePattern);
351
        FcFontSetAdd(m_pOutlineSet, pOutlinePattern);
352
    }
289
}
353
}
290
354
291
FontCfgWrapper::~FontCfgWrapper()
355
FontCfgWrapper::~FontCfgWrapper()
292
{
356
{
357
	if( m_pOutlineSet )
358
		FcFontSetDestroy( m_pOutlineSet );
293
    if( m_pLib )
359
    if( m_pLib )
294
        osl_unloadModule( (oslModule)m_pLib );
360
        osl_unloadModule( (oslModule)m_pLib );
295
}
361
}
Lines 327-333 Link Here
327
    FontCfgWrapper& rWrapper = FontCfgWrapper::get();
393
    FontCfgWrapper& rWrapper = FontCfgWrapper::get();
328
    if( ! rWrapper.isValid() )
394
    if( ! rWrapper.isValid() )
329
        return false;
395
        return false;
330
331
    FcConfig* pConfig = rWrapper.getDefConfig();
396
    FcConfig* pConfig = rWrapper.getDefConfig();
332
    FcObjectSet* pOSet = rWrapper.FcObjectSetBuild( FC_FAMILY,
397
    FcObjectSet* pOSet = rWrapper.FcObjectSetBuild( FC_FAMILY,
333
                                                    FC_STYLE,
398
                                                    FC_STYLE,
Lines 342-347 Link Here
342
                                                    (void *) NULL );
407
                                                    (void *) NULL );
343
    FcPattern* pPattern = rWrapper.FcPatternCreate();
408
    FcPattern* pPattern = rWrapper.FcPatternCreate();
344
    FcFontSet* pFSet = rWrapper.FcFontList( pConfig, pPattern, pOSet );
409
    FcFontSet* pFSet = rWrapper.FcFontList( pConfig, pPattern, pOSet );
410
//    It should using getFontSet to replace getDefConfig in none locale no match OOo localize version.
411
//    FcFontSet* pFSet = rWrapper.getFontSet();
345
412
346
    if( pFSet )
413
    if( pFSet )
347
    {
414
    {
Lines 386-391 Link Here
386
                     );
453
                     );
387
#endif
454
#endif
388
455
456
            OSL_ASSERT(eOutRes != FcResultMatch || outline);
457
389
            // only outline fonts are usable to psprint anyway
458
            // only outline fonts are usable to psprint anyway
390
            if( eOutRes == FcResultMatch && ! outline )
459
            if( eOutRes == FcResultMatch && ! outline )
391
                continue;
460
                continue;
Lines 539-552 Link Here
539
        }
608
        }
540
    }
609
    }
541
    
610
    
542
    // cleanup
543
    if( pPattern )
544
        rWrapper.FcPatternDestroy( pPattern );
545
    if( pFSet )
546
        rWrapper.FcFontSetDestroy( pFSet );
547
    if( pOSet )
548
        rWrapper.FcObjectSetDestroy( pOSet );
549
    
550
    // how does one get rid of the config ?
611
    // how does one get rid of the config ?
551
#if OSL_DEBUG_LEVEL > 1
612
#if OSL_DEBUG_LEVEL > 1
552
    fprintf( stderr, "inserted %d fonts from fontconfig\n", nFonts );
613
    fprintf( stderr, "inserted %d fonts from fontconfig\n", nFonts );
Lines 560-598 Link Here
560
    FontCfgWrapper::release();
621
    FontCfgWrapper::release();
561
}
622
}
562
623
563
bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale )
624
static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, 
625
	italic::type eItalic, weight::type eWeight, width::type eWidth, pitch::type ePitch)
564
{
626
{
565
#ifdef ENABLE_FONTCONFIG
627
#ifdef ENABLE_FONTCONFIG
566
    FontCfgWrapper& rWrapper = FontCfgWrapper::get();
628
    if( eItalic != italic::Unknown )
567
    if( ! rWrapper.isValid() )
568
        return false;
569
570
    FcConfig* pConfig = rWrapper.getDefConfig();
571
    FcPattern* pPattern = rWrapper.FcPatternCreate();
572
573
    OString aLangAttrib;
574
    // populate pattern with font characteristics
575
    if( rLocale.Language.getLength() )
576
    {
577
        OUStringBuffer aLang(6);
578
        aLang.append( rLocale.Language );
579
        if( rLocale.Country.getLength() )
580
        {
581
            aLang.append( sal_Unicode('-') );
582
            aLang.append( rLocale.Country );
583
        }
584
        aLangAttrib = OUStringToOString( aLang.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
585
    }
586
    if( aLangAttrib.getLength() )
587
        rWrapper.FcPatternAddString( pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr() );
588
589
    OString aFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 );
590
    if( aFamily.getLength() )
591
        rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)aFamily.getStr() );
592
    if( rInfo.m_eItalic != italic::Unknown )
593
    {
629
    {
594
        int nSlant = FC_SLANT_ROMAN;
630
        int nSlant = FC_SLANT_ROMAN;
595
        switch( rInfo.m_eItalic )
631
        switch( eItalic )
596
        {
632
        {
597
            case italic::Italic:	 	nSlant = FC_SLANT_ITALIC;break;
633
            case italic::Italic:	 	nSlant = FC_SLANT_ITALIC;break;
598
            case italic::Oblique:	 	nSlant = FC_SLANT_OBLIQUE;break;
634
            case italic::Oblique:	 	nSlant = FC_SLANT_OBLIQUE;break;
Lines 601-610 Link Here
601
        }
637
        }
602
        rWrapper.FcPatternAddInteger( pPattern, FC_SLANT, nSlant );
638
        rWrapper.FcPatternAddInteger( pPattern, FC_SLANT, nSlant );
603
    }
639
    }
604
    if( rInfo.m_eWeight != weight::Unknown )
640
    if( eWeight != weight::Unknown )
605
    {
641
    {
606
        int nWeight = FC_WEIGHT_NORMAL;
642
        int nWeight = FC_WEIGHT_NORMAL;
607
        switch( rInfo.m_eWeight )
643
        switch( eWeight )
608
        {
644
        {
609
            case weight::Thin:			nWeight = FC_WEIGHT_THIN;break;
645
            case weight::Thin:			nWeight = FC_WEIGHT_THIN;break;
610
            case weight::UltraLight:	nWeight = FC_WEIGHT_ULTRALIGHT;break;
646
            case weight::UltraLight:	nWeight = FC_WEIGHT_ULTRALIGHT;break;
Lines 621-630 Link Here
621
        }
657
        }
622
        rWrapper.FcPatternAddInteger( pPattern, FC_WEIGHT, nWeight );
658
        rWrapper.FcPatternAddInteger( pPattern, FC_WEIGHT, nWeight );
623
    }
659
    }
624
    if( rInfo.m_eWidth != width::Unknown )
660
    if( eWidth != width::Unknown )
625
    {
661
    {
626
        int nWidth = FC_WIDTH_NORMAL;
662
        int nWidth = FC_WIDTH_NORMAL;
627
        switch( rInfo.m_eWidth )
663
        switch( eWidth )
628
        {
664
        {
629
            case width::UltraCondensed:	nWidth = FC_WIDTH_ULTRACONDENSED;break;
665
            case width::UltraCondensed:	nWidth = FC_WIDTH_ULTRACONDENSED;break;
630
            case width::ExtraCondensed: nWidth = FC_WIDTH_EXTRACONDENSED;break;
666
            case width::ExtraCondensed: nWidth = FC_WIDTH_EXTRACONDENSED;break;
Lines 640-649 Link Here
640
        }
676
        }
641
        rWrapper.FcPatternAddInteger( pPattern, FC_WIDTH, nWidth );
677
        rWrapper.FcPatternAddInteger( pPattern, FC_WIDTH, nWidth );
642
    }
678
    }
643
    if( rInfo.m_ePitch != pitch::Unknown )
679
    if( ePitch != pitch::Unknown )
644
    {
680
    {
645
        int nSpacing = FC_PROPORTIONAL;
681
        int nSpacing = FC_PROPORTIONAL;
646
        switch( rInfo.m_ePitch )
682
        switch( ePitch )
647
        {
683
        {
648
            case pitch::Fixed:			nSpacing = FC_MONO;break;
684
            case pitch::Fixed:			nSpacing = FC_MONO;break;
649
            case pitch::Variable:		nSpacing = FC_PROPORTIONAL;break;
685
            case pitch::Variable:		nSpacing = FC_PROPORTIONAL;break;
Lines 651-662 Link Here
651
                break;
687
                break;
652
        }
688
        }
653
        rWrapper.FcPatternAddInteger( pPattern, FC_SPACING, nSpacing );
689
        rWrapper.FcPatternAddInteger( pPattern, FC_SPACING, nSpacing );
690
        if (nSpacing == FC_MONO)
691
            rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)"monospace");
692
    }
693
#endif
694
}
695
696
String PrintFontManager::Substitute(const std::vector<String> &rNames, const std::vector<sal_Unicode> &rGlyphs,
697
        const ByteString &rLangAttrib, italic::type eItalic, weight::type eWeight,
698
        width::type eWidth, pitch::type ePitch) const
699
{
700
    String aName;
701
#ifdef ENABLE_FONTCONFIG
702
    FontCfgWrapper& rWrapper = FontCfgWrapper::get();
703
    if( ! rWrapper.isValid() )
704
        return aName;
705
706
    FcFontSet*  pSet = NULL;
707
    FcPattern*  pPattern = rWrapper.FcPatternCreate();
708
709
    // Prefer scalable fonts
710
    rWrapper.FcPatternAddBool( pPattern, FC_SCALABLE, 1 );
711
712
    std::vector<String>::const_iterator aEnd = rNames.end();
713
    for (std::vector<String>::const_iterator aIter = rNames.begin(); aIter != aEnd; ++aIter)
714
    {
715
	    OString maTargetName = OUStringToOString(*aIter, RTL_TEXTENCODING_UTF8);
716
        rWrapper.FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)maTargetName.getStr());
717
        break;
654
    }
718
    }
655
719
720
    if( rLangAttrib.Len() )
721
        rWrapper.FcPatternAddString(pPattern, FC_LANG, (FcChar8*)rLangAttrib.GetBuffer());
722
723
    // Add required Unicode characters, if any
724
    FcCharSet *unicodes = NULL;
725
    if (! rGlyphs.empty() )
726
    {
727
        unicodes = rWrapper.FcCharSetCreate();
728
	    std::vector<sal_Unicode>::const_iterator aGlyphEnd = rGlyphs.end();
729
	    for (std::vector<sal_Unicode>::const_iterator aGlyphIter = rGlyphs.begin(); 
730
            aGlyphIter != aGlyphEnd; ++aGlyphIter)
731
	    {
732
            rWrapper.FcCharSetAddChar( unicodes, (FcChar32)*aGlyphIter );
733
	    }
734
        rWrapper.FcPatternAddCharSet( pPattern, FC_CHARSET, unicodes);
735
    }
736
737
    addtopattern(rWrapper, pPattern, eItalic, eWeight, eWidth, ePitch);
738
739
    rWrapper.FcConfigSubstitute( NULL, pPattern, FcMatchPattern );
740
    rWrapper.FcDefaultSubstitute( pPattern );
741
    FcResult eResult = FcResultNoMatch;
742
    FcFontSet *pFontSet = rWrapper.getFontSet();
743
    FcPattern* pResult = rWrapper.FcFontSetMatch( NULL, &pFontSet, 1, pPattern, &eResult );
744
    rWrapper.FcPatternDestroy( pPattern );
745
746
    if( pResult )
747
    {
748
        pSet = rWrapper.FcFontSetCreate();
749
        // info: destroying the pSet destroys pResult implicitly
750
        // since pResult was "added" to pSet
751
        rWrapper.FcFontSetAdd( pSet, pResult );
752
    }
753
754
    if( pSet )
755
    {
756
        if( pSet->nfont > 0 )
757
        {
758
            //extract the closest match
759
            FcChar8* family = NULL;
760
            FcResult eFileRes = rWrapper.FcPatternGetString( pSet->fonts[0], FC_FAMILY, 0, &family );
761
            if( eFileRes == FcResultMatch )
762
                aName = String( (sal_Char*)family, RTL_TEXTENCODING_UTF8 );
763
        }
764
    }
765
    rWrapper.FcFontSetDestroy( pSet );
766
#endif
767
    return aName;
768
}
769
770
bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale )
771
{
772
#ifdef ENABLE_FONTCONFIG
773
    FontCfgWrapper& rWrapper = FontCfgWrapper::get();
774
    if( ! rWrapper.isValid() )
775
        return false;
776
777
    FcConfig* pConfig = rWrapper.getDefConfig();
778
    FcPattern* pPattern = rWrapper.FcPatternCreate();
779
780
    OString aLangAttrib;
781
    // populate pattern with font characteristics
782
    if( rLocale.Language.getLength() )
783
    {
784
        OUStringBuffer aLang(6);
785
        aLang.append( rLocale.Language );
786
        if( rLocale.Country.getLength() )
787
        {
788
            aLang.append( sal_Unicode('-') );
789
            aLang.append( rLocale.Country );
790
        }
791
        aLangAttrib = OUStringToOString( aLang.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
792
    }
793
    if( aLangAttrib.getLength() )
794
        rWrapper.FcPatternAddString( pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr() );
795
796
    OString aFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 );
797
    if( aFamily.getLength() )
798
        rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)aFamily.getStr() );
799
800
    addtopattern(rWrapper, pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch);
801
656
    rWrapper.FcConfigSubstitute( pConfig, pPattern, FcMatchPattern );
802
    rWrapper.FcConfigSubstitute( pConfig, pPattern, FcMatchPattern );
657
    rWrapper.FcDefaultSubstitute( pPattern );
803
    rWrapper.FcDefaultSubstitute( pPattern );
658
    FcResult eResult = FcResultNoMatch;
804
    FcResult eResult = FcResultNoMatch;
659
    FcPattern* pResult = rWrapper.FcFontMatch( pConfig, pPattern, &eResult );
805
    FcFontSet *pFontSet = rWrapper.getFontSet();
806
    FcPattern* pResult = rWrapper.FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult );
660
    bool bSuccess = false;
807
    bool bSuccess = false;
661
    if( pResult )
808
    if( pResult )
662
    {
809
    {
(-)ood680-m1/psprint/source/fontmanager/fontmanager.cxx (-4 / +5 lines)
Lines 1158-1164 Link Here
1158
        m_nNextFontID( 1 ),
1158
        m_nNextFontID( 1 ),
1159
        m_pAtoms( new MultiAtomProvider() ),
1159
        m_pAtoms( new MultiAtomProvider() ),
1160
        m_nNextDirAtom( 1 ),
1160
        m_nNextDirAtom( 1 ),
1161
        m_pFontCache( NULL )
1161
        m_pFontCache( NULL ),
1162
	m_bFontconfigSuccess(false)
1162
{
1163
{
1163
    for( unsigned int i = 0; i < sizeof( aAdobeCodes )/sizeof( aAdobeCodes[0] ); i++ )
1164
    for( unsigned int i = 0; i < sizeof( aAdobeCodes )/sizeof( aAdobeCodes[0] ); i++ )
1164
    {
1165
    {
Lines 2117-2123 Link Here
2117
#endif
2118
#endif
2118
2119
2119
    // first try fontconfig
2120
    // first try fontconfig
2120
    bool bFontconfigSuccess = initFontconfig();
2121
    m_bFontconfigSuccess = initFontconfig();
2121
2122
2122
    // part one - look for downloadable fonts
2123
    // part one - look for downloadable fonts
2123
    rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
2124
    rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
Lines 2139-2145 Link Here
2139
    }
2140
    }
2140
2141
2141
    // don't search through many directories fontconfig already told us about
2142
    // don't search through many directories fontconfig already told us about
2142
    if( ! bFontconfigSuccess )
2143
    if( ! m_bFontconfigSuccess )
2143
    {							
2144
    {							
2144
        Display *pDisplay = (Display*)pInitDisplay;
2145
        Display *pDisplay = (Display*)pInitDisplay;
2145
        
2146
        
Lines 2217-2223 Link Here
2217
            }
2218
            }
2218
        }
2219
        }
2219
#endif /* SOLARIS */
2220
#endif /* SOLARIS */
2220
    } // ! bFontconfigSuccess
2221
    } // ! m_bFontconfigSuccess
2221
2222
2222
    // fill XLFD aliases from fonts.alias files
2223
    // fill XLFD aliases from fonts.alias files
2223
    initFontsAlias();
2224
    initFontsAlias();
(-)ood680-m1/vcl/inc/outdev.h (-1 / +2 lines)
Lines 213-219 Link Here
213
                             const Font& rFont, const Size& rSize, ImplFontSubstEntry* pDevSpecific );
213
                             const Font& rFont, const Size& rSize, ImplFontSubstEntry* pDevSpecific );
214
    ImplFontEntry*      GetFallback( ImplDevFontList* pFontList,
214
    ImplFontEntry*      GetFallback( ImplDevFontList* pFontList,
215
                                     const Font& rFont, const Size& rSize,
215
                                     const Font& rFont, const Size& rSize,
216
                                     int nFallbackLevel );
216
                                     int nFallbackLevel, sal_Unicode *pMissingUnicodes,
217
                                     int nMissingUnicodes );
217
    void                Release( ImplFontEntry* );
218
    void                Release( ImplFontEntry* );
218
    void                Invalidate();
219
    void                Invalidate();
219
};
220
};
(-)ood680-m1/vcl/inc/outfont.hxx (+15 lines)
Lines 230-235 Link Here
230
    ImplDevFontListData*    FindFontFamily( const String& rFontName ) const;
230
    ImplDevFontListData*    FindFontFamily( const String& rFontName ) const;
231
    ImplDevFontListData*    ImplFindByFont( ImplFontSelectData&, bool bPrinter, ImplFontSubstEntry* pDevSpecificSubst ) const;
231
    ImplDevFontListData*    ImplFindByFont( ImplFontSelectData&, bool bPrinter, ImplFontSubstEntry* pDevSpecificSubst ) const;
232
    ImplDevFontListData*    ImplFindBySearchName( const String& ) const;
232
    ImplDevFontListData*    ImplFindBySearchName( const String& ) const;
233
    ImplDevFontListData*    ImplGetFontconfigSubstitute( ImplFontSelectData &rFontSelData, ImplFontSubstEntry* pDevSpecific );
233
234
234
    bool                    HasFallbacks() const;
235
    bool                    HasFallbacks() const;
235
    void                    SetFallbacks( ImplDevFontListData**, int nCount );
236
    void                    SetFallbacks( ImplDevFontListData**, int nCount );
Lines 333-338 Link Here
333
                        ImplFontEntry( const ImplFontSelectData& );
334
                        ImplFontEntry( const ImplFontSelectData& );
334
    virtual             ~ImplFontEntry() {}
335
    virtual             ~ImplFontEntry() {}
335
336
337
    // cache of Unicode characters and replacement font names
338
    typedef ::std::hash_map<sal_Unicode,String> UnicodeFallbackList;
339
    UnicodeFallbackList maUnicodeFallbackList;
340
336
public: // TODO: make data members private
341
public: // TODO: make data members private
337
    ImplFontSelectData  maFontSelData;      // FontSelectionData
342
    ImplFontSelectData  maFontSelData;      // FontSelectionData
338
    ImplFontMetricData  maMetric;           // Font Metric
343
    ImplFontMetricData  maMetric;           // Font Metric
Lines 343-348 Link Here
343
    short               mnOwnOrientation;   // text angle if lower layers don't rotate text themselves
348
    short               mnOwnOrientation;   // text angle if lower layers don't rotate text themselves
344
    short               mnOrientation;      // text angle in 3600 system
349
    short               mnOrientation;      // text angle in 3600 system
345
    bool                mbInit;             // true if maMetric member is valid
350
    bool                mbInit;             // true if maMetric member is valid
351
352
    void                AddFallbackForUnicode( sal_Unicode ch, String fallback )
353
                            { maUnicodeFallbackList[ch] = fallback; }
354
    String              GetFallbackForUnicode( sal_Unicode ch )
355
                            {
356
                                UnicodeFallbackList::const_iterator it = maUnicodeFallbackList.find( ch );
357
                                if ( it != maUnicodeFallbackList.end() )
358
                                    return (*it).second;
359
                                return String();
360
                            }
346
};
361
};
347
362
348
363
(-)ood680-m1/vcl/source/gdi/outdev3.cxx (-137 / +370 lines)
Lines 165-170 Link Here
165
#include <memory>
165
#include <memory>
166
#include <algorithm>
166
#include <algorithm>
167
167
168
#include <psprint/fontmanager.hxx>
169
#include <i18npool/mslangid.hxx>
170
168
// =======================================================================
171
// =======================================================================
169
172
170
DBG_NAMEEX( OutputDevice )
173
DBG_NAMEEX( OutputDevice )
Lines 385-390 Link Here
385
388
386
// =======================================================================
389
// =======================================================================
387
390
391
static unsigned ImplIsCJK( const sal_Unicode* pStr )
392
{
393
    while ( *pStr )
394
    {
395
        // japanese
396
        if ( ((*pStr >= 0x3040) && (*pStr <= 0x30FF)) ||
397
             ((*pStr >= 0x3190) && (*pStr <= 0x319F)) )
398
            return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_JP;
399
400
        // korean
401
        if ( ((*pStr >= 0xAC00) && (*pStr <= 0xD7AF)) ||
402
             ((*pStr >= 0x3130) && (*pStr <= 0x318F)) ||
403
             ((*pStr >= 0x1100) && (*pStr <= 0x11FF)) )
404
            return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_KR;
405
406
        // chinese
407
        if ( ((*pStr >= 0x3400) && (*pStr <= 0x9FFF)) )
408
            return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_TC|IMPL_FONT_ATTR_CJK_SC;
409
410
        // cjk
411
        if ( ((*pStr >= 0x3000) && (*pStr <= 0xD7AF)) ||
412
             ((*pStr >= 0xFF00) && (*pStr <= 0xFFEE)) )
413
            return IMPL_FONT_ATTR_CJK;
414
415
        pStr++;
416
    }
417
418
    return 0;
419
}
420
421
static unsigned ImplIsCJKFont( const String& rFontName )
422
{
423
    // Test, if Fontname includes CJK characters --> In this case we
424
    // mention that it is a CJK font
425
    const sal_Unicode* pStr = rFontName.GetBuffer();
426
    return ImplIsCJK( pStr );
427
}
428
429
430
// =======================================================================
431
388
struct ImplLocalizedFontName
432
struct ImplLocalizedFontName
389
{
433
{
390
    const char*         mpEnglishName;
434
    const char*         mpEnglishName;
Lines 589-596 Link Here
589
{   "baekmukbatang",        aBaekmukBatang },
633
{   "baekmukbatang",        aBaekmukBatang },
590
{   "fzheiti",              aFzHeiTiCN },
634
{   "fzheiti",              aFzHeiTiCN },
591
{   "fzheiti",              aFzHeiTiTW },
635
{   "fzheiti",              aFzHeiTiTW },
592
{   "fzkaiti",              aFzHeiTiCN },
636
{   "fzkaiti",              aFzKaiTiCN },
593
{   "fzkaiti",              aFzHeiTiTW },
637
{   "fzkaiti",              aFzKaiTiTW },
594
{   "fzmingti",             aFzMingTi },
638
{   "fzmingti",             aFzMingTi },
595
{   "fzsongti",             aFzSongTi },
639
{   "fzsongti",             aFzSongTi },
596
{   "hymyeongjoextra",      aHYMyeongJoExtra },
640
{   "hymyeongjoextra",      aHYMyeongJoExtra },
Lines 765-770 Link Here
765
    }
809
    }
766
}
810
}
767
811
812
// ----------------------------------------------------------------------
813
814
void ImplGetLocolizeFontNameSearchFontName( String& rName )
815
{
816
    xub_StrLen  nLen = rName.Len();
817
    if( !nLen )
818
        return;
819
    if( ImplIsCJKFont( rName ) )
820
        return;
821
822
    String aTempName;
823
    //do not using hash_map because Chinese english fonts name is not unique 
824
    const ImplLocalizedFontName* pList = aImplLocalizedNamesList;
825
    for(; pList->mpEnglishName; ++pList ){
826
    String aTemp( pList->mpEnglishName,  RTL_TEXTENCODING_UTF8 ) ;
827
        if( aTemp == rName.ToLowerAscii() ){
828
            aTempName.Append( pList->mpLocalizedNames );
829
            aTempName.Append( ';' );
830
        }
831
    }
832
    if( aTempName.Len() )
833
        rName = aTempName;
834
}
835
768
// -----------------------------------------------------------------------
836
// -----------------------------------------------------------------------
769
837
770
static String GetNextFontToken( const String& rTokenStr, xub_StrLen& rIndex )
838
static String GetNextFontToken( const String& rTokenStr, xub_StrLen& rIndex )
Lines 1300-1340 Link Here
1300
    return aName;
1368
    return aName;
1301
}
1369
}
1302
1370
1303
// =======================================================================
1304
1305
static unsigned ImplIsCJKFont( const String& rFontName )
1306
{
1307
    // Test, if Fontname includes CJK characters --> In this case we
1308
    // mention that it is a CJK font
1309
    const sal_Unicode* pStr = rFontName.GetBuffer();
1310
    while ( *pStr )
1311
    {
1312
        // japanese
1313
        if ( ((*pStr >= 0x3040) && (*pStr <= 0x30FF)) ||
1314
             ((*pStr >= 0x3190) && (*pStr <= 0x319F)) )
1315
            return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_JP;
1316
1317
        // korean
1318
        if ( ((*pStr >= 0xAC00) && (*pStr <= 0xD7AF)) ||
1319
             ((*pStr >= 0x3130) && (*pStr <= 0x318F)) ||
1320
             ((*pStr >= 0x1100) && (*pStr <= 0x11FF)) )
1321
            return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_KR;
1322
1323
        // chinese
1324
        if ( ((*pStr >= 0x3400) && (*pStr <= 0x9FFF)) )
1325
            return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_TC|IMPL_FONT_ATTR_CJK_SC;
1326
1327
        // cjk
1328
        if ( ((*pStr >= 0x3000) && (*pStr <= 0xD7AF)) ||
1329
             ((*pStr >= 0xFF00) && (*pStr <= 0xFFEE)) )
1330
            return IMPL_FONT_ATTR_CJK;
1331
1332
        pStr++;
1333
    }
1334
1335
    return 0;
1336
}
1337
1338
// -----------------------------------------------------------------------
1371
// -----------------------------------------------------------------------
1339
1372
1340
static void ImplCalcType( ULONG& rType, FontWeight& rWeight, FontWidth& rWidth,
1373
static void ImplCalcType( ULONG& rType, FontWeight& rWeight, FontWidth& rWidth,
Lines 2646-2651 Link Here
2646
    }
2679
    }
2647
}
2680
}
2648
2681
2682
2683
// -----------------------------------------------------------------------
2684
2685
String GetFcSubstitute(const ImplFontSelectData &rFontSelData, sal_Unicode *pMissingGlyphs=0, int nMissingGlyphs=0)
2686
{
2687
    std::vector<String> aNames;
2688
    std::vector<sal_Unicode> aGlyphs;
2689
    ByteString aLangAttrib = MsLangId::convertLanguageToIsoByteString( rFontSelData.meLanguage );
2690
    for (int i=0; i < nMissingGlyphs; ++i){
2691
	    aGlyphs.push_back(pMissingGlyphs[i]);
2692
        sal_uInt32 nLangType = ImplIsCJK( pMissingGlyphs );
2693
        switch( nLangType ){
2694
            case IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_JP:
2695
                aLangAttrib = MsLangId::convertLanguageToIsoByteString( LANGUAGE_JAPANESE );
2696
                break;
2697
            case IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_KR:
2698
                aLangAttrib = MsLangId::convertLanguageToIsoByteString( LANGUAGE_KOREAN );
2699
                break;
2700
            case IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_TC|IMPL_FONT_ATTR_CJK_SC:
2701
                aLangAttrib = MsLangId::convertLanguageToIsoByteString( LANGUAGE_CHINESE );
2702
                break;
2703
            //TODO
2704
            //CJK extention B
2705
            case IMPL_FONT_ATTR_CJK: break;
2706
            default:
2707
                break;
2708
        }
2709
    }
2710
    if( rFontSelData.GetFamilyName().Len() )
2711
    {
2712
        sal_uInt16 nIndex = 0;
2713
	String aTempName;
2714
        do
2715
        {
2716
                aTempName = GetNextFontToken(rFontSelData.GetFamilyName(), nIndex);
2717
		aNames.push_back(aTempName);
2718
        }
2719
        while (nIndex != STRING_NOTFOUND);
2720
    }
2721
2722
    psp::italic::type eItalic = psp::italic::Unknown;
2723
    if( rFontSelData.GetSlant() != ITALIC_DONTKNOW )
2724
    {
2725
        switch( rFontSelData.GetSlant() )
2726
        {
2727
            case ITALIC_NORMAL:  eItalic = psp::italic::Italic; break;
2728
            case ITALIC_OBLIQUE: eItalic = psp::italic::Oblique; break;
2729
            default:
2730
                break;
2731
        }
2732
    }
2733
2734
    psp::weight::type eWeight = psp::weight::Unknown;
2735
    if( rFontSelData.GetWeight() != WEIGHT_DONTKNOW )
2736
    {
2737
        switch( rFontSelData.GetWeight() )
2738
        {
2739
            case WEIGHT_THIN:		eWeight = psp::weight::Thin; break;
2740
            case WEIGHT_ULTRALIGHT:	eWeight = psp::weight::UltraLight; break;
2741
            case WEIGHT_LIGHT:		eWeight = psp::weight::Light; break;
2742
            case WEIGHT_SEMILIGHT:	eWeight = psp::weight::SemiLight; break;
2743
            case WEIGHT_NORMAL:		eWeight = psp::weight::Normal; break;
2744
            case WEIGHT_MEDIUM:		eWeight = psp::weight::Medium; break;
2745
            case WEIGHT_SEMIBOLD:	eWeight = psp::weight::SemiBold; break;
2746
            case WEIGHT_BOLD:		eWeight = psp::weight::Bold; break;
2747
            case WEIGHT_ULTRABOLD:	eWeight = psp::weight::UltraBold; break;
2748
            case WEIGHT_BLACK:		eWeight = psp::weight::Black; break;
2749
            default:
2750
                break;
2751
        }
2752
    }
2753
2754
    psp::width::type eWidth = psp::width::Unknown;
2755
    if( rFontSelData.GetWidthType() != WIDTH_DONTKNOW )
2756
    {
2757
        switch( rFontSelData.GetWidthType() )
2758
        {
2759
            case WIDTH_ULTRA_CONDENSED:	eWidth = psp::width::UltraCondensed; break;
2760
            case WIDTH_EXTRA_CONDENSED: eWidth = psp::width::ExtraCondensed; break;
2761
            case WIDTH_CONDENSED:	eWidth = psp::width::Condensed; break;
2762
            case WIDTH_SEMI_CONDENSED:	eWidth = psp::width::SemiCondensed; break;
2763
            case WIDTH_NORMAL:		eWidth = psp::width::Normal; break;
2764
            case WIDTH_SEMI_EXPANDED:	eWidth = psp::width::SemiExpanded; break;
2765
            case WIDTH_EXPANDED:	eWidth = psp::width::Expanded; break;
2766
            case WIDTH_EXTRA_EXPANDED:	eWidth = psp::width::ExtraExpanded; break;
2767
            case WIDTH_ULTRA_EXPANDED:	eWidth = psp::width::UltraExpanded; break;
2768
            default:
2769
                break;
2770
        }
2771
    }
2772
2773
    psp::pitch::type ePitch = psp::pitch::Unknown;
2774
    if( rFontSelData.GetPitch() != PITCH_DONTKNOW )
2775
    {
2776
        switch(  rFontSelData.GetPitch() )
2777
        {
2778
            case PITCH_FIXED:    ePitch=psp::pitch::Fixed; break;
2779
            case PITCH_VARIABLE: ePitch=psp::pitch::Variable; break;
2780
            default:
2781
                break;
2782
        }
2783
    }
2784
2785
    const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
2786
    return rMgr.Substitute(aNames, aGlyphs, aLangAttrib, eItalic, eWeight, eWidth, ePitch);
2787
}
2788
2789
// -----------------------------------------------------------------------
2790
2791
ImplDevFontListData *ImplDevFontList::ImplGetFontconfigSubstitute( ImplFontSelectData &rFontSelData, ImplFontSubstEntry* pDevSpecific )
2792
{
2793
    // We dont' actually want to talk to Fontconfig at all for symbol fonts
2794
    if (rFontSelData.IsSymbolFont())
2795
        return 0;
2796
    // StarSymbol is a unicode font, but it still deserves the symbol flag
2797
    if( 0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "starsymbol", 10)
2798
        ||  0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "opensymbol", 10) )
2799
        return 0;
2800
2801
    String aTempName = rFontSelData.GetFamilyName();
2802
    // Try CJK localize name to English name convertion.
2803
    if(ImplIsCJKFont( aTempName ) ){
2804
        ImplGetEnglishSearchFontName( aTempName );
2805
        DevFontList::const_iterator end = maDevFontList.end();
2806
        for( DevFontList::const_iterator it = maDevFontList.begin(); it != end; it++){
2807
            String aName = (*it).second->GetFamilyName();
2808
            if( aTempName == aName.ToLowerAscii() )
2809
            {
2810
                rFontSelData.maName = aTempName;
2811
                break;
2812
            }    
2813
        }
2814
    }
2815
    else
2816
    {
2817
        ImplGetLocolizeFontNameSearchFontName( aTempName );
2818
        DevFontList::const_iterator end = maDevFontList.end();
2819
        sal_uInt16 nIndex = 0;
2820
        String aTestName; 
2821
        bool find = false;
2822
        do
2823
        {
2824
            aTestName = GetNextFontToken( aTempName, nIndex );
2825
            for( DevFontList::const_iterator it = maDevFontList.begin(); it != end; it++){
2826
                String aName = (*it).second->GetFamilyName();
2827
                if( aTestName == aName )
2828
                {
2829
                    rFontSelData.maName = aTestName;
2830
                    find = true;
2831
                }    
2832
            }
2833
            if( find )
2834
                break;
2835
        }
2836
        while (nIndex != STRING_NOTFOUND);
2837
    }
2838
    String aName(GetFcSubstitute(rFontSelData));
2839
    if (!aName.Len())
2840
        return 0;
2841
2842
    String aUserName(aName);
2843
    ImplGetEnglishSearchFontName( aName );
2844
    ImplFontSubstitute( aName, FONT_SUBSTITUTE_ALWAYS, pDevSpecific );
2845
    ImplDevFontListData *pFontFamily = ImplFindBySearchName( aName );
2846
    if (pFontFamily)
2847
        rFontSelData.maTargetName = aUserName;
2848
2849
    return pFontFamily;
2850
}
2851
2852
2649
// -----------------------------------------------------------------------
2853
// -----------------------------------------------------------------------
2650
2854
2651
ImplFontEntry* ImplFontCache::Get( ImplDevFontList* pFontList,
2855
ImplFontEntry* ImplFontCache::Get( ImplDevFontList* pFontList,
Lines 2683-2690 Link Here
2683
2887
2684
    if( !pEntry ) // no direct cache hit
2888
    if( !pEntry ) // no direct cache hit
2685
    {
2889
    {
2686
        // find the best matching logical font family and update font selector accordingly
2890
        pFontFamily = pFontList->ImplGetFontconfigSubstitute( aFontSelData, pDevSpecific );
2687
        pFontFamily = pFontList->ImplFindByFont( aFontSelData, mbPrinter, pDevSpecific );
2891
        if (!pFontFamily)
2892
        {
2893
            // find the best matching logical font family and update font selector accordingly
2894
            pFontFamily = pFontList->ImplFindByFont( aFontSelData, mbPrinter, pDevSpecific );
2895
        }
2688
        DBG_ASSERT( (pFontFamily != NULL), "ImplFontCache::Get() No logical font found!" );
2896
        DBG_ASSERT( (pFontFamily != NULL), "ImplFontCache::Get() No logical font found!" );
2689
	if( pFontFamily )
2897
	if( pFontFamily )
2690
		aFontSelData.maSearchName = pFontFamily->GetSearchName();
2898
		aFontSelData.maSearchName = pFontFamily->GetSearchName();
Lines 3005-3120 Link Here
3005
// -----------------------------------------------------------------------
3213
// -----------------------------------------------------------------------
3006
3214
3007
ImplFontEntry* ImplFontCache::GetFallback( ImplDevFontList* pFontList,
3215
ImplFontEntry* ImplFontCache::GetFallback( ImplDevFontList* pFontList,
3008
    const Font& rOrigFont, const Size& rSize, int nFallbackLevel )
3216
     const Font& rOrigFont, const Size& rSize, int nFallbackLevel,
3217
     sal_Unicode *pMissingUnicodes, int nMissingUnicodes )
3009
{
3218
{
3010
    // make sure the fontlist knows it's fallbacks
3219
    ImplFontEntry*      pFallbackFont = NULL;
3011
    if( !pFontList->HasFallbacks() )
3220
    bool                cached = false;
3012
    {
3221
    bool                new_entry = false;
3013
        // normalized family names of fonts suited for glyph fallback
3222
    bool                symbolFont = false;
3014
        // if a font is available related fonts can be ignored
3223
    ImplFontEntry*      pOrigFontEntry = Get( pFontList, rOrigFont, rSize, NULL );
3015
        // TODO: implement dynamic lists
3224
    ImplFontSelectData  aSelData( rOrigFont, rOrigFont.GetName(), rSize );
3016
        static const char* aGlyphFallbackList[] = {
3225
    sal_uInt16          nToken = 0;
3017
            // empty strings separate the names of unrelated fonts
3226
    String              aOrigFontName( GetNextFontToken(rOrigFont.GetName(), nToken) );
3018
            "eudc", "",
3227
3019
            "arialunicodems", "cyberbit", "code2000", "",
3228
    const FontNameAttr* fontAttr = FontSubstConfiguration::get()->getSubstInfo( aOrigFontName );
3020
            "andalesansui", "",
3229
3021
            "starsymbol", "opensymbol", "",
3230
    // We dont' actually want to talk to Fontconfig at all for symbol fonts
3022
            "msmincho", "fzmingti", "fzheiti", "ipamincho", "sazanamimincho", "kochimincho", "",
3231
    if ( pFontList && fontAttr && (fontAttr->Type & IMPL_FONT_ATTR_SYMBOL) )
3023
            "sunbatang", "sundotum", "baekmukdotum", "gulim", "batang", "dotum", "",
3232
    {
3024
            "hgmincholightj", "msunglightsc", "msunglighttc", "hymyeongjolightk", "",
3233
        if ( fontAttr->Substitutions.size() )
3025
            "tahoma", "timesnewroman", "lucidatypewriter", "lucidasans", "nimbussansl", "",
3234
        {
3026
            "shree", "mangal", "raavi", "shruti", "tunga", "latha", "",
3235
            ::std::vector< String >::const_iterator it = fontAttr->Substitutions.begin();
3027
            "shayyalmt", "naskmt", "",
3236
            while ( it != fontAttr->Substitutions.end() )
3028
            "david", "nachlieli", "lucidagrande", "",
3237
            {
3029
            "norasi", "angsanaupc", "",
3238
                // Since *it is the "search name" like "standardsymbolsl"
3030
            "khmerossystem", "",
3239
                // we have to find the Family Name (Standard Symbols L) for Fontconfig
3031
	    "phetsarathot", "",
3240
                ImplDevFontListData* pFontFamily = pFontList->FindFontFamily( *it );
3032
            0
3241
                if (pFontFamily)
3033
        };
3242
                {
3034
3243
                    aSelData.maSearchName = pFontFamily->GetFamilyName();
3035
        bool bHasEudc = false;
3036
        int nMaxLevel = 0;
3037
        int nBestQuality = 0;
3038
        ImplDevFontListData** pFallbackList = NULL;
3039
        for( const char** ppNames = &aGlyphFallbackList[0];; ++ppNames )
3040
        {
3041
            // advance to next sub-list when end-of-sublist marker
3042
            if( !**ppNames )    // #i46456# check for empty string, i.e., deref string itself not only ptr to it
3043
            {
3044
                if( nBestQuality > 0 )
3045
                    if( ++nMaxLevel >= MAX_FALLBACK )
3046
                        break;
3047
                if( !ppNames[1] )
3048
                    break;
3244
                    break;
3049
                nBestQuality = 0;
3245
                }
3050
                continue;
3246
                ++it;
3051
            }
3247
            }
3248
        }
3249
        symbolFont = true;
3250
        cached = true;
3251
    }
3052
3252
3053
            // test if the glyph fallback candidate font is available and scalable
3253
    // Try cached fallbacks first
3054
            String aTokenName( *ppNames, RTL_TEXTENCODING_UTF8 );
3254
    if ( !symbolFont && (nMissingUnicodes > 0) )
3055
            ImplDevFontListData* pFallbackFont = pFontList->FindFontFamily( aTokenName );
3255
    {
3056
            if( !pFallbackFont )
3256
        aSelData.maSearchName = pOrigFontEntry->GetFallbackForUnicode( pMissingUnicodes[0] );
3057
                continue;
3257
        if ( aSelData.maSearchName.Len() )
3058
            if( !pFallbackFont->IsScalable() )
3258
            cached = true;
3059
                continue;
3259
    }
3060
3260
3061
            // keep the best font of the glyph fallback sub-list
3261
    if ( !cached )
3062
            if( nBestQuality < pFallbackFont->GetMinQuality() )
3262
    {
3063
            {
3263
        // find a font family suited for glyph fallback
3064
                nBestQuality = pFallbackFont->GetMinQuality();
3264
        String aTempName = aSelData.GetFamilyName();
3065
                // store available glyph fallback fonts
3265
        //If the font not in the fontlist, it should set the family name as empty 
3066
                if( !pFallbackList )
3266
        //to prevent return the same name. maybe this is a bug of fontconfig
3067
                    pFallbackList = new ImplDevFontListData*[ MAX_FALLBACK ];
3267
        if(  !pFontList->FindFontFamily( aTempName ) )
3068
                pFallbackList[ nMaxLevel ] = pFallbackFont;
3268
            aSelData.maName = String();
3069
                if( !bHasEudc && !nMaxLevel )
3269
        String aName(GetFcSubstitute( aSelData, pMissingUnicodes, nMissingUnicodes ));
3070
                    bHasEudc = (0 == strncmp( *ppNames, "eudc", 5 ));
3270
      if (aName.Len())
3071
            }
3271
            aSelData.maSearchName = aName;
3072
        }
3272
    }
3073
3273
3074
        // sort the list of fonts for glyph fallback by quality (highest first)
3274
    // Check our font instance cache first, if not found then
3075
        // #i33947# keep the EUDC font at the front of the list
3275
    // add this ImplFontSelectData to the cache along with its ImplFontEntry
3076
        // an insertion sort is good enough for this short list
3276
    FontInstanceList::const_iterator it = maFontInstanceList.find( aSelData );
3077
        const int nSortStart = bHasEudc ? 1 : 0;
3277
    if (it != maFontInstanceList.end())
3078
        for( int i = nSortStart+1, j; i < nMaxLevel; ++i )
3278
        pFallbackFont = (*it).second;
3079
        {
3279
    else
3080
            ImplDevFontListData* pTestFont = pFallbackList[ i ];
3280
    {
3081
            int nTestQuality = pTestFont->GetMinQuality();
3281
        // find the best matching physical font face
3082
            for( j = i; --j >= nSortStart; )
3282
        ImplDevFontListData* pFontFamily = pFontList->FindFontFamily( aSelData.maSearchName );
3083
                if( nTestQuality > pFallbackList[j]->GetMinQuality() )
3283
        if (pFontFamily)
3084
                    pFallbackList[ j+1 ] = pFallbackList[ j ];
3284
        {
3085
                else
3285
            ImplFontData* pFontData = pFontFamily->FindBestFontFace( aSelData );
3086
                    break;
3087
            pFallbackList[ j+1 ] = pTestFont;
3088
        }
3089
3286
3090
#if defined(HDU_DEBUG)
3287
            // create a new logical font instance from this physical font face
3091
        for( int i = 0; i < nMaxLevel; ++i )
3288
            aSelData.mpFontData = pFontData;
3289
            pFallbackFont = pFontData->CreateFontInstance( aSelData );
3290
3291
            // if we found a different symbol font we need a symbol conversion table
3292
            if( pFontData->IsSymbolFont() )
3293
                if( aSelData.maTargetName != aSelData.maSearchName )
3294
                    pFallbackFont->mpConversion = ImplGetRecodeData( aSelData.maTargetName, aSelData.maSearchName );
3295
            // add the new entry to the cache
3296
            maFontInstanceList[ aSelData ] = pFallbackFont;
3297
            new_entry = true;
3298
        }
3299
        else
3092
        {
3300
        {
3093
            ImplDevFontListData* pFont = pFallbackList[ i ];
3301
            ByteString l( aSelData.maSearchName, RTL_TEXTENCODING_UTF8 );
3094
            ByteString aFontName( pFont->GetFamilyName(), RTL_TEXTENCODING_UTF8 );
3302
            //fprintf (stderr, "--- Couldn't get FontFamily for '%s'\n", l.GetBuffer());
3095
            fprintf( stderr, "GlyphFallbackFont[%d] (quality=%05d): \"%s\"\n",
3096
                i, pFont->GetMinQuality(), aFontName.GetBuffer() );
3097
        }
3303
        }
3098
#endif
3099
3100
        pFontList->SetFallbacks( pFallbackList, nMaxLevel );
3101
    }
3304
    }
3102
3305
3103
    Font aFallbackFont = rOrigFont;
3306
    // Cache the fallback font for each of the missing Unicode chars
3104
3307
    if ( !symbolFont && aSelData.maSearchName.Len() )
3105
    // nFallbackLevel==0 => original font without device specific substitution
3106
    // nFallbackLevel>=1 => use a font from the glyph fallback font list
3107
    if( nFallbackLevel>=1 )
3108
    {
3308
    {
3109
        ImplDevFontListData* pFallbackData = pFontList->GetFallback( nFallbackLevel-1 );
3309
        for ( int i = 0; i < nMissingUnicodes; i++ )
3110
        if( !pFallbackData )
3310
        {
3111
            return NULL;
3311
            if ( ! pOrigFontEntry->GetFallbackForUnicode(pMissingUnicodes[i]).Len() )
3112
3312
                pOrigFontEntry->AddFallbackForUnicode( pMissingUnicodes[i], aSelData.maSearchName );
3113
        aFallbackFont.SetName( pFallbackData->GetSearchName() );
3313
        }
3114
    }
3314
    }
3115
3315
3116
    ImplFontEntry* pFallbackFont = Get( pFontList, aFallbackFont, rSize, NULL );
3117
3118
    if( pFallbackFont && !pFallbackFont->mbInit )
3316
    if( pFallbackFont && !pFallbackFont->mbInit )
3119
    {
3317
    {
3120
        // HACK: maMetrics are irrelevant for fallback fonts, but
3318
        // HACK: maMetrics are irrelevant for fallback fonts, but
Lines 3123-3128 Link Here
3123
        pFallbackFont->maMetric.maStyleName = String();
3321
        pFallbackFont->maMetric.maStyleName = String();
3124
    }
3322
    }
3125
3323
3324
    if ( pFallbackFont && !new_entry )
3325
    {
3326
        // increase the font instance's reference count
3327
        if( !pFallbackFont->mnRefCount++ )
3328
            --mnRef0Count;
3329
    }
3330
3331
#if 0
3332
    sal_uInt16 nTok = 0;
3333
    ByteString n( GetNextFontToken(rOrigFont.GetName(), nTok), RTL_TEXTENCODING_UTF8);
3334
    ByteString m;
3335
    if (pFallbackFont)
3336
    {
3337
        nTok = 0;
3338
        ByteString tS( GetNextFontToken(pFallbackFont->maFontSelData.mpFontData->GetFamilyName(), nTok), RTL_TEXTENCODING_UTF8 );
3339
        m.Assign( tS );
3340
    }
3341
    fprintf (stderr, "Glyph fallback '%s'->'%s' %s\n", n.GetBuffer(), pFallbackFont ? m.GetBuffer() : "none",
3342
                new_entry ? "(new)" : "(cached)");
3343
#endif
3344
3126
    return pFallbackFont;
3345
    return pFallbackFont;
3127
}
3346
}
3128
3347
Lines 6078-6084 Link Here
6078
    // do glyph fallback if needed
6297
    // do glyph fallback if needed
6079
    // #105768# avoid fallback for very small font sizes
6298
    // #105768# avoid fallback for very small font sizes
6080
    if( aLayoutArgs.NeedFallback() )
6299
    if( aLayoutArgs.NeedFallback() )
6081
        if( mpFontEntry && (mpFontEntry->maFontSelData.mnHeight >= 6) )
6300
        if( mpFontEntry && (mpFontEntry->maFontSelData.mnHeight >= 3) )
6082
            pSalLayout = ImplGlyphFallbackLayout( pSalLayout, aLayoutArgs );
6301
            pSalLayout = ImplGlyphFallbackLayout( pSalLayout, aLayoutArgs );
6083
6302
6084
    // position, justify, etc. the layout
6303
    // position, justify, etc. the layout
Lines 6122-6127 Link Here
6122
        rLayoutArgs.ResetPos();
6341
        rLayoutArgs.ResetPos();
6123
    }
6342
    }
6124
#endif
6343
#endif
6344
    int nCharPos = -1;
6345
    bool bRTL = false;
6346
    sal_Unicode *pMissingUnicodes = new sal_Unicode[1];
6347
    int nMissingUnicodes = 0;
6348
6349
    for( int i=0; i<1 && rLayoutArgs.GetNextPos( &nCharPos, &bRTL); ++i )
6350
    {
6351
        pMissingUnicodes[i] = rLayoutArgs.mpStr[ nCharPos ];
6352
        nMissingUnicodes++;
6353
    }
6354
    rLayoutArgs.ResetPos();
6125
6355
6126
    ImplFontSelectData aFontSelData = mpFontEntry->maFontSelData;
6356
    ImplFontSelectData aFontSelData = mpFontEntry->maFontSelData;
6127
    Size aFontSize( aFontSelData.mnWidth, aFontSelData.mnHeight );
6357
    Size aFontSize( aFontSelData.mnWidth, aFontSelData.mnHeight );
Lines 6138-6144 Link Here
6138
    {
6368
    {
6139
        // find a font family suited for glyph fallback
6369
        // find a font family suited for glyph fallback
6140
        ImplFontEntry* pFallbackFont = mpFontCache->GetFallback( mpFontList,
6370
        ImplFontEntry* pFallbackFont = mpFontCache->GetFallback( mpFontList,
6141
            maFont, aFontSize, nFallbackLevel-nDevSpecificFallback );
6371
            maFont, aFontSize, nFallbackLevel-nDevSpecificFallback,
6372
            (nMissingUnicodes ? pMissingUnicodes : NULL), nMissingUnicodes );
6142
        if( !pFallbackFont )
6373
        if( !pFallbackFont )
6143
            break;
6374
            break;
6144
6375
Lines 6190-6195 Link Here
6190
            break;
6421
            break;
6191
    }
6422
    }
6192
6423
6424
    delete[] pMissingUnicodes;
6425
6193
    if( pMultiSalLayout && pMultiSalLayout->LayoutText( rLayoutArgs ) )
6426
    if( pMultiSalLayout && pMultiSalLayout->LayoutText( rLayoutArgs ) )
6194
        pSalLayout = pMultiSalLayout;
6427
        pSalLayout = pMultiSalLayout;
6195
6428
(-)ood680-m1/vcl/source/window/window.cxx (-1 / +6 lines)
Lines 194-199 Link Here
194
#endif
194
#endif
195
195
196
#include <pdfextoutdevdata.hxx>
196
#include <pdfextoutdevdata.hxx>
197
#include <psprint/fontmanager.hxx>
197
198
198
using namespace rtl;
199
using namespace rtl;
199
using namespace ::com::sun::star::uno;
200
using namespace ::com::sun::star::uno;
Lines 339-344 Link Here
339
340
340
bool Window::ImplCheckUIFont( const Font& rFont )
341
bool Window::ImplCheckUIFont( const Font& rFont )
341
{
342
{
343
    const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
344
    if (rMgr.hasFontconfig())
345
        return true;
346
342
    String aTestText;
347
    String aTestText;
343
    aTestText.Append( Button::GetStandardText( BUTTON_OK ) );
348
    aTestText.Append( Button::GetStandardText( BUTTON_OK ) );
344
    aTestText.Append( Button::GetStandardText( BUTTON_CANCEL ) );
349
    aTestText.Append( Button::GetStandardText( BUTTON_CANCEL ) );
Lines 5584-5590 Link Here
5584
    DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5589
    DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5585
5590
5586
    const Window* pWin = this;
5591
    const Window* pWin = this;
5587
    while ( pWin && !pWin->IsSystemWindow() )
5592
    while ( !pWin->IsSystemWindow() )
5588
        pWin  = pWin->GetParent();
5593
        pWin  = pWin->GetParent();
5589
    return (SystemWindow*)pWin;
5594
    return (SystemWindow*)pWin;
5590
}
5595
}
(-)ood680-m1/vcl/util/makefile.mk (-1 / +1 lines)
Lines 234-240 Link Here
234
SHL1STDLIBS += -framework Cocoa
234
SHL1STDLIBS += -framework Cocoa
235
.ENDIF
235
.ENDIF
236
236
237
SHL1STDLIBS += -lX11
237
SHL1STDLIBS += -lX11 -lpsp$(VERSION)$(DLLPOSTFIX)
238
238
239
.IF "$(OS)"=="MACOSX"
239
.IF "$(OS)"=="MACOSX"
240
SHL1STDLIBS += -framework Foundation -framework CoreFoundation
240
SHL1STDLIBS += -framework Foundation -framework CoreFoundation

Return to issue 54603