1 /************************************************************************/
2 /*									*/
3 /*  Application window application independent functionality.		*/
4 /*									*/
5 /************************************************************************/
6 
7 #   include	"appFrameConfig.h"
8 
9 #   include	<stddef.h>
10 #   include	<stdio.h>
11 
12 #   include	<utilFontmap.h>
13 #   include	"appFrame.h"
14 #   include	"appMatchFont.h"
15 
16 #   include	<appDebugon.h>
17 
18 /************************************************************************/
19 /*									*/
20 /*  Collect a list of fonts through fontconfig. If that fails, fall	*/
21 /*  that collects the set of fonts by scanning a directory of afm	*/
22 /*  files.								*/
23 /*									*/
24 /************************************************************************/
25 
appPostScriptFontCatalog(EditApplication * ea)26 int appPostScriptFontCatalog(		EditApplication *	ea )
27     {
28     int			rval= 0;
29 
30     MemoryBuffer	afmDirectory;
31 
32     utilInitMemoryBuffer( &afmDirectory );
33 
34     if  ( utilMemoryBufferSetString( &afmDirectory, ea->eaAfmDirectory ) )
35 	{ SDEB(ea->eaAfmDirectory); rval= -1; goto ready;	}
36 
37     if  ( ea->eaPostScriptFontList.psflFamilyCount > 0 )
38 	{ goto ready;	}
39 
40 #   ifdef USE_FONTCONFIG
41     ea->eaPostScriptFontList.psflAvoidFontconfig= ea->eaAvoidFontconfigInt > 0;
42 
43     if  ( ! ea->eaPostScriptFontList.psflAvoidFontconfig )
44 	{
45 	appFcListFonts( &(ea->eaPostScriptFontList) );
46 
47 	if  ( ea->eaPostScriptFontList.psflFamilyCount > 0 )
48 	    { goto ready;	}
49 	}
50 #   else
51     ea->eaPostScriptFontList.psflAvoidFontconfig= 1;
52 #   endif
53 
54     if  ( psFontCatalog( &(ea->eaPostScriptFontList),
55 				ea->eaUseKerningInt <= 0, &afmDirectory ) )
56 	{ SDEB(ea->eaAfmDirectory); rval= -1; goto ready;	}
57 
58     if  ( ea->eaGhostscriptFontmap			&&
59 	  ! ea->eaGhostscriptMappingsRead		)
60 	{
61 	if  ( utilFontmapReadMap( ea->eaGhostscriptFontmap ) )
62 	    { SDEB(ea->eaGhostscriptFontmap); rval= -1; goto ready;	}
63 
64 	ea->eaGhostscriptMappingsRead= 1;
65 	}
66 
67   ready:
68 
69     utilCleanMemoryBuffer( &afmDirectory );
70 
71     return rval;
72     }
73 
74 /************************************************************************/
75 /*									*/
76 /*  Collect a list of printers.						*/
77 /*									*/
78 /************************************************************************/
79 
appGetPrintDestinations(EditApplication * ea)80 int appGetPrintDestinations(		EditApplication *	ea )
81     {
82     if  ( ea->eaPrintDestinationsCollected )
83 	{ return 0;	}
84 
85     ea->eaPrintDestinationsCollected= 1;
86 
87     if  ( utilPrinterGetPrinters( &(ea->eaPrintDestinationCount),
88 				    &(ea->eaDefaultPrintDestination),
89 				    &(ea->eaPrintDestinations),
90 				    ea->eaCustomPrintCommand,
91 				    ea->eaCustomPrinterName,
92 				    ea->eaCustomPrintCommand2,
93 				    ea->eaCustomPrinterName2 ) )
94 	{ LDEB(1); return -1; 	}
95 
96     return 0;
97     }
98 
99