1 /* $XConsortium: printerfont.c /main/1 1996/09/28 16:49:21 rws $ */
5 Copyright (c) 1991 X Consortium
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 Except as contained in this notice, the name of the X Consortium shall not be
25 used in advertising or otherwise to promote the sale, use or other dealings
26 in this Software without prior written authorization from the X Consortium.
31 * Author: Keith Packard, MIT X Consortium
33 /* $NCDId: @(#)fontfile.c,v 1.6 1991/07/02 17:00:46 lemke Exp $ */
38 * Map FPE functions to renderer functions
41 extern int FontFileInitFPE();
42 extern int FontFileResetFPE();
43 extern int FontFileFreeFPE();
44 extern void FontFileCloseFont();
45 #define PRINTERPATHPREFIX "PRINTER:"
48 int XpClientIsPrintClient(client,fpe)
50 FontPathElementPtr fpe;
55 PrinterFontNameCheck (name)
58 if (strncmp(name,PRINTERPATHPREFIX,strlen(PRINTERPATHPREFIX)) != 0)
60 name += strlen(PRINTERPATHPREFIX);
64 return ((strcmp(name, "built-ins") == 0) || (*name == '/'));
69 PrinterFontInitFPE (fpe)
70 FontPathElementPtr fpe;
76 name = fpe->name + strlen(PRINTERPATHPREFIX);
77 status = FontFileReadDirectory (name, &dir);
78 if (status == Successful)
80 if (dir->nonScalable.used > 0)
81 if (!FontFileRegisterBitmapSource (fpe))
83 FontFileFreeFPE (fpe);
86 fpe->private = (pointer) dir;
91 /* Here we must check the client to see if it has a context attached to
92 * it that allows us to access the printer fonts
96 PrinterFontOpenFont (client, fpe, flags, name, namelen, format, fmask,
97 id, pFont, aliasName, non_cachable_font)
99 FontPathElementPtr fpe;
103 fsBitmapFormat format;
104 fsBitmapFormatMask fmask;
108 FontPtr non_cachable_font;
110 if (XpClientIsPrintClient(client,fpe))
111 return (FontFileOpenFont (client, fpe, flags, name, namelen, format,
112 fmask, id, pFont, aliasName, non_cachable_font));
116 PrinterFontListFonts (client, fpe, pat, len, max, names)
118 FontPathElementPtr fpe;
124 if (XpClientIsPrintClient(client,fpe))
125 return FontFileListFonts (client, fpe, pat, len, max, names);
129 PrinterFontStartListFontsWithInfo(client, fpe, pat, len, max, privatep)
131 FontPathElementPtr fpe;
137 if (XpClientIsPrintClient(client,fpe))
138 return FontFileStartListFontsWithInfo(client, fpe, pat, len,
143 PrinterFontListNextFontWithInfo(client, fpe, namep, namelenp, pFontInfo,
146 FontPathElementPtr fpe;
149 FontInfoPtr *pFontInfo;
153 if (XpClientIsPrintClient(client,fpe))
154 return FontFileListNextFontWithInfo(client, fpe, namep, namelenp,
155 pFontInfo, numFonts, private);
159 PrinterFontStartListFontsAndAliases(client, fpe, pat, len, max, privatep)
161 FontPathElementPtr fpe;
167 if (XpClientIsPrintClient(client,fpe))
168 return FontFileStartListFontsAndAliases(client, fpe, pat, len,
174 PrinterFontListNextFontOrAlias(client, fpe, namep, namelenp, resolvedp,
175 resolvedlenp, private)
177 FontPathElementPtr fpe;
184 if (XpClientIsPrintClient(client,fpe))
185 return FontFileListNextFontOrAlias(client, fpe, namep, namelenp,
186 resolvedp, resolvedlenp, private);
190 extern void FontFileEmptyBitmapSource();
191 typedef int (*IntFunc) ();
192 static int printer_font_type;
194 PrinterFontRegisterFpeFunctions ()
196 /* what is the use of printer font type? */
197 printer_font_type = RegisterFPEFunctions(PrinterFontNameCheck,
203 PrinterFontListFonts,
204 PrinterFontStartListFontsWithInfo,
205 PrinterFontListNextFontWithInfo,
209 PrinterFontStartListFontsAndAliases,
210 PrinterFontListNextFontOrAlias,
211 FontFileEmptyBitmapSource);