~ubuntu-branches/ubuntu/karmic/openoffice.org-l10n/karmic

« back to all changes in this revision

Viewing changes to ooo-build/patches/src680/framework-nofocussteal.diff

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-04-27 19:29:22 UTC
  • Revision ID: james.westby@ubuntu.com-20060427192922-2dburxv3b63f8v0u
Tags: 2.0.2-2ubuntu5
* Copy of the openoffice.org source.
  - debian/control.in: Change source name.
  - debian/changelog: Change source name.
  - debian/control: Regenerate control file.
* Add kurdish translations exported from Rosetta (2006-04-18).
* Workaround bad message strings in recently included GSI files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
diff -ru vcl.preconfig/inc/outdev.h vcl/inc/outdev.h
2
 
--- openoffice.org.orig/vcl/inc/outdev.h        2005-09-12 13:37:38.000000000 +0100
3
 
+++ vcl/inc/outdev.h    2005-09-12 14:10:15.000000000 +0100
4
 
@@ -239,7 +239,8 @@
5
 
                              const Font& rFont, const Size& rSize, ImplFontSubstEntry* pDevSpecific );
6
 
     ImplFontEntry*      GetFallback( ImplDevFontList* pFontList,
7
 
                                      const Font& rFont, const Size& rSize,
8
 
-                                     int nFallbackLevel );
9
 
+                                     int nFallbackLevel, sal_Unicode *pMissingUnicodes,
10
 
+                                     int nMissingUnicodes );
11
 
     void                Release( ImplFontEntry* );
12
 
     void                Invalidate();
13
 
 };
14
 
diff -ru vcl.preconfig/inc/outfont.hxx vcl/inc/outfont.hxx
15
 
--- openoffice.org.orig/vcl/inc/outfont.hxx     2005-09-12 13:37:38.000000000 +0100
16
 
+++ vcl/inc/outfont.hxx 2005-09-12 14:48:01.000000000 +0100
17
 
@@ -252,6 +252,7 @@
18
 
     ImplDevFontListData*    FindFontFamily( const String& rFontName ) const;
19
 
     ImplDevFontListData*    ImplFindByFont( ImplFontSelectData&, bool bPrinter, ImplFontSubstEntry* pDevSpecificSubst ) const;
20
 
     ImplDevFontListData*    ImplFindBySearchName( const String& ) const;
21
 
+    ImplDevFontListData*    ImplGetFontconfigSubstitute( ImplFontSelectData &rFontSelData, ImplFontSubstEntry* pDevSpecific );
22
 
 
23
 
     bool                    HasFallbacks() const;
24
 
     void                    SetFallbacks( ImplDevFontListData**, int nCount );
25
 
@@ -354,6 +355,10 @@
26
 
                         ImplFontEntry( const ImplFontSelectData& );
27
 
     virtual             ~ImplFontEntry() {}
28
 
 
29
 
+    // cache of Unicode characters and replacement font names
30
 
+    typedef ::std::hash_map<sal_Unicode,String> UnicodeFallbackList;
31
 
+    UnicodeFallbackList maUnicodeFallbackList;
32
 
+
33
 
 public: // TODO: make data members private
34
 
     ImplFontSelectData  maFontSelData;      // FontSelectionData
35
 
     ImplFontMetricData  maMetric;           // Font Metric
36
 
@@ -364,6 +369,16 @@
37
 
     short               mnOwnOrientation;   // text angle if lower layers don't rotate text themselves
38
 
     short               mnOrientation;      // text angle in 3600 system
39
 
     bool                mbInit;             // true if maMetric member is valid
40
 
+
41
 
+    void                AddFallbackForUnicode( sal_Unicode ch, String fallback )
42
 
+                            { maUnicodeFallbackList[ch] = fallback; }
43
 
+    String              GetFallbackForUnicode( sal_Unicode ch )
44
 
+                            {
45
 
+                                UnicodeFallbackList::const_iterator it = maUnicodeFallbackList.find( ch );
46
 
+                                if ( it != maUnicodeFallbackList.end() )
47
 
+                                    return (*it).second;
48
 
+                                return String();
49
 
+                            }
50
 
 };
51
 
 
52
 
 
53
 
diff -ru vcl.preconfig/source/gdi/outdev3.cxx vcl/source/gdi/outdev3.cxx
54
 
--- openoffice.org.orig/vcl/source/gdi/outdev3.cxx      2005-09-12 13:37:04.000000000 +0100
55
 
+++ vcl/source/gdi/outdev3.cxx  2005-09-12 15:26:08.000000000 +0100
56
 
@@ -168,6 +168,9 @@
57
 
 #include <memory>
58
 
 #include <algorithm>
59
 
 
60
 
+#include <psprint/fontmanager.hxx>
61
 
+#include <tools/isolang.hxx>
62
 
+
63
 
 // =======================================================================
64
 
 
65
 
 DBG_NAMEEX( OutputDevice );
66
 
@@ -2656,6 +2659,124 @@ ImplFontCache::~ImplFontCache()
67
 
     }
68
 
 }
69
 
 
70
 
+
71
 
+// -----------------------------------------------------------------------
72
 
+
73
 
+String GetFcSubstitute(const ImplFontSelectData &rFontSelData, sal_Unicode *pMissingGlyphs=0, int nMissingGlyphs=0)
74
 
+{
75
 
+    std::vector<String> aNames;
76
 
+    if( rFontSelData.GetFamilyName().Len() )
77
 
+    {
78
 
+        sal_uInt16 nIndex = 0;
79
 
+       String aTempName;
80
 
+        do
81
 
+        {
82
 
+                aTempName = GetNextFontToken(rFontSelData.GetFamilyName(), nIndex);
83
 
+               aNames.push_back(aTempName);
84
 
+        }
85
 
+        while (nIndex != STRING_NOTFOUND);
86
 
+    }
87
 
+
88
 
+    std::vector<sal_Unicode> aGlyphs;
89
 
+    for (int i=0; i < nMissingGlyphs; ++i)
90
 
+       aGlyphs.push_back(pMissingGlyphs[i]);
91
 
+
92
 
+    ByteString aLangAttrib = ConvertLanguageToIsoByteString( rFontSelData.meLanguage );
93
 
+
94
 
+    psp::italic::type eItalic = psp::italic::Unknown;
95
 
+    if( rFontSelData.GetSlant() != ITALIC_DONTKNOW )
96
 
+    {
97
 
+        switch( rFontSelData.GetSlant() )
98
 
+        {
99
 
+            case ITALIC_NORMAL:  eItalic = psp::italic::Italic; break;
100
 
+            case ITALIC_OBLIQUE: eItalic = psp::italic::Oblique; break;
101
 
+            default:
102
 
+                break;
103
 
+        }
104
 
+    }
105
 
+
106
 
+    psp::weight::type eWeight = psp::weight::Unknown;
107
 
+    if( rFontSelData.GetWeight() != WEIGHT_DONTKNOW )
108
 
+    {
109
 
+        switch( rFontSelData.GetWeight() )
110
 
+        {
111
 
+            case WEIGHT_THIN:          eWeight = psp::weight::Thin; break;
112
 
+            case WEIGHT_ULTRALIGHT:    eWeight = psp::weight::UltraLight; break;
113
 
+            case WEIGHT_LIGHT:         eWeight = psp::weight::Light; break;
114
 
+            case WEIGHT_SEMILIGHT:     eWeight = psp::weight::SemiLight; break;
115
 
+            case WEIGHT_NORMAL:                eWeight = psp::weight::Normal; break;
116
 
+            case WEIGHT_MEDIUM:                eWeight = psp::weight::Medium; break;
117
 
+            case WEIGHT_SEMIBOLD:      eWeight = psp::weight::SemiBold; break;
118
 
+            case WEIGHT_BOLD:          eWeight = psp::weight::Bold; break;
119
 
+            case WEIGHT_ULTRABOLD:     eWeight = psp::weight::UltraBold; break;
120
 
+            case WEIGHT_BLACK:         eWeight = psp::weight::Black; break;
121
 
+            default:
122
 
+                break;
123
 
+        }
124
 
+    }
125
 
+
126
 
+    psp::width::type eWidth = psp::width::Unknown;
127
 
+    if( rFontSelData.GetWidthType() != WIDTH_DONTKNOW )
128
 
+    {
129
 
+        switch( rFontSelData.GetWidthType() )
130
 
+        {
131
 
+            case WIDTH_ULTRA_CONDENSED:        eWidth = psp::width::UltraCondensed; break;
132
 
+            case WIDTH_EXTRA_CONDENSED: eWidth = psp::width::ExtraCondensed; break;
133
 
+            case WIDTH_CONDENSED:      eWidth = psp::width::Condensed; break;
134
 
+            case WIDTH_SEMI_CONDENSED: eWidth = psp::width::SemiCondensed; break;
135
 
+            case WIDTH_NORMAL:         eWidth = psp::width::Normal; break;
136
 
+            case WIDTH_SEMI_EXPANDED:  eWidth = psp::width::SemiExpanded; break;
137
 
+            case WIDTH_EXPANDED:       eWidth = psp::width::Expanded; break;
138
 
+            case WIDTH_EXTRA_EXPANDED: eWidth = psp::width::ExtraExpanded; break;
139
 
+            case WIDTH_ULTRA_EXPANDED: eWidth = psp::width::UltraExpanded; break;
140
 
+            default:
141
 
+                break;
142
 
+        }
143
 
+    }
144
 
+
145
 
+    psp::pitch::type ePitch = psp::pitch::Unknown;
146
 
+    if( rFontSelData.GetPitch() != PITCH_DONTKNOW )
147
 
+    {
148
 
+        switch(  rFontSelData.GetPitch() )
149
 
+        {
150
 
+            case PITCH_FIXED:    ePitch=psp::pitch::Fixed; break;
151
 
+            case PITCH_VARIABLE: ePitch=psp::pitch::Variable; break;
152
 
+            default:
153
 
+                break;
154
 
+        }
155
 
+    }
156
 
+
157
 
+    const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
158
 
+    return rMgr.Substitute(aNames, aGlyphs, aLangAttrib, eItalic, eWeight, eWidth, ePitch);
159
 
+}
160
 
+
161
 
+// -----------------------------------------------------------------------
162
 
+
163
 
+ImplDevFontListData *ImplDevFontList::ImplGetFontconfigSubstitute( ImplFontSelectData &rFontSelData, ImplFontSubstEntry* pDevSpecific )
164
 
+{
165
 
+    // We dont' actually want to talk to Fontconfig at all for symbol fonts
166
 
+    if (rFontSelData.IsSymbolFont())
167
 
+        return 0;
168
 
+    // StarSymbol is a unicode font, but it still deserves the symbol flag
169
 
+    if( 0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "starsymbol", 10)
170
 
+        ||  0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "opensymbol", 10) )
171
 
+        return 0;
172
 
+
173
 
+    String aName(GetFcSubstitute(rFontSelData));
174
 
+    if (!aName.Len())
175
 
+        return 0;
176
 
+
177
 
+    String aUserName(aName);
178
 
+    ImplGetEnglishSearchFontName( aName );
179
 
+    ImplFontSubstitute( aName, FONT_SUBSTITUTE_ALWAYS, pDevSpecific );
180
 
+    ImplDevFontListData *pFontFamily = ImplFindBySearchName( aName );
181
 
+    if (pFontFamily)
182
 
+        rFontSelData.maTargetName = aUserName;
183
 
+
184
 
+    return pFontFamily;
185
 
+}
186
 
+
187
 
+
188
 
 // -----------------------------------------------------------------------
189
 
 
190
 
 ImplFontEntry* ImplFontCache::Get( ImplDevFontList* pFontList,
191
 
@@ -2693,8 +2814,12 @@ ImplFontEntry* ImplFontCache::Get( ImplD
192
 
 
193
 
     if( !pEntry ) // no direct cache hit
194
 
     {
195
 
-        // find the best matching logical font family and update font selector accordingly
196
 
-        pFontFamily = pFontList->ImplFindByFont( aFontSelData, mbPrinter, pDevSpecific );
197
 
+        pFontFamily = pFontList->ImplGetFontconfigSubstitute( aFontSelData, pDevSpecific );
198
 
+        if (!pFontFamily)
199
 
+        {
200
 
+            // find the best matching logical font family and update font selector accordingly
201
 
+            pFontFamily = pFontList->ImplFindByFont( aFontSelData, mbPrinter, pDevSpecific );
202
 
+        }
203
 
         DBG_ASSERT( (pFontFamily != NULL), "ImplFontCache::Get() No logical font found!" );
204
 
         aFontSelData.maSearchName = pFontFamily->GetSearchName();
205
 
 
206
 
@@ -3014,116 +3139,101 @@ ImplDevFontListData* ImplDevFontList::Im
207
 
 // -----------------------------------------------------------------------
208
 
 
209
 
 ImplFontEntry* ImplFontCache::GetFallback( ImplDevFontList* pFontList,
210
 
-    const Font& rOrigFont, const Size& rSize, int nFallbackLevel )
211
 
+     const Font& rOrigFont, const Size& rSize, int nFallbackLevel,
212
 
+     sal_Unicode *pMissingUnicodes, int nMissingUnicodes )
213
 
 {
214
 
-    // make sure the fontlist knows it's fallbacks
215
 
-    if( !pFontList->HasFallbacks() )
216
 
+    ImplFontEntry*      pFallbackFont = NULL;
217
 
+    bool                cached = false;
218
 
+    bool                new_entry = false;
219
 
+    bool                symbolFont = false;
220
 
+    ImplFontEntry*      pOrigFontEntry = Get( pFontList, rOrigFont, rSize, NULL );
221
 
+    ImplFontSelectData  aSelData( rOrigFont, rOrigFont.GetName(), rSize );
222
 
+    sal_uInt16          nToken = 0;
223
 
+    String              aOrigFontName( GetNextFontToken(rOrigFont.GetName(), nToken) );
224
 
+
225
 
+    const FontSubstConfigItem& rFontSubst = *FontSubstConfigItem::get();
226
 
+    const FontNameAttr* fontAttr = rFontSubst.getSubstInfo( aOrigFontName );
227
 
+
228
 
+    // We dont' actually want to talk to Fontconfig at all for symbol fonts
229
 
+    if ( pFontList && fontAttr && (fontAttr->Type & IMPL_FONT_ATTR_SYMBOL) )
230
 
     {
231
 
-        // normalized family names of fonts suited for glyph fallback
232
 
-        // if a font is available related fonts can be ignored
233
 
-        // TODO: implement dynamic lists
234
 
-        static const char* aGlyphFallbackList[] = {
235
 
-            // empty strings separate the names of unrelated fonts
236
 
-            "eudc", "",
237
 
-            "arialunicodems", "cyberbit", "code2000", "",
238
 
-            "andalesansui", "",
239
 
-            "starsymbol", "opensymbol", "",
240
 
-            "msmincho", "fzmingti", "fzheiti", "ipamincho", "sazanamimincho", "kochimincho", "",
241
 
-            "sunbatang", "sundotum", "baekmukdotum", "gulim", "batang", "dotum", "",
242
 
-            "hgmincholightj", "msunglightsc", "msunglighttc", "hymyeongjolightk", "",
243
 
-            "tahoma", "timesnewroman", "lucidatypewriter", "lucidasans", "nimbussansl", "",
244
 
-            "shree", "mangal", "raavi", "shruti", "tunga", "latha", "",
245
 
-            "shayyalmt", "naskmt", "",
246
 
-            "david", "nachlieli", "lucidagrande", "",
247
 
-            "norasi", "angsanaupc", "",
248
 
-            "khmerossystem", "",
249
 
-           "phetsarathot", "",
250
 
-            0
251
 
-        };
252
 
-
253
 
-        bool bHasEudc = false;
254
 
-        int nMaxLevel = 0;
255
 
-        int nBestQuality = 0;
256
 
-        ImplDevFontListData** pFallbackList = NULL;
257
 
-        for( const char** ppNames = &aGlyphFallbackList[0];; ++ppNames )
258
 
+        if ( fontAttr->Substitutions.size() )
259
 
         {
260
 
-            // advance to next sub-list when end-of-sublist marker
261
 
-            if( !**ppNames )    // #i46456# check for empty string, i.e., deref string itself not only ptr to it
262
 
+            ::std::vector< String >::const_iterator it = fontAttr->Substitutions.begin();
263
 
+            while ( it != fontAttr->Substitutions.end() )
264
 
             {
265
 
-                if( nBestQuality > 0 )
266
 
-                    if( ++nMaxLevel >= MAX_FALLBACK )
267
 
-                        break;
268
 
-                if( !ppNames[1] )
269
 
+                // Since *it is the "search name" like "standardsymbolsl"
270
 
+                // we have to find the Family Name (Standard Symbols L) for Fontconfig
271
 
+                ImplDevFontListData* pFontFamily = pFontList->FindFontFamily( *it );
272
 
+                if (pFontFamily)
273
 
+                {
274
 
+                    aSelData.maSearchName = pFontFamily->GetFamilyName();
275
 
                     break;
276
 
-                nBestQuality = 0;
277
 
-                continue;
278
 
+                }
279
 
+                ++it;
280
 
             }
281
 
+        }
282
 
+        symbolFont = true;
283
 
+        cached = true;
284
 
+    }
285
 
 
286
 
-            // test if the glyph fallback candidate font is available and scalable
287
 
-            String aTokenName( *ppNames, RTL_TEXTENCODING_UTF8 );
288
 
-            ImplDevFontListData* pFallbackFont = pFontList->FindFontFamily( aTokenName );
289
 
-            if( !pFallbackFont )
290
 
-                continue;
291
 
-            if( !pFallbackFont->IsScalable() )
292
 
-                continue;
293
 
+    // Try cached fallbacks first
294
 
+    if ( !symbolFont && (nMissingUnicodes > 0) )
295
 
+    {
296
 
+        aSelData.maSearchName = pOrigFontEntry->GetFallbackForUnicode( pMissingUnicodes[0] );
297
 
+        if ( aSelData.maSearchName.Len() )
298
 
+            cached = true;
299
 
+    }
300
 
 
301
 
-            // keep the best font of the glyph fallback sub-list
302
 
-            if( nBestQuality < pFallbackFont->GetMinQuality() )
303
 
-            {
304
 
-                nBestQuality = pFallbackFont->GetMinQuality();
305
 
-                // store available glyph fallback fonts
306
 
-                if( !pFallbackList )
307
 
-                    pFallbackList = new ImplDevFontListData*[ MAX_FALLBACK ];
308
 
-                pFallbackList[ nMaxLevel ] = pFallbackFont;
309
 
-                if( !bHasEudc && !nMaxLevel )
310
 
-                    bHasEudc = (0 == strncmp( *ppNames, "eudc", 5 ));
311
 
-            }
312
 
-        }
313
 
+    if ( !cached )
314
 
+    {
315
 
+        String aName(GetFcSubstitute( aSelData, pMissingUnicodes, nMissingUnicodes ));
316
 
+      if (aName.Len())
317
 
+            aSelData.maSearchName = aName;
318
 
+    }
319
 
 
320
 
-        // sort the list of fonts for glyph fallback by quality (highest first)
321
 
-        // #i33947# keep the EUDC font at the front of the list
322
 
-        // an insertion sort is good enough for this short list
323
 
-        const int nSortStart = bHasEudc ? 1 : 0;
324
 
-        for( int i = nSortStart+1, j; i < nMaxLevel; ++i )
325
 
-        {
326
 
-            ImplDevFontListData* pTestFont = pFallbackList[ i ];
327
 
-            int nTestQuality = pTestFont->GetMinQuality();
328
 
-            for( j = i; --j >= nSortStart; )
329
 
-                if( nTestQuality > pFallbackList[j]->GetMinQuality() )
330
 
-                    pFallbackList[ j+1 ] = pFallbackList[ j ];
331
 
-                else
332
 
-                    break;
333
 
-            pFallbackList[ j+1 ] = pTestFont;
334
 
-        }
335
 
+    // Check our font instance cache first, if not found then
336
 
+    // add this ImplFontSelectData to the cache along with its ImplFontEntry
337
 
+    FontInstanceList::const_iterator it = maFontInstanceList.find( aSelData );
338
 
+    if (it != maFontInstanceList.end())
339
 
+        pFallbackFont = (*it).second;
340
 
+    else
341
 
+    {
342
 
+        // find the best matching physical font face
343
 
+        ImplDevFontListData* pFontFamily = pFontList->FindFontFamily( aSelData.maSearchName );
344
 
+        if (pFontFamily)
345
 
+        {
346
 
+            ImplFontData* pFontData = pFontFamily->FindBestFontFace( aSelData );
347
 
 
348
 
-#if defined(HDU_DEBUG)
349
 
-        for( int i = 0; i < nMaxLevel; ++i )
350
 
+            // create a new logical font instance from this physical font face
351
 
+            aSelData.mpFontData = pFontData;
352
 
+            pFallbackFont = pFontData->CreateFontInstance( aSelData );
353
 
+
354
 
+            // if we found a different symbol font we need a symbol conversion table
355
 
+            if( pFontData->IsSymbolFont() )
356
 
+                if( aSelData.maTargetName != aSelData.maSearchName )
357
 
+                    pFallbackFont->mpConversion = ImplGetRecodeData( aSelData.maTargetName, aSelData.maSearchName );
358
 
+            // add the new entry to the cache
359
 
+            maFontInstanceList[ aSelData ] = pFallbackFont;
360
 
+            new_entry = true;
361
 
+        }
362
 
+        else
363
 
         {
364
 
-            ImplDevFontListData* pFont = pFallbackList[ i ];
365
 
-            ByteString aFontName( pFont->GetFamilyName(), RTL_TEXTENCODING_UTF8 );
366
 
-            fprintf( stderr, "GlyphFallbackFont[%d] (quality=%05d): \"%s\"\n",
367
 
-                i, pFont->GetMinQuality(), aFontName.GetBuffer() );
368
 
+            ByteString l( aSelData.maSearchName, RTL_TEXTENCODING_UTF8 );
369
 
+            //fprintf (stderr, "--- Couldn't get FontFamily for '%s'\n", l.GetBuffer());
370
 
         }
371
 
-#endif
372
 
-
373
 
-        pFontList->SetFallbacks( pFallbackList, nMaxLevel );
374
 
     }
375
 
 
376
 
-    Font aFallbackFont = rOrigFont;
377
 
-
378
 
-    // nFallbackLevel==0 => original font without device specific substitution
379
 
-    // nFallbackLevel>=1 => use a font from the glyph fallback font list
380
 
-    if( nFallbackLevel>=1 )
381
 
+    // Cache the fallback font for each of the missing Unicode chars
382
 
+    if ( !symbolFont && aSelData.maSearchName.Len() )
383
 
     {
384
 
-        ImplDevFontListData* pFallbackData = pFontList->GetFallback( nFallbackLevel-1 );
385
 
-        if( !pFallbackData )
386
 
-            return NULL;
387
 
-
388
 
-        aFallbackFont.SetName( pFallbackData->GetSearchName() );
389
 
+        for ( int i = 0; i < nMissingUnicodes; i++ )
390
 
+        {
391
 
+            if ( ! pOrigFontEntry->GetFallbackForUnicode(pMissingUnicodes[i]).Len() )
392
 
+                pOrigFontEntry->AddFallbackForUnicode( pMissingUnicodes[i], aSelData.maSearchName );
393
 
+        }
394
 
     }
395
 
 
396
 
-    ImplFontEntry* pFallbackFont = Get( pFontList, aFallbackFont, rSize, NULL );
397
 
-
398
 
     if( pFallbackFont && !pFallbackFont->mbInit )
399
 
     {
400
 
         // HACK: maMetrics are irrelevant for fallback fonts, but
401
 
@@ -3131,6 +3242,27 @@ ImplFontEntry* ImplFontCache::GetFallbac
402
 
         pFallbackFont->maMetric.maStyleName = String();
403
 
     }
404
 
 
405
 
+    if ( pFallbackFont && !new_entry )
406
 
+    {
407
 
+        // increase the font instance's reference count
408
 
+        if( !pFallbackFont->mnRefCount++ )
409
 
+            --mnRef0Count;
410
 
+    }
411
 
+
412
 
+#if 0
413
 
+    sal_uInt16 nTok = 0;
414
 
+    ByteString n( GetNextFontToken(rOrigFont.GetName(), nTok), RTL_TEXTENCODING_UTF8);
415
 
+    ByteString m;
416
 
+    if (pFallbackFont)
417
 
+    {
418
 
+        nTok = 0;
419
 
+        ByteString tS( GetNextFontToken(pFallbackFont->maFontSelData.mpFontData->GetFamilyName(), nTok), RTL_TEXTENCODING_UTF8 );
420
 
+        m.Assign( tS );
421
 
+    }
422
 
+    fprintf (stderr, "Glyph fallback '%s'->'%s' %s\n", n.GetBuffer(), pFallbackFont ? m.GetBuffer() : "none",
423
 
+                new_entry ? "(new)" : "(cached)");
424
 
+#endif
425
 
+
426
 
     return pFallbackFont;
427
 
 }
428
 
 
429
 
@@ -6097,7 +6229,7 @@ SalLayout* OutputDevice::ImplLayout( con
430
 
     // do glyph fallback if needed
431
 
     // #105768# avoid fallback for very small font sizes
432
 
     if( aLayoutArgs.NeedFallback() )
433
 
-        if( mpFontEntry && (mpFontEntry->maFontSelData.mnHeight >= 6) )
434
 
+        if( mpFontEntry && (mpFontEntry->maFontSelData.mnHeight >= 3) )
435
 
             pSalLayout = ImplGlyphFallbackLayout( pSalLayout, aLayoutArgs );
436
 
 
437
 
     // position, justify, etc. the layout
438
 
@@ -6141,6 +6273,17 @@ SalLayout* OutputDevice::ImplGlyphFallba
439
 
         rLayoutArgs.ResetPos();
440
 
     }
441
 
 #endif
442
 
+    int nCharPos = -1;
443
 
+    bool bRTL = false;
444
 
+    sal_Unicode *pMissingUnicodes = new sal_Unicode[8];
445
 
+    int nMissingUnicodes = 0;
446
 
+
447
 
+    for( int i=0; i<8 && rLayoutArgs.GetNextPos( &nCharPos, &bRTL); ++i )
448
 
+    {
449
 
+        pMissingUnicodes[i] = rLayoutArgs.mpStr[ nCharPos ];
450
 
+        nMissingUnicodes++;
451
 
+    }
452
 
+    rLayoutArgs.ResetPos();
453
 
 
454
 
     ImplFontSelectData aFontSelData = mpFontEntry->maFontSelData;
455
 
     Size aFontSize( aFontSelData.mnWidth, aFontSelData.mnHeight );
456
 
@@ -6157,7 +6300,8 @@ SalLayout* OutputDevice::ImplGlyphFallba
457
 
     {
458
 
         // find a font family suited for glyph fallback
459
 
         ImplFontEntry* pFallbackFont = mpFontCache->GetFallback( mpFontList,
460
 
-            maFont, aFontSize, nFallbackLevel-nDevSpecificFallback );
461
 
+            maFont, aFontSize, nFallbackLevel-nDevSpecificFallback,
462
 
+            (nMissingUnicodes ? pMissingUnicodes : NULL), nMissingUnicodes );
463
 
         if( !pFallbackFont )
464
 
             break;
465
 
 
466
 
@@ -6208,6 +6352,8 @@ SalLayout* OutputDevice::ImplGlyphFallba
467
 
         if( !rLayoutArgs.PrepareFallback() )
468
 
             break;
469
 
     }
470
 
+
471
 
+    delete[] pMissingUnicodes;
472
 
 
473
 
     if( pMultiSalLayout && pMultiSalLayout->LayoutText( rLayoutArgs ) )
474
 
         pSalLayout = pMultiSalLayout;
475
 
diff -ru vcl.preconfig/source/window/window.cxx vcl/source/window/window.cxx
476
 
--- openoffice.org.orig/vcl/source/window/window.cxx    2005-09-12 13:37:04.000000000 +0100
477
 
+++ vcl/source/window/window.cxx        2005-09-12 16:18:20.000000000 +0100
478
 
@@ -212,6 +212,7 @@
479
 
 #endif
480
 
 
481
 
 #include <pdfextoutdevdata.hxx>
482
 
+#include <psprint/fontmanager.hxx>
483
 
 
484
 
 using namespace rtl;
485
 
 using namespace ::com::sun::star::uno;
486
 
@@ -350,6 +351,10 @@
487
 
 {
488
 
     ImplInitFontList();
489
 
 
490
 
+    const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
491
 
+    if (rMgr.hasFontconfig())
492
 
+        return true;
493
 
+
494
 
     String aTestText;
495
 
     aTestText.Append( Button::GetStandardText( BUTTON_OK ) );
496
 
     aTestText.Append( Button::GetStandardText( BUTTON_CANCEL ) );
497
 
diff -ru vcl.preconfig/util/makefile.mk vcl/util/makefile.mk
498
 
--- openoffice.org.orig/vcl/util/makefile.mk    2005-09-12 13:37:38.000000000 +0100
499
 
+++ vcl/util/makefile.mk        2005-09-12 14:55:10.000000000 +0100
500
 
@@ -265,7 +265,7 @@
501
 
 .ENDIF
502
 
 
503
 
 
504
 
-SHL1STDLIBS += -lX11
505
 
+SHL1STDLIBS += -lX11 -lpsp$(VERSION)$(DLLPOSTFIX)
506
 
 
507
 
 .ENDIF          # "$(GUI)"=="UNX"
508
 
 
509
 
Index: inc/psprint/fontmanager.hxx
510
 
===================================================================
511
 
RCS file: /cvs/gsl/psprint/inc/psprint/fontmanager.hxx,v
512
 
retrieving revision 1.24
513
 
diff -u -r1.24 fontmanager.hxx
514
 
--- openoffice.org.orig/psprint/uinc/psprint/fontmanager.hxx    5 Aug 2005 13:21:02 -0000       1.24
515
 
+++ psprint/inc/psprint/fontmanager.hxx 12 Sep 2005 16:21:13 -0000
516
 
@@ -75,6 +75,9 @@
517
 
 #ifndef _PSPRINT_HELPER_HXX_
518
 
 #include <psprint/helper.hxx>
519
 
 #endif
520
 
+#ifndef _STRING_HXX
521
 
+#include <tools/string.hxx>
522
 
+#endif
523
 
 
524
 
 #ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
525
 
 #include <com/sun/star/lang/Locale.hpp>
526
 
@@ -419,6 +422,7 @@
527
 
     std::hash_multimap< sal_uInt8, sal_Unicode >       m_aAdobecodeToUnicode;
528
 
 
529
 
     mutable FontCache*                                                 m_pFontCache;
530
 
+    bool m_bFontconfigSuccess;
531
 
         
532
 
     rtl::OString getAfmFile( PrintFont* pFont ) const;
533
 
     rtl::OString getFontFile( PrintFont* pFont ) const;
534
 
@@ -729,6 +733,11 @@
535
 
     false else
536
 
      */
537
 
     bool matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale );
538
 
+
539
 
+    String Substitute(const std::vector<String> &rNames, const std::vector<sal_Unicode> &rGlyphs, 
540
 
+        const ByteString &rLangAttrib, italic::type eItalic, weight::type eWeight, 
541
 
+        width::type eWidth, pitch::type ePitch) const;
542
 
+    bool hasFontconfig() const { return m_bFontconfigSuccess; }
543
 
 };
544
 
 
545
 
 } // namespace
546
 
Index: source/fontmanager/fontcache.cxx
547
 
===================================================================
548
 
RCS file: /cvs/gsl/psprint/source/fontmanager/fontcache.cxx,v
549
 
retrieving revision 1.14
550
 
diff -u -r1.14 fontcache.cxx
551
 
--- openoffice.org.orig/psprint/usource/fontmanager/fontcache.cxx       9 Aug 2005 10:59:38 -0000       1.14
552
 
+++ psprint/source/fontmanager/fontcache.cxx    12 Sep 2005 16:21:13 -0000
553
 
@@ -688,9 +688,9 @@
554
 
         FontDirMap::const_iterator entry = dir->second.m_aEntries.find( rFile );
555
 
         if( entry != dir->second.m_aEntries.end() )
556
 
         {
557
 
-            bSuccess = true;
558
 
             for( FontCacheEntry::const_iterator font = entry->second.m_aEntry.begin(); font != entry->second.m_aEntry.end(); ++font )
559
 
             {
560
 
+                bSuccess = true;
561
 
                 PrintFontManager::PrintFont* pFont = clonePrintFont( *font );
562
 
                 rNewFonts.push_back( pFont );
563
 
             }
564
 
Index: source/fontmanager/fontmanager.cxx
565
 
===================================================================
566
 
RCS file: /cvs/gsl/psprint/source/fontmanager/fontmanager.cxx,v
567
 
retrieving revision 1.59
568
 
diff -u -r1.59 fontmanager.cxx
569
 
--- openoffice.org.orig/psprint/usource/fontmanager/fontmanager.cxx     5 Aug 2005 12:53:31 -0000       1.59
570
 
+++ psprint/source/fontmanager/fontmanager.cxx  12 Sep 2005 16:21:14 -0000
571
 
@@ -1155,7 +1155,8 @@ PrintFontManager::PrintFontManager() :
572
 
         m_nNextFontID( 1 ),
573
 
         m_pAtoms( new MultiAtomProvider() ),
574
 
         m_nNextDirAtom( 1 ),
575
 
-        m_pFontCache( NULL )
576
 
+        m_pFontCache( NULL ),
577
 
+       m_bFontconfigSuccess(false)
578
 
 {
579
 
     for( unsigned int i = 0; i < sizeof( aAdobeCodes )/sizeof( aAdobeCodes[0] ); i++ )
580
 
     {
581
 
@@ -2109,7 +2110,7 @@ void PrintFontManager::initialize( void*
582
 
 #endif
583
 
 
584
 
     // first try fontconfig
585
 
-    bool bFontconfigSuccess = initFontconfig();
586
 
+    m_bFontconfigSuccess = initFontconfig();
587
 
 
588
 
     // part one - look for downloadable fonts
589
 
     rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
590
 
@@ -2131,7 +2132,7 @@ void PrintFontManager::initialize( void*
591
 
     }
592
 
 
593
 
     // don't search through many directories fontconfig already told us about
594
 
-    if( ! bFontconfigSuccess )
595
 
+    if( ! m_bFontconfigSuccess )
596
 
     {                                                  
597
 
         Display *pDisplay = (Display*)pInitDisplay;
598
 
         
599
 
@@ -2209,7 +2210,7 @@ void PrintFontManager::initialize( void*
600
 
             }
601
 
         }
602
 
 #endif /* SOLARIS */
603
 
-    } // ! bFontconfigSuccess
604
 
+    } // ! m_bFontconfigSuccess
605
 
 
606
 
     // fill XLFD aliases from fonts.alias files
607
 
     initFontsAlias();
608
 
Index: source/fontmanager/fontconfig.cxx
609
 
===================================================================
610
 
RCS file: /cvs/gsl/psprint/source/fontmanager/fontconfig.cxx,v
611
 
retrieving revision 1.14
612
 
diff -u -p -u -r1.14 fontconfig.cxx
613
 
--- openoffice.org.orig/psprint/source/fontmanager/fontconfig.cxx       27 Oct 2005 07:55:13 -0000      1.14
614
 
+++ psprint/source/fontmanager/fontconfig.cxx   5 Nov 2005 11:22:58 -0000
615
 
@@ -44,10 +44,12 @@ typedef void FcConfig;
616
 
 typedef void FcObjectSet;
617
 
 typedef void FcPattern;
618
 
 typedef void FcFontSet;
619
 
+typedef void FcCharSet;
620
 
 typedef int FcResult;
621
 
 typedef int FcBool;
622
 
 typedef int FcMatchKind;
623
 
 typedef char FcChar8;
624
 
+typedef sal_Int32 FcChar32;
625
 
 #endif
626
 
 
627
 
 #include <cstdio>
628
 
@@ -80,6 +82,7 @@ class FontCfgWrapper
629
 
 {
630
 
     void*                      m_pLib;
631
 
     FcConfig*          m_pDefConfig;
632
 
+    FcFontSet*      m_pOutlineSet;
633
 
 
634
 
        FcBool          (*m_pFcInit)();
635
 
     FcConfig*          (*m_pFcConfigGetCurrent)();
636
 
@@ -88,17 +91,23 @@ class FontCfgWrapper
637
 
     FcPattern*         (*m_pFcPatternCreate)();
638
 
     void                       (*m_pFcPatternDestroy)(FcPattern*);
639
 
     FcFontSet*         (*m_pFcFontList)(FcConfig*,FcPattern*,FcObjectSet*);
640
 
+    FcFontSet*      (*m_pFcConfigGetFonts)(FcConfig*,FcSetName);
641
 
     FcFontSet*         (*m_pFcFontSetCreate)();
642
 
+    FcCharSet*         (*m_pFcCharSetCreate)();
643
 
+    FcBool                     (*m_pFcCharSetAddChar)(FcCharSet *, FcChar32);
644
 
     void                       (*m_pFcFontSetDestroy)(FcFontSet*);
645
 
     FcBool                     (*m_pFcFontSetAdd)(FcFontSet*,FcPattern*);
646
 
+    void            (*m_pFcPatternReference)(FcPattern*);
647
 
     FcResult           (*m_pFcPatternGetString)(const FcPattern*,const char*,int,FcChar8**);
648
 
     FcResult           (*m_pFcPatternGetInteger)(const FcPattern*,const char*,int,int*);
649
 
     FcResult           (*m_pFcPatternGetDouble)(const FcPattern*,const char*,int,double*);
650
 
     FcResult           (*m_pFcPatternGetBool)(const FcPattern*,const char*,int,FcBool*);
651
 
     void                       (*m_pFcDefaultSubstitute)(FcPattern *);
652
 
-    FcPattern*         (*m_pFcFontMatch)(FcConfig*,FcPattern*,FcResult*);    
653
 
+    FcPattern*      (*m_pFcFontSetMatch)(FcConfig*,FcFontSet**, int, FcPattern*,FcResult*);
654
 
     FcBool                     (*m_pFcConfigSubstitute)(FcConfig*,FcPattern*,FcMatchKind);
655
 
     FcBool                     (*m_pFcPatternAddInteger)(FcPattern*,const char*,int);
656
 
+    FcBool                     (*m_pFcPatternAddBool)(FcPattern*,const char*,FcBool);
657
 
+    FcBool                     (*m_pFcPatternAddCharSet)(FcPattern*,const char*,const FcCharSet*);
658
 
     FcBool                     (*m_pFcPatternAddString)(FcPattern*,const char*,const FcChar8*);
659
 
 
660
 
     void* loadSymbol( const char* );
661
 
@@ -114,6 +123,7 @@ public:
662
 
     { return m_pLib != NULL;}
663
 
 
664
 
     FcConfig* getDefConfig() { return m_pDefConfig; }
665
 
+    FcFontSet* getFontSet() { return m_pOutlineSet; }
666
 
 
667
 
     FcBool FcInit()
668
 
     { return m_pFcInit(); }
669
 
@@ -143,14 +153,28 @@ public:
670
 
     
671
 
     FcFontSet* FcFontList( FcConfig* pConfig, FcPattern* pPattern, FcObjectSet* pSet )
672
 
     { return m_pFcFontList( pConfig, pPattern, pSet ); }
673
 
-    
674
 
+
675
 
+    FcFontSet* FcConfigGetFonts( FcConfig* pConfig, FcSetName eSet)
676
 
+    { return m_pFcConfigGetFonts( pConfig, eSet ); }
677
 
+
678
 
     FcFontSet* FcFontSetCreate()
679
 
     { return m_pFcFontSetCreate(); }
680
 
+
681
 
+    FcCharSet* FcCharSetCreate()
682
 
+    { return m_pFcCharSetCreate(); }
683
 
+
684
 
+    FcBool FcCharSetAddChar(FcCharSet *fcs, FcChar32 ucs4)
685
 
+    { return m_pFcCharSetAddChar(fcs, ucs4); }
686
 
+
687
 
     void FcFontSetDestroy( FcFontSet* pSet )
688
 
     { m_pFcFontSetDestroy( pSet );}
689
 
+
690
 
     FcBool FcFontSetAdd( FcFontSet* pSet, FcPattern* pPattern )
691
 
     { return m_pFcFontSetAdd( pSet, pPattern ); }
692
 
 
693
 
+    void FcPatternReference( FcPattern* pPattern )
694
 
+    { m_pFcPatternReference( pPattern ); }
695
 
+
696
 
     FcResult FcPatternGetString( const FcPattern* pPattern, const char* object, int n, FcChar8** s )
697
 
     { return m_pFcPatternGetString( pPattern, object, n, s ); }
698
 
 
699
 
@@ -164,12 +188,16 @@ public:
700
 
     { return m_pFcPatternGetBool( pPattern, object, n, s ); }
701
 
     void FcDefaultSubstitute( FcPattern* pPattern )
702
 
     { m_pFcDefaultSubstitute( pPattern ); }
703
 
-    FcPattern* FcFontMatch( FcConfig* pConfig, FcPattern* pPattern, FcResult* pResult )
704
 
-    { return m_pFcFontMatch( pConfig, pPattern, pResult ); }
705
 
+    FcPattern* FcFontSetMatch(FcConfig* pConfig, FcFontSet** ppFontSet, int nset, FcPattern *pPattern, FcResult *pResult)
706
 
+    { return m_pFcFontSetMatch( pConfig, ppFontSet, nset, pPattern, pResult ); }
707
 
     FcBool FcConfigSubstitute( FcConfig* pConfig, FcPattern* pPattern, FcMatchKind eKind )
708
 
     { return m_pFcConfigSubstitute( pConfig, pPattern, eKind ); }
709
 
     FcBool FcPatternAddInteger( FcPattern* pPattern, const char* pObject, int nValue )
710
 
     { return m_pFcPatternAddInteger( pPattern, pObject, nValue ); }
711
 
+    FcBool FcPatternAddBool( FcPattern* pPattern, const char* pObject, FcBool b )
712
 
+    { return m_pFcPatternAddBool( pPattern, pObject, b ); }
713
 
+    FcBool FcPatternAddCharSet( FcPattern* pPattern, const char* pObject, const FcCharSet *c)
714
 
+    { return m_pFcPatternAddCharSet( pPattern, pObject, c ); }
715
 
     FcBool FcPatternAddString( FcPattern* pPattern, const char* pObject, const FcChar8* pString )
716
 
     { return m_pFcPatternAddString( pPattern, pObject, pString ); }
717
 
 };
718
 
@@ -186,7 +214,8 @@ void* FontCfgWrapper::loadSymbol( const 
719
 
 
720
 
 FontCfgWrapper::FontCfgWrapper()
721
 
         : m_pLib( NULL ),
722
 
-          m_pDefConfig( NULL )
723
 
+          m_pDefConfig( NULL ),
724
 
+          m_pOutlineSet( NULL )
725
 
 {
726
 
 #ifdef ENABLE_FONTCONFIG
727
 
     OUString aLib( RTL_CONSTASCII_USTRINGPARAM( "libfontconfig.so.1" ) );
728
 
@@ -220,12 +249,20 @@ FontCfgWrapper::FontCfgWrapper()
729
 
         loadSymbol( "FcPatternDestroy" );
730
 
     m_pFcFontList = (FcFontSet*(*)(FcConfig*,FcPattern*,FcObjectSet*))
731
 
         loadSymbol( "FcFontList" );
732
 
+    m_pFcConfigGetFonts = (FcFontSet*(*)(FcConfig*,FcSetName))
733
 
+        loadSymbol( "FcConfigGetFonts" );
734
 
     m_pFcFontSetCreate = (FcFontSet*(*)())
735
 
         loadSymbol( "FcFontSetCreate" );
736
 
+    m_pFcCharSetCreate = (FcCharSet*(*)())
737
 
+        loadSymbol( "FcCharSetCreate" );
738
 
+    m_pFcCharSetAddChar = (FcBool(*)(FcCharSet*, FcChar32))
739
 
+        loadSymbol( "FcCharSetAddChar" );
740
 
     m_pFcFontSetDestroy = (void(*)(FcFontSet*))
741
 
         loadSymbol( "FcFontSetDestroy" );
742
 
     m_pFcFontSetAdd = (FcBool(*)(FcFontSet*,FcPattern*))
743
 
         loadSymbol( "FcFontSetAdd" );
744
 
+    m_pFcPatternReference = (void(*)(FcPattern*))
745
 
+        loadSymbol( "FcPatternReference" );
746
 
     m_pFcPatternGetString = (FcResult(*)(const FcPattern*,const char*,int,FcChar8**))
747
 
         loadSymbol( "FcPatternGetString" );
748
 
     m_pFcPatternGetInteger = (FcResult(*)(const FcPattern*,const char*,int,int*))
749
 
@@ -236,12 +273,16 @@ FontCfgWrapper::FontCfgWrapper()
750
 
         loadSymbol( "FcPatternGetBool" );
751
 
     m_pFcDefaultSubstitute = (void(*)(FcPattern *))
752
 
         loadSymbol( "FcDefaultSubstitute" );
753
 
-    m_pFcFontMatch = (FcPattern*(*)(FcConfig*,FcPattern*,FcResult*))
754
 
-        loadSymbol( "FcFontMatch" );
755
 
+    m_pFcFontSetMatch = (FcPattern*(*)(FcConfig*,FcFontSet**, int, FcPattern*,FcResult*))
756
 
+        loadSymbol( "FcFontSetMatch" );
757
 
     m_pFcConfigSubstitute = (FcBool(*)(FcConfig*,FcPattern*,FcMatchKind))
758
 
         loadSymbol( "FcConfigSubstitute" );
759
 
     m_pFcPatternAddInteger = (FcBool(*)(FcPattern*,const char*,int))
760
 
         loadSymbol( "FcPatternAddInteger" );
761
 
+    m_pFcPatternAddBool = (FcBool(*)(FcPattern*,const char*,FcBool))
762
 
+        loadSymbol( "FcPatternAddBool" );
763
 
+    m_pFcPatternAddCharSet = (FcBool(*)(FcPattern*,const char*,const FcCharSet *))
764
 
+        loadSymbol( "FcPatternAddCharSet" );
765
 
     m_pFcPatternAddString = (FcBool(*)(FcPattern*,const char*,const FcChar8*))
766
 
         loadSymbol( "FcPatternAddString" );
767
 
 
768
 
@@ -253,17 +294,23 @@ FontCfgWrapper::FontCfgWrapper()
769
 
             m_pFcPatternCreate                         &&
770
 
             m_pFcPatternDestroy                                &&
771
 
             m_pFcFontList                                      &&
772
 
+            m_pFcConfigGetFonts             &&
773
 
             m_pFcFontSetCreate                         &&
774
 
+            m_pFcCharSetCreate                         &&
775
 
+            m_pFcCharSetAddChar                        &&
776
 
             m_pFcFontSetDestroy                                &&
777
 
             m_pFcFontSetAdd                                    &&
778
 
+            m_pFcPatternReference           &&
779
 
             m_pFcPatternGetString                      &&
780
 
             m_pFcPatternGetInteger                     &&
781
 
             m_pFcPatternGetDouble                      &&
782
 
             m_pFcPatternGetBool                                &&
783
 
             m_pFcDefaultSubstitute                     &&
784
 
-            m_pFcFontMatch                                     &&
785
 
+            m_pFcFontSetMatch                          &&
786
 
             m_pFcConfigSubstitute                      &&
787
 
             m_pFcPatternAddInteger                     &&
788
 
+            m_pFcPatternAddCharSet                     &&
789
 
+            m_pFcPatternAddBool                        &&
790
 
             m_pFcPatternAddString
791
 
             ) )
792
 
     {
793
 
@@ -281,10 +328,35 @@ FontCfgWrapper::FontCfgWrapper()
794
 
         osl_unloadModule( (oslModule)m_pLib );
795
 
         m_pLib = NULL;
796
 
     }
797
 
+
798
 
+    m_pOutlineSet = FcFontSetCreate();
799
 
+
800
 
+    /*
801
 
+      add only acceptable outlined fonts to our config, 
802
 
+      for future fontconfig use
803
 
+    */
804
 
+    FcFontSet *pOrig = FcConfigGetFonts(NULL, FcSetSystem);
805
 
+
806
 
+    if (!pOrig)
807
 
+        return;
808
 
+
809
 
+    for( int i = 0; i < pOrig->nfont; ++i )
810
 
+    {
811
 
+        FcBool outline = false;
812
 
+        FcPattern *pOutlinePattern = pOrig->fonts[i];
813
 
+        FcResult eOutRes = 
814
 
+                       FcPatternGetBool( pOutlinePattern, FC_OUTLINE, 0, &outline );
815
 
+        if (eOutRes == FcResultMatch && !outline)
816
 
+            continue;
817
 
+        FcPatternReference(pOutlinePattern);
818
 
+        FcFontSetAdd(m_pOutlineSet, pOutlinePattern);
819
 
+    }
820
 
 }
821
 
 
822
 
 FontCfgWrapper::~FontCfgWrapper()
823
 
 {
824
 
+       if( m_pOutlineSet )
825
 
+               FcFontSetDestroy( m_pOutlineSet );
826
 
     if( m_pLib )
827
 
         osl_unloadModule( (oslModule)m_pLib );
828
 
 }
829
 
@@ -319,18 +391,7 @@ bool PrintFontManager::initFontconfig()
830
 
     if( ! rWrapper.isValid() )
831
 
         return false;
832
 
 
833
 
-    FcConfig* pConfig = rWrapper.getDefConfig();
834
 
-    FcObjectSet* pOSet = rWrapper.FcObjectSetBuild( FC_FAMILY,
835
 
-                                                    FC_STYLE,
836
 
-                                                    FC_SLANT,
837
 
-                                                    FC_WEIGHT,
838
 
-                                                    FC_SPACING,
839
 
-                                                    FC_FILE,
840
 
-                                                    FC_OUTLINE,
841
 
-                                                    FC_INDEX,
842
 
-                                                    (void *) NULL );
843
 
-    FcPattern* pPattern = rWrapper.FcPatternCreate();
844
 
-    FcFontSet* pFSet = rWrapper.FcFontList( pConfig, pPattern, pOSet );
845
 
+    FcFontSet* pFSet = rWrapper.getFontSet();
846
 
 
847
 
     if( pFSet )
848
 
     {
849
 
@@ -373,6 +434,8 @@ bool PrintFontManager::initFontconfig()
850
 
                      );
851
 
 #endif
852
 
 
853
 
+            OSL_ASSERT(eOutRes != FcResultMatch || outline);
854
 
+
855
 
             // only outline fonts are usable to psprint anyway
856
 
             if( eOutRes == FcResultMatch && ! outline )
857
 
                 continue;
858
 
@@ -515,14 +578,6 @@ bool PrintFontManager::initFontconfig()
859
 
         }
860
 
     }
861
 
     
862
 
-    // cleanup
863
 
-    if( pPattern )
864
 
-        rWrapper.FcPatternDestroy( pPattern );
865
 
-    if( pFSet )
866
 
-        rWrapper.FcFontSetDestroy( pFSet );
867
 
-    if( pOSet )
868
 
-        rWrapper.FcObjectSetDestroy( pOSet );
869
 
-    
870
 
     // how does one get rid of the config ?
871
 
 #if OSL_DEBUG_LEVEL > 1
872
 
     fprintf( stderr, "inserted %d fonts from fontconfig\n", nFonts );
873
 
@@ -536,39 +591,14 @@ void PrintFontManager::deinitFontconfig(
874
 
     FontCfgWrapper::release();
875
 
 }
876
 
 
877
 
-bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale )
878
 
+static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, 
879
 
+       italic::type eItalic, weight::type eWeight, width::type eWidth, pitch::type ePitch)
880
 
 {
881
 
 #ifdef ENABLE_FONTCONFIG
882
 
-    FontCfgWrapper& rWrapper = FontCfgWrapper::get();
883
 
-    if( ! rWrapper.isValid() )
884
 
-        return false;
885
 
-
886
 
-    FcConfig* pConfig = rWrapper.getDefConfig();
887
 
-    FcPattern* pPattern = rWrapper.FcPatternCreate();
888
 
-
889
 
-    OString aLangAttrib;
890
 
-    // populate pattern with font characteristics
891
 
-    if( rLocale.Language.getLength() )
892
 
-    {
893
 
-        OUStringBuffer aLang(6);
894
 
-        aLang.append( rLocale.Language );
895
 
-        if( rLocale.Country.getLength() )
896
 
-        {
897
 
-            aLang.append( sal_Unicode('-') );
898
 
-            aLang.append( rLocale.Country );
899
 
-        }
900
 
-        aLangAttrib = OUStringToOString( aLang.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
901
 
-    }
902
 
-    if( aLangAttrib.getLength() )
903
 
-        rWrapper.FcPatternAddString( pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr() );
904
 
-
905
 
-    OString aFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 );
906
 
-    if( aFamily.getLength() )
907
 
-        rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)aFamily.getStr() );
908
 
-    if( rInfo.m_eItalic != italic::Unknown )
909
 
+    if( eItalic != italic::Unknown )
910
 
     {
911
 
         int nSlant = FC_SLANT_ROMAN;
912
 
-        switch( rInfo.m_eItalic )
913
 
+        switch( eItalic )
914
 
         {
915
 
             case italic::Italic:               nSlant = FC_SLANT_ITALIC;break;
916
 
             case italic::Oblique:              nSlant = FC_SLANT_OBLIQUE;break;
917
 
@@ -577,10 +607,10 @@ bool PrintFontManager::matchFont( FastPr
918
 
         }
919
 
         rWrapper.FcPatternAddInteger( pPattern, FC_SLANT, nSlant );
920
 
     }
921
 
-    if( rInfo.m_eWeight != weight::Unknown )
922
 
+    if( eWeight != weight::Unknown )
923
 
     {
924
 
         int nWeight = FC_WEIGHT_NORMAL;
925
 
-        switch( rInfo.m_eWeight )
926
 
+        switch( eWeight )
927
 
         {
928
 
             case weight::Thin:                 nWeight = FC_WEIGHT_THIN;break;
929
 
             case weight::UltraLight:   nWeight = FC_WEIGHT_ULTRALIGHT;break;
930
 
@@ -597,10 +627,10 @@ bool PrintFontManager::matchFont( FastPr
931
 
         }
932
 
         rWrapper.FcPatternAddInteger( pPattern, FC_WEIGHT, nWeight );
933
 
     }
934
 
-    if( rInfo.m_eWidth != width::Unknown )
935
 
+    if( eWidth != width::Unknown )
936
 
     {
937
 
         int nWidth = FC_WIDTH_NORMAL;
938
 
-        switch( rInfo.m_eWidth )
939
 
+        switch( eWidth )
940
 
         {
941
 
             case width::UltraCondensed:        nWidth = FC_WIDTH_ULTRACONDENSED;break;
942
 
             case width::ExtraCondensed: nWidth = FC_WIDTH_EXTRACONDENSED;break;
943
 
@@ -616,10 +646,10 @@ bool PrintFontManager::matchFont( FastPr
944
 
         }
945
 
         rWrapper.FcPatternAddInteger( pPattern, FC_WIDTH, nWidth );
946
 
     }
947
 
-    if( rInfo.m_ePitch != pitch::Unknown )
948
 
+    if( ePitch != pitch::Unknown )
949
 
     {
950
 
         int nSpacing = FC_PROPORTIONAL;
951
 
-        switch( rInfo.m_ePitch )
952
 
+        switch( ePitch )
953
 
         {
954
 
             case pitch::Fixed:                 nSpacing = FC_MONO;break;
955
 
             case pitch::Variable:              nSpacing = FC_PROPORTIONAL;break;
956
 
@@ -627,12 +657,123 @@ bool PrintFontManager::matchFont( FastPr
957
 
                 break;
958
 
         }
959
 
         rWrapper.FcPatternAddInteger( pPattern, FC_SPACING, nSpacing );
960
 
+        if (nSpacing == FC_MONO)
961
 
+            rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)"monospace");
962
 
+    }
963
 
+#endif
964
 
+}
965
 
+
966
 
+String PrintFontManager::Substitute(const std::vector<String> &rNames, const std::vector<sal_Unicode> &rGlyphs,
967
 
+        const ByteString &rLangAttrib, italic::type eItalic, weight::type eWeight,
968
 
+        width::type eWidth, pitch::type ePitch) const
969
 
+{
970
 
+    String aName;
971
 
+#ifdef ENABLE_FONTCONFIG
972
 
+    FontCfgWrapper& rWrapper = FontCfgWrapper::get();
973
 
+    if( ! rWrapper.isValid() )
974
 
+        return aName;
975
 
+
976
 
+    FcFontSet*  pSet = NULL;
977
 
+    FcPattern*  pPattern = rWrapper.FcPatternCreate();
978
 
+
979
 
+    // Prefer scalable fonts
980
 
+    rWrapper.FcPatternAddBool( pPattern, FC_SCALABLE, 1 );
981
 
+
982
 
+    std::vector<String>::const_iterator aEnd = rNames.end();
983
 
+    for (std::vector<String>::const_iterator aIter = rNames.begin(); aIter != aEnd; ++aIter)
984
 
+    {
985
 
+           OString maTargetName = OUStringToOString(*aIter, RTL_TEXTENCODING_UTF8);
986
 
+        rWrapper.FcPatternAddString(pPattern, FC_FAMILY, (FcChar8*)maTargetName.getStr());
987
 
+        break;
988
 
+    }
989
 
+
990
 
+    if( rLangAttrib.Len() )
991
 
+        rWrapper.FcPatternAddString(pPattern, FC_LANG, (FcChar8*)rLangAttrib.GetBuffer());
992
 
+
993
 
+    // Add required Unicode characters, if any
994
 
+    FcCharSet *unicodes = NULL;
995
 
+    if (! rGlyphs.empty() )
996
 
+    {
997
 
+        unicodes = rWrapper.FcCharSetCreate();
998
 
+           std::vector<sal_Unicode>::const_iterator aGlyphEnd = rGlyphs.end();
999
 
+           for (std::vector<sal_Unicode>::const_iterator aGlyphIter = rGlyphs.begin(); 
1000
 
+            aGlyphIter != aGlyphEnd; ++aGlyphIter)
1001
 
+           {
1002
 
+            rWrapper.FcCharSetAddChar( unicodes, (FcChar32)*aGlyphIter );
1003
 
+           }
1004
 
+        rWrapper.FcPatternAddCharSet( pPattern, FC_CHARSET, unicodes);
1005
 
+    }
1006
 
+
1007
 
+    addtopattern(rWrapper, pPattern, eItalic, eWeight, eWidth, ePitch);
1008
 
+
1009
 
+    rWrapper.FcConfigSubstitute( NULL, pPattern, FcMatchPattern );
1010
 
+    rWrapper.FcDefaultSubstitute( pPattern );
1011
 
+    FcResult eResult = FcResultNoMatch;
1012
 
+    FcFontSet *pFontSet = rWrapper.getFontSet();
1013
 
+    FcPattern* pResult = rWrapper.FcFontSetMatch( NULL, &pFontSet, 1, pPattern, &eResult );
1014
 
+    rWrapper.FcPatternDestroy( pPattern );
1015
 
+
1016
 
+    if( pResult )
1017
 
+    {
1018
 
+        pSet = rWrapper.FcFontSetCreate();
1019
 
+        // info: destroying the pSet destroys pResult implicitly
1020
 
+        // since pResult was "added" to pSet
1021
 
+        rWrapper.FcFontSetAdd( pSet, pResult );
1022
 
     }
1023
 
 
1024
 
+    if( pSet )
1025
 
+    {
1026
 
+        if( pSet->nfont > 0 )
1027
 
+        {
1028
 
+            //extract the closest match
1029
 
+            FcChar8* family = NULL;
1030
 
+            FcResult eFileRes = rWrapper.FcPatternGetString( pSet->fonts[0], FC_FAMILY, 0, &family );
1031
 
+            if( eFileRes == FcResultMatch )
1032
 
+                aName = String( (sal_Char*)family, RTL_TEXTENCODING_UTF8 );
1033
 
+        }
1034
 
+    }
1035
 
+    rWrapper.FcFontSetDestroy( pSet );
1036
 
+#endif
1037
 
+    return aName;
1038
 
+}
1039
 
+
1040
 
+bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale )
1041
 
+{
1042
 
+#ifdef ENABLE_FONTCONFIG
1043
 
+    FontCfgWrapper& rWrapper = FontCfgWrapper::get();
1044
 
+    if( ! rWrapper.isValid() )
1045
 
+        return false;
1046
 
+
1047
 
+    FcConfig* pConfig = rWrapper.getDefConfig();
1048
 
+    FcPattern* pPattern = rWrapper.FcPatternCreate();
1049
 
+
1050
 
+    OString aLangAttrib;
1051
 
+    // populate pattern with font characteristics
1052
 
+    if( rLocale.Language.getLength() )
1053
 
+    {
1054
 
+        OUStringBuffer aLang(6);
1055
 
+        aLang.append( rLocale.Language );
1056
 
+        if( rLocale.Country.getLength() )
1057
 
+        {
1058
 
+            aLang.append( sal_Unicode('-') );
1059
 
+            aLang.append( rLocale.Country );
1060
 
+        }
1061
 
+        aLangAttrib = OUStringToOString( aLang.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
1062
 
+    }
1063
 
+    if( aLangAttrib.getLength() )
1064
 
+        rWrapper.FcPatternAddString( pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr() );
1065
 
+
1066
 
+    OString aFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 );
1067
 
+    if( aFamily.getLength() )
1068
 
+        rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)aFamily.getStr() );
1069
 
+
1070
 
+    addtopattern(rWrapper, pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch);
1071
 
+
1072
 
     rWrapper.FcConfigSubstitute( pConfig, pPattern, FcMatchPattern );
1073
 
     rWrapper.FcDefaultSubstitute( pPattern );
1074
 
     FcResult eResult = FcResultNoMatch;
1075
 
-    FcPattern* pResult = rWrapper.FcFontMatch( pConfig, pPattern, &eResult );
1076
 
+    FcFontSet *pFontSet = rWrapper.getFontSet();
1077
 
+    FcPattern* pResult = rWrapper.FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult );
1078
 
     bool bSuccess = false;
1079
 
     if( pResult )
1080
 
     {
 
1
Index: source/helper/statusindicatorfactory.cxx
 
2
===================================================================
 
3
RCS file: /cvs/framework/framework/source/helper/statusindicatorfactory.cxx,v
 
4
retrieving revision 1.21
 
5
diff -u -p -u -r1.21 statusindicatorfactory.cxx
 
6
--- framework/source/helper/statusindicatorfactory.cxx  23 Sep 2005 15:41:23 -0000      1.21
 
7
+++ framework/source/helper/statusindicatorfactory.cxx  4 Jan 2006 21:41:06 -0000
 
8
@@ -496,9 +496,11 @@ void StatusIndicatorFactory::implts_make
 
9
 
 
10
     if (xParentWindow.is())
 
11
         xParentWindow->setVisible(sal_True);
 
12
+#if 0
 
13
     css::uno::Reference< css::awt::XTopWindow > xParentWindowTop(xParentWindow, css::uno::UNO_QUERY);
 
14
     if (xParentWindowTop.is())
 
15
         xParentWindowTop->toFront();
 
16
+#endif
 
17
 }
 
18
 
 
19
 //-----------------------------------------------
 
20
Index: source/loadenv/loadenv.cxx
 
21
===================================================================
 
22
RCS file: /cvs/framework/framework/source/loadenv/loadenv.cxx,v
 
23
retrieving revision 1.21
 
24
diff -u -p -u -r1.21 loadenv.cxx
 
25
--- framework/source/loadenv/loadenv.cxx        11 Nov 2005 12:06:12 -0000      1.21
 
26
+++ framework/source/loadenv/loadenv.cxx        4 Jan 2006 21:41:08 -0000
 
27
@@ -1774,9 +1774,10 @@ void LoadEnv::impl_makeFrameWindowVisibl
 
28
 
 
29
     if (xWindow.is())
 
30
         xWindow->setVisible(sal_True);
 
31
-
 
32
+#if 0
 
33
     if (xTopWindow.is())
 
34
         xTopWindow->toFront();
 
35
+#endif
 
36
 
 
37
 /* #i19976#
 
38
     We tried to prevent a toFront() call in case the user putted the