]> git.pld-linux.org Git - packages/libreoffice.git/blame - openoffice-print-fontconfig.patch
- DON'T hardcode java paths!
[packages/libreoffice.git] / openoffice-print-fontconfig.patch
CommitLineData
5cc47c02 1diff -urN psprint-old/inc/psprint/fontmanager.hxx psprint/inc/psprint/fontmanager.hxx
2--- psprint-old/inc/psprint/fontmanager.hxx 2003-10-12 23:44:57.000000000 +0200
3+++ psprint/inc/psprint/fontmanager.hxx 2003-10-13 02:19:29.000000000 +0200
4@@ -81,6 +81,13 @@
5 #define ATOM_FAMILYNAME 2
6 #define ATOM_PSNAME 3
7
8+#ifdef FONTCONFIG_FONTS
9+extern "C" {
10+ struct _FcFontSet;
11+ struct _FcPattern;
12+};
13+#endif
14+
15 /*
16 * some words on metrics: every length returned by PrintFontManager and
17 * friends are PostScript afm style, that is they are 1/1000 font height
18@@ -300,7 +307,9 @@
19 int m_nDirectory; // atom containing system dependent path
20 rtl::OString m_aFontFile; // relative to directory
21 rtl::OString m_aMetricFile; // dito
22+#ifndef FONTCONFIG_FONTS
23 rtl::OString m_aXLFD; // mainly for administration, contains the XLFD from fonts.dir
24+#endif
25
26 /* note: m_aFontFile and Metric file are not atoms
27 because they should be fairly unique */
28@@ -314,7 +323,9 @@
29 {
30 int m_nDirectory; // atom containing system dependent path
31 rtl::OString m_aFontFile; // relative to directory
32+#ifndef FONTCONFIG_FONTS
33 rtl::OString m_aXLFD; // mainly for administration, contains the XLFD from fonts.dir
34+#endif
35 int m_nCollectionEntry; // -1 for regular fonts, 0 to ... for fonts stemming from collections
36 unsigned int m_nTypeFlags; // from TrueType file; only known use is for copyright flags
37
38@@ -339,12 +350,16 @@
39 std::hash_map< fontID, PrintFont* > m_aFonts;
40 std::hash_map< int, family::type > m_aFamilyTypes;
41 std::list< rtl::OUString > m_aPrinterDrivers;
42+#ifndef FONTCONFIG_FONTS
43 std::list< rtl::OString > m_aFontDirectories;
44 std::list< int > m_aPrivateFontDirectories;
45 utl::MultiAtomProvider* m_pAtoms;
46 // for speeding up findFontFileID
47 std::hash_map< rtl::OString, std::set< fontID >, rtl::OStringHash >
48- m_aFontFileToFontID;
49+ m_aFontFileToFontID;
50+#else
51+ utl::MultiAtomProvider* m_pAtoms;
52+#endif
53
54 std::hash_map< rtl::OString, int, rtl::OStringHash >
55 m_aDirToAtom;
56@@ -363,17 +378,39 @@
57 rtl::OString getAfmFile( PrintFont* pFont ) const;
58 rtl::OString getFontFile( PrintFont* pFont ) const;
59
60+#ifndef FONTCONFIG_FONTS
61 void getFontAttributesFromXLFD( PrintFont* pFont, const ByteString& rXLFD ) const;
62+#endif
63
64 bool analyzeFontFile( int nDirID, const rtl::OString& rFileName, bool bReadFile, const std::list< rtl::OString >& rXLFDs, std::list< PrintFont* >& rNewFonts ) const;
65 rtl::OUString convertTrueTypeName( void* pNameRecord ) const; // actually a NameRecord* formt font subsetting code
66 void analyzeTrueTypeFamilyName( void* pTTFont, std::list< rtl::OUString >& rnames ) const; // actually a TrueTypeFont* from font subsetting code
67 bool analyzeTrueTypeFile( PrintFont* pFont ) const;
68+
69+#ifndef FONTCONFIG_FONTS
70 // finds the FIRST id for this font file; there may be more
71 // for TrueType collections
72 fontID findFontFileID( int nDirID, const rtl::OString& rFile ) const;
73+#endif
74 fontID findFontBuiltinID( int nPSNameAtom ) const;
75
76+#ifdef FONTCONFIG_FONTS
77+ void getFontAttributesFromFcPattern( PrintFont* pFont, const struct _FcPattern *fc_font ) const;
78+ void addFcSystemFont (struct _FcPattern *fc_pattern);
79+ void addFcSystemFontSet (struct _FcFontSet *fc_set);
80+ int addFontFile( const ::rtl::OString& rFilePath, const struct _FcPattern *fc_font, bool bMergeBuiltin );
81+#endif
82+ void ensureAnalysed( PrintFont* pFont ) const
83+ {
84+ if ( pFont && pFont->m_nAscend == 0 && pFont->m_nDescend == 0 )
85+ {
86+ if (pFont->m_eType == fonttype::TrueType )
87+ analyzeTrueTypeFile( pFont );
88+ else if (pFont->m_eType == fonttype::Type1 )
89+ pFont->readAfmMetrics( getAfmFile( pFont ), m_pAtoms );
90+ }
91+ }
92+
93 family::type matchFamilyName( const rtl::OUString& rFamily ) const;
94
95 PrintFont* getFont( fontID nID ) const
96@@ -382,14 +419,18 @@
97 it = m_aFonts.find( nID );
98 return it == m_aFonts.end() ? NULL : it->second;
99 }
100+#ifndef FONTCONFIG_FONTS
101 ByteString getXLFD( PrintFont* pFont ) const;
102+#endif
103 void fillPrintFontInfo( PrintFont* pFont, FastPrintFontInfo& rInfo ) const;
104 void fillPrintFontInfo( PrintFont* pFont, PrintFontInfo& rInfo ) const;
105
106 const rtl::OString& getDirectory( int nAtom ) const;
107 int getDirectoryAtom( const rtl::OString& rDirectory, bool bCreate = false );
108
109+#ifndef FONTCONFIG_FONTS
110 void getServerDirectories(); // get font server directories on e.g. redhat
111+#endif
112
113 PrintFontManager();
114 ~PrintFontManager();
115@@ -512,11 +553,13 @@
116 void hasVerticalSubstitutions( fontID nFontID, const sal_Unicode* pCharacters,
117 int nCharacters, bool* pHasSubst ) const;
118
119+#ifndef FONTCONFIG_FONTS
120 // get the XLFD for a font that originated from the X fontpath
121 // note: this may not be the original line that was in the fonts.dir
122 // returns a string for every font, but only TrueType and Type1
123 // fonts originated from the X font path, so check for the font type
124 rtl::OUString getFontXLFD( fontID nFontID ) const;
125+#endif
126
127 // get a specific fonts metrics
128
129@@ -582,6 +625,7 @@
130
131 // font administration functions
132
133+#ifndef FONTCONFIG_FONTS
134 // for importFonts to provide the user feedback
135 class ImportFontCallback
136 {
137@@ -614,6 +658,7 @@
138 bool removeFonts( const std::list< fontID >& rFonts );
139
140 bool isPrivateFontFile( fontID ) const;
141+#endif
142
143 // returns false if there were not any
144 bool getAlternativeFamilyNames( fontID nFont, std::list< rtl::OUString >& rNames ) const;
145diff -urN psprint-old/source/fontmanager/fontmanager.cxx psprint/source/fontmanager/fontmanager.cxx
146--- psprint-old/source/fontmanager/fontmanager.cxx 2003-10-12 23:44:57.000000000 +0200
147+++ psprint/source/fontmanager/fontmanager.cxx 2003-10-13 02:23:30.000000000 +0200
148@@ -140,6 +140,11 @@
149
150 #include <adobeenc.tab> // get encoding table for AFM metrics
151
152+#ifdef FONTCONFIG_FONTS
153+#include <stdio.h>
154+#include <fontconfig/fontconfig.h>
155+#endif
156+
157 #define PRINTER_METRICDIR "fontmetric"
158
159 using namespace utl;
160@@ -159,6 +164,7 @@
161 return nRet;
162 }
163
164+#ifndef FONTCONFIG_FONTS
165 static italic::type parseItalic( const ByteString& rItalic )
166 {
167 italic::type eItalic = italic::Unknown;
168@@ -170,6 +176,7 @@
169 eItalic = italic::Upright;
170 return eItalic;
171 }
172+#endif
173
174 // -------------------------------------------------------------------------
175
176@@ -210,6 +217,7 @@
177
178 // -------------------------------------------------------------------------
179
180+#ifndef FONTCONFIG_FONTS
181 static width::type parseWidth( const ByteString& rWidth )
182 {
183 width::type eWidth = width::Unknown;
184@@ -237,6 +245,7 @@
185
186 return eWidth;
187 }
188+#endif
189
190 // -------------------------------------------------------------------------
191
192@@ -920,6 +929,138 @@
193 }
194
195 // -------------------------------------------------------------------------
196+#ifdef FONTCONFIG_FONTS
197+int PrintFontManager::addFontFile( const OString& rFontPath,
198+ const FcPattern *fc_font,
199+ bool bMergeBuiltin)
200+{
201+ sal_Int32 idx;
202+ ::std::list< PrintFontManager::PrintFont* > aNewFonts;
203+
204+ idx = rFontPath.lastIndexOf ('/');
205+ if (idx < 0)
206+ {
207+ fprintf (stderr, "Invalid path\n");
208+ return;
209+ }
210+ // Split the directory
211+ OString aDir (rFontPath, idx);
212+ // And the filename
213+ OString aFontFile( rFontPath + idx + 1, rFontPath.getLength() - idx - 1);
214+ // And the extension
215+ ByteString aExt( aFontFile.copy( aFontFile.lastIndexOf( '.' )+1 ) );
216+
217+ int nDirID = getDirectoryAtom( aDir, true );
218+
219+ if( m_pFontCache->getFontCacheFile( nDirID, aDir, aFontFile, aNewFonts ) )
220+ {
221+#ifdef DEBUG
222+ fprintf( stderr, "Hit cache for '%s'", (sal_Char *) rFontPath );
223+#endif
224+ /* got it from the cache */ ;
225+ }
226+ else if( aExt.EqualsIgnoreCaseAscii( "pfb" ) || aExt.EqualsIgnoreCaseAscii( "pfa" ) )
227+ {
228+ // check for corresponding afm metric
229+ // first look for an adjacent file
230+
231+ ByteString aName( aFontFile );
232+ aName.Erase( aName.Len()-4 );
233+ aName.Append( ".afm" );
234+
235+ ByteString aFilePath( aDir );
236+ aFilePath.Append( '/' );
237+ aFilePath.Append( aName );
238+
239+ ByteString aAfmFile;
240+ if( access( aFilePath.GetBuffer(), F_OK ) )
241+ {
242+ // try in subdirectory afm instead
243+ aFilePath = aDir;
244+ aFilePath.Append( "/afm/" );
245+ aFilePath.Append( aName );
246+
247+ if( ! access( aFilePath.GetBuffer(), F_OK ) )
248+ {
249+ aAfmFile = "afm/";
250+ aAfmFile += aName;
251+ }
252+ }
253+ else
254+ aAfmFile = aName;
255+
256+ if( aAfmFile.Len() )
257+ {
258+ Type1FontFile* pFont = new Type1FontFile();
259+ pFont->m_nDirectory = nDirID;
260+
261+ pFont->m_aFontFile = aFontFile;
262+ pFont->m_aMetricFile = aAfmFile;
263+
264+ if (fc_font)
265+ getFontAttributesFromFcPattern( pFont, fc_font );
266+ else if( ! pFont->readAfmMetrics( getAfmFile( pFont ), m_pAtoms ) )
267+ {
268+ delete pFont;
269+ pFont = NULL;
270+ }
271+ if( pFont )
272+ aNewFonts.push_back( pFont );
273+ }
274+ }
275+ else if( aExt.EqualsIgnoreCaseAscii( "afm" ) )
276+ {
277+ ByteString aFilePath( aDir );
278+ aFilePath.Append( '/' );
279+ aFilePath.Append( ByteString( aFontFile ) );
280+ BuiltinFont* pFont = new BuiltinFont();
281+ pFont->m_nDirectory = nDirID;
282+ pFont->m_aMetricFile = aFontFile;
283+ if( pFont->readAfmMetrics( aFilePath, m_pAtoms ) )
284+ aNewFonts.push_back( pFont );
285+ else
286+ delete pFont;
287+ }
288+ else if( aExt.EqualsIgnoreCaseAscii( "ttf" ) )
289+ {
290+ TrueTypeFontFile* pFont = new TrueTypeFontFile();
291+ pFont->m_nDirectory = nDirID;
292+ pFont->m_aFontFile = aFontFile;
293+ pFont->m_nCollectionEntry = -1;
294+
295+ if( fc_font )
296+ getFontAttributesFromFcPattern( pFont, fc_font );
297+ // need to read the font anyway to get aliases
298+ if( ! analyzeTrueTypeFile( pFont ) )
299+ {
300+ delete pFont;
301+ pFont = NULL;
302+ }
303+ else
304+ aNewFonts.push_back( pFont );
305+ }
306+#warning Disabled ttc parsing, do we need to use the 'index' property for 'nCollectionEntry' ?
307+
308+ for( ::std::list< PrintFont* >::iterator it = aNewFonts.begin(); it != aNewFonts.end(); ++it )
309+ {
310+ if (!bMergeBuiltin ||
311+ !findFontBuiltinID( (*it)->m_nPSName ) )
312+ {
313+ fontID aFont = m_nNextFontID++;
314+ m_aFonts[ aFont ] = *it;
315+ }
316+ else
317+ delete (*it);
318+ }
319+}
320+
321+int PrintFontManager::addFontFile( const ::rtl::OString& rFileName, int nFaceNum )
322+{
323+ // Purely for salgdi3 usage ...
324+ return addFontFile( rFileName, NULL, false );
325+}
326+
327+#else
328
329 int PrintFontManager::addFontFile( const ::rtl::OString& rFileName, int nFaceNum )
330 {
331@@ -1088,6 +1229,7 @@
332 }
333 return ! rNewFonts.empty();
334 }
335+#endif
336
337 // -------------------------------------------------------------------------
338
339@@ -1106,6 +1248,7 @@
340
341 // -------------------------------------------------------------------------
342
343+#ifndef FONTCONFIG_FONTS
344 fontID PrintFontManager::findFontFileID( int nDirID, const OString& rFontFile ) const
345 {
346 fontID nID = 0;
347@@ -1292,6 +1435,69 @@
348
349 return aXLFD;
350 }
351+#else /* FONTCONFIG_FONTS */
352+
353+void PrintFontManager::getFontAttributesFromFcPattern( PrintFont* pFont, const FcPattern *fc_font ) const
354+ {
355+ FcChar8 *fc_str;
356+ int fc_int;
357+
358+ if (!FcPatternGetString (fc_font, FC_FAMILY, 0, &fc_str) && fc_str)
359+ pFont->m_nFamilyName =
360+ m_pAtoms->getAtom( ATOM_FAMILYNAME,
361+ String( ByteString((sal_Char *) fc_str ), RTL_TEXTENCODING_UTF8 ),
362+ sal_True );
363+
364+ if (!FcPatternGetInteger (fc_font, FC_WEIGHT, 0, &fc_int))
365+ {
366+ if (fc_int < FC_WEIGHT_LIGHT)
367+ pFont->m_eWeight = weight::UltraLight;
368+ else if (fc_int == FC_WEIGHT_LIGHT)
369+ pFont->m_eWeight = weight::Light;
370+ else if (fc_int < FC_WEIGHT_MEDIUM)
371+ pFont->m_eWeight = weight::SemiLight;
372+ else if (fc_int == FC_WEIGHT_MEDIUM)
373+ pFont->m_eWeight = weight::Normal;
374+ else if (fc_int < FC_WEIGHT_DEMIBOLD)
375+ pFont->m_eWeight = weight::Medium;
376+ else if (fc_int == FC_WEIGHT_DEMIBOLD)
377+ pFont->m_eWeight = weight::SemiBold;
378+ else if (fc_int <= FC_WEIGHT_BOLD)
379+ pFont->m_eWeight = weight::Bold;
380+ else if (fc_int < FC_WEIGHT_BLACK)
381+ pFont->m_eWeight = weight::UltraBold;
382+ else
383+ pFont->m_eWeight = weight::Black;
384+ }
385+
386+ if (!FcPatternGetInteger (fc_font, FC_SLANT, 0, &fc_int))
387+ {
388+ if (fc_int <= FC_SLANT_ROMAN)
389+ pFont->m_eItalic = italic::Upright;
390+ else if (fc_int <= FC_SLANT_ITALIC)
391+ pFont->m_eItalic = italic::Italic;
392+ else if (fc_int <= FC_SLANT_ITALIC)
393+ pFont->m_eItalic = italic::Oblique;
394+ }
395+
396+ /* FIXME: this used to be parsed from XLFD (parseWidth) */
397+ pFont->m_eWidth = width::Normal;
398+
399+ if (!FcPatternGetInteger (fc_font, FC_SLANT, 0, &fc_int))
400+ {
401+ if (fc_int > FC_PROPORTIONAL && (fc_int <= FC_MONO ||
402+ fc_int <= FC_CHARCELL))
403+ pFont->m_ePitch = pitch::Fixed;
404+ else
405+ pFont->m_ePitch = pitch::Variable;
406+ }
407+ else
408+ pFont->m_ePitch = pitch::Variable;
409+
410+#warning Missing encoding fixup !
411+
412+ }
413+#endif
414
415 // -------------------------------------------------------------------------
416
417@@ -1552,6 +1758,7 @@
418
419 // -------------------------------------------------------------------------
420
421+#ifndef FONTCONFIG_FONTS
422 static void normPath( ByteString& rPath )
423 {
424 char buf[PATH_MAX];
425@@ -1614,6 +1821,37 @@
426 #endif
427 }
428
429+#else
430+
431+void
432+PrintFontManager::addFcSystemFont (struct _FcPattern *fc_pattern)
433+ {
434+ FcChar8 *fc_str = NULL;
435+ if( FcPatternGetString( fc_pattern, FC_FILE, 0, &fc_str ) || !fc_str)
436+ return;
437+
438+ OString aFileName( (sal_Char *) fc_str );
439+
440+ addFontFile( aFileName, fc_pattern, false );
441+}
442+
443+void
444+PrintFontManager::addFcSystemFontSet( FcFontSet *fc_set )
445+{
446+ int i;
447+ if (!fc_set)
448+ return;
449+
450+ for (i = 0; i < fc_set->nfont; i++)
451+ {
452+ FcPattern *font = fc_set->fonts[i];
453+ if (!font)
454+ continue;
455+ addFcSystemFont( font );
456+ }
457+}
458+#endif
459+
460 void PrintFontManager::initialize( void* pInitDisplay )
461 {
462 long aDirEntBuffer[ (sizeof(struct dirent)+_PC_NAME_MAX)+1 ];
463@@ -1639,8 +1877,10 @@
464 delete (*it).second;
465 m_nNextFontID = 1;
466 m_aFonts.clear();
467+#ifndef FONTCONFIG_FONTS
468 m_aFontDirectories.clear();
469 m_aPrivateFontDirectories.clear();
470+#endif
471 }
472
473 #if OSL_DEBUG_LEVEL > 1
474@@ -1656,6 +1896,7 @@
475 aStart = times( &tms );
476 #endif
477
478+#ifndef FONTCONFIG_FONTS
479 // part one - look for downloadable fonts
480 rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
481 const ::rtl::OUString &rSalPrivatePath = psp::getFontPath();
482@@ -1864,6 +2105,15 @@
483 m_pFontCache->markEmptyDir( nDirID );
484 }
485 }
486+#else /* FONTCONFIG_FONTS */
487+
488+ FcConfig *config = FcInitLoadConfigAndFonts();
489+ if ( !config)
490+ fprintf( stderr, "Can't init fontconfig\n" );
491+
492+ addFcSystemFontSet( FcConfigGetFonts( config, FcSetSystem ) );
493+ addFcSystemFontSet( FcConfigGetFonts( config, FcSetApplication ) );
494+#endif
495
496 #if OSL_DEBUG_LEVEL > 1
497 aStep1 = times( &tms );
498@@ -1876,8 +2126,9 @@
499 std::list< OString > aEmptyFontsDir;
500 for( std::list< OUString >::const_iterator met_dir_it = aMetricDirs.begin(); met_dir_it != aMetricDirs.end(); ++met_dir_it )
501 {
502- OString aDir = OUStringToOString( *met_dir_it, aEncoding );
503+ OString aDir = OUStringToOString( *met_dir_it, osl_getThreadTextEncoding() );
504
505+#ifndef FONTCONFIG_FONTS
506 // ask the font cache whether it handles this directory
507 std::list< PrintFont* > aCacheFonts;
508
509@@ -1907,6 +2158,7 @@
510 }
511 continue;
512 }
513+#endif
514
515 DIR* pDIR = opendir( aDir.getStr() );
516 if( pDIR )
517@@ -1925,10 +2177,13 @@
518 && S_ISREG( aStat.st_mode )
519 )
520 {
521- OString aFileName( pDirEntry->d_name, strlen( pDirEntry->d_name ) );
522+ OString aFileName( aFile );
523 OString aExt( aFileName.copy( aFileName.lastIndexOf( '.' )+1 ) );
524 if( aExt.equalsIgnoreAsciiCase( "afm" ) )
525 {
526+#ifdef FONTCONFIG_FONTS
527+ addFontFile( aFileName, NULL, true );
528+#else
529 ::std::list< PrintFont* > aNewFonts;
530
531 analyzeFontFile( nDirID, aFileName, true, aEmptyFontsDir, aNewFonts );
532@@ -1946,6 +2201,7 @@
533 else
534 delete *it;
535 }
536+#endif
537 }
538 }
539 }
540@@ -2102,14 +2358,7 @@
541
542 void PrintFontManager::fillPrintFontInfo( PrintFont* pFont, PrintFontInfo& rInfo ) const
543 {
544- if( pFont->m_nAscend == 0 && pFont->m_nDescend == 0 )
545- {
546- // might be a truetype font not analyzed or type1 without metrics read
547- if( pFont->m_eType == fonttype::Type1 )
548- pFont->readAfmMetrics( getAfmFile( pFont ), m_pAtoms );
549- else if( pFont->m_eType == fonttype::TrueType )
550- analyzeTrueTypeFile( pFont );
551- }
552+ ensureAnalysed( pFont );
553
554 fillPrintFontInfo( pFont, static_cast< FastPrintFontInfo& >( rInfo ) );
555
556@@ -2304,6 +2553,7 @@
557 const ::rtl::OUString& PrintFontManager::getFontFamily( fontID nFontID ) const
558 {
559 PrintFont* pFont = getFont( nFontID );
560+ ensureAnalysed( pFont );
561 return m_pAtoms->getString( ATOM_FAMILYNAME, pFont ? pFont->m_nFamilyName : INVALID_ATOM );
562 }
563
564@@ -2367,11 +2617,8 @@
565 const ::rtl::OUString& PrintFontManager::getPSName( fontID nFontID ) const
566 {
567 PrintFont* pFont = getFont( nFontID );
568- if( pFont && pFont->m_nPSName == 0 )
569- {
570- if( pFont->m_eType == fonttype::TrueType )
571- analyzeTrueTypeFile( pFont );
572- }
573+
574+ ensureAnalysed( pFont );
575
576 return m_pAtoms->getString( ATOM_PSNAME, pFont ? pFont->m_nPSName : INVALID_ATOM );
577 }
578@@ -2390,12 +2637,7 @@
579 int PrintFontManager::getFontAscend( fontID nFontID ) const
580 {
581 PrintFont* pFont = getFont( nFontID );
582- if( pFont->m_nAscend == 0 && pFont->m_nDescend == 0 )
583- {
584- // might be a truetype font not yet analyzed
585- if( pFont->m_eType == fonttype::TrueType )
586- analyzeTrueTypeFile( pFont );
587- }
588+ ensureAnalysed( pFont );
589 return pFont->m_nAscend;
590 }
591
592@@ -2404,12 +2646,7 @@
593 int PrintFontManager::getFontDescend( fontID nFontID ) const
594 {
595 PrintFont* pFont = getFont( nFontID );
596- if( pFont->m_nAscend == 0 && pFont->m_nDescend == 0 )
597- {
598- // might be a truetype font not yet analyzed
599- if( pFont->m_eType == fonttype::TrueType )
600- analyzeTrueTypeFile( pFont );
601- }
602+ ensureAnalysed( pFont );
603 return pFont->m_nDescend;
604 }
605
606@@ -2418,12 +2655,7 @@
607 int PrintFontManager::getFontLeading( fontID nFontID ) const
608 {
609 PrintFont* pFont = getFont( nFontID );
610- if( pFont->m_nAscend == 0 && pFont->m_nDescend == 0 )
611- {
612- // might be a truetype font not yet analyzed
613- if( pFont->m_eType == fonttype::TrueType )
614- analyzeTrueTypeFile( pFont );
615- }
616+ ensureAnalysed( pFont );
617 return pFont->m_nLeading;
618 }
619
620@@ -2432,12 +2664,7 @@
621 bool PrintFontManager::hasVerticalSubstitutions( fontID nFontID ) const
622 {
623 PrintFont* pFont = getFont( nFontID );
624- if( pFont->m_nAscend == 0 && pFont->m_nDescend == 0 )
625- {
626- // might be a truetype font not yet analyzed
627- if( pFont->m_eType == fonttype::TrueType )
628- analyzeTrueTypeFile( pFont );
629- }
630+ ensureAnalysed( pFont );
631 return pFont->m_bHaveVerticalSubstitutedGlyphs;
632 }
633
634@@ -2447,12 +2674,8 @@
635 const sal_Unicode* pCharacters, int nCharacters, bool* pHasSubst ) const
636 {
637 PrintFont* pFont = getFont( nFontID );
638- if( pFont->m_nAscend == 0 && pFont->m_nDescend == 0 )
639- {
640- // might be a truetype font not yet analyzed
641- if( pFont->m_eType == fonttype::TrueType )
642- analyzeTrueTypeFile( pFont );
643- }
644+
645+ ensureAnalysed( pFont );
646
647 if( ! pFont->m_bHaveVerticalSubstitutedGlyphs )
648 memset( pHasSubst, 0, sizeof(bool)*nCharacters );
649@@ -2471,7 +2694,7 @@
650 }
651
652 // -------------------------------------------------------------------------
653-
654+#ifndef FONTCONFIG_FONTS
655 OUString PrintFontManager::getFontXLFD( fontID nFontID ) const
656 {
657 PrintFont* pFont = getFont( nFontID );
658@@ -2484,6 +2707,7 @@
659 }
660 return aRet;
661 }
662+#endif
663
664 // -------------------------------------------------------------------------
665
666@@ -2495,6 +2719,7 @@
667 if( ! pFont )
668 return aEmpty;
669
670+ ensureAnalysed( pFont );
671 if( ! pFont->m_pMetrics || ! pFont->m_pMetrics->m_bKernPairsQueried )
672 pFont->queryMetricPage( 0, m_pAtoms );
673 if( ! pFont->m_pMetrics || ! pFont->m_pMetrics->m_bKernPairsQueried )
674@@ -2548,14 +2773,7 @@
675 if( ! pFont )
676 return false;
677
678- if( pFont->m_nAscend == 0 && pFont->m_nDescend == 0 )
679- {
680- // might be a font not yet analyzed
681- if( pFont->m_eType == fonttype::Type1 )
682- pFont->readAfmMetrics( getAfmFile( pFont ), m_pAtoms );
683- else if( pFont->m_eType == fonttype::TrueType )
684- analyzeTrueTypeFile( pFont );
685- }
686+ ensureAnalysed( pFont );
687
688 for( int i = 0; i < nLen; i++ )
689 {
690@@ -2615,7 +2833,7 @@
691 }
692
693 // -------------------------------------------------------------------------
694-
695+#ifndef FONTCONFIG_FONTS
696 static bool createPath( const ByteString& rPath )
697 {
698 bool bSuccess = false;
699@@ -3245,6 +3463,7 @@
700 }
701 return rNames.begin() != rNames.end();
702 }
703+#endif /* FONTCONFIG_FONTS */
704
705 // -------------------------------------------------------------------------
706
707diff -urN psprint-old/source/fontmanager/makefile.mk psprint/source/fontmanager/makefile.mk
708--- psprint-old/source/fontmanager/makefile.mk 2003-10-12 23:44:57.000000000 +0200
709+++ psprint/source/fontmanager/makefile.mk 2003-10-13 02:15:28.000000000 +0200
710@@ -79,6 +79,9 @@
711 $(SLO)$/fontcache.obj \
712 $(SLO)$/parseAFM.obj
713
714+.IF "$(FONTCONFIG_FONTS)" == "YES"
715+CFLAGS+=$(FONTCONFIG_CFLAGS) -Wall -DFONTCONFIG_FONTS
716+.ENDIF
717 .IF "$(OS)$(CPU)"=="SOLARISI"
718 NOOPTFILES=$(SLO)$/fontmanager.obj
719 .ENDIF
720diff -urN vcl-old/unx/source/gdi/salgdi3.cxx vcl/unx/source/gdi/salgdi3.cxx
721--- vcl-old/unx/source/gdi/salgdi3.cxx 2003-10-13 00:13:43.000000000 +0200
722+++ vcl/unx/source/gdi/salgdi3.cxx 2003-10-13 02:08:13.000000000 +0200
723@@ -1778,6 +1778,7 @@
724 else
725 #endif
726 {
727+#ifdef NASTY_X_FONTS
728 XlfdStorage* pFonts = _GetDisplay()->GetXlfdList();
729
730 for ( int nIdx = 0; nIdx < pFonts->GetCount(); nIdx++ )
731@@ -1790,6 +1791,7 @@
732 pFontData->mbEmbeddable = FALSE;
733 pList->Add( pFontData );
734 }
735+#endif
736
737 #ifdef USE_BUILTIN_RASTERIZER
738 aX11GlyphPeer.SetDisplay( maGraphicsData.GetXDisplay(),
739@@ -1838,6 +1840,7 @@
740
741 void SalGraphics::GetDevFontSubstList( OutputDevice* pOutDev )
742 {
743+#ifndef FONTCONFIG_FONTS
744 #ifndef _USE_PRINT_EXTENSION_
745 if( maGraphicsData.m_pPrinterGfx != NULL )
746 {
747@@ -1849,6 +1852,7 @@
748 }
749 }
750 #endif
751+#endif
752 }
753
754 // ----------------------------------------------------------------------------
755diff -urN psprint-old/util/makefile.mk psprint/util/makefile.mk
756--- psprint-old/util/makefile.mk 2003-10-12 23:44:57.000000000 +0200
757+++ psprint/util/makefile.mk 2003-10-13 03:15:24.000000000 +0200
758@@ -99,6 +99,10 @@
759 $(SALLIB) \
760 -lX11
761
762+.IF "$(FONTCONFIG_FONTS)" == "YES"
763+SHL1STDLIBS+=$(FONTCONFIG_LIBS)
764+.ENDIF
765+
766 SHL1DEF= $(MISC)$/$(SHL1TARGET).def
767
768 .ENDIF # "$(OS)"=="WNT"
769Index: vcl/unx/source/gdi/makefile.mk
770===================================================================
771RCS file: /cvs/gsl/vcl/unx/source/gdi/vcl/unx/source/gdi/makefile.mk,v
772retrieving revision 1.9
773diff -u -r1.9 vcl/unx/source/gdi/makefile.mk
774--- vcl/unx/source/gdi/makefile.mk 27 Aug 2002 14:52:35 -0000 1.9
775+++ vcl/unx/source/gdi/makefile.mk 21 Oct 2003 07:45:28 -0000
776@@ -106,6 +106,10 @@
777 SLOFILES+=$(SLO)$/salprnpsp.obj
778 .ENDIF
779
780+.IF "$(FONTCONFIG_FONTS)" == "YES"
781+CFLAGS+=$(FONTCONFIG_CFLAGS) -DFONTCONFIG_FONTS
782+.ENDIF
783+
784 .IF "$(OS)"=="SOLARIS"
785 SLOFILES+=$(SLO)$/cdeint.obj
786 ENVCFLAGS+=-DUSE_CDE
This page took 0.1481 seconds and 4 git commands to generate.