fpe.c revision 23a0898a
1/* $XdotOrg: $ */
2/*
3 * Id: fpe.c,v 1.2 1999/11/02 06:16:48 keithp Exp $
4 *
5 * Copyright 1999 SuSE, Inc.
6 *
7 * Permission to use, copy, modify, distribute, and sell this software and its
8 * documentation for any purpose is hereby granted without fee, provided that
9 * the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of SuSE not be used in advertising or
12 * publicity pertaining to distribution of the software without specific,
13 * written prior permission.  SuSE makes no representations about the
14 * suitability of this software for any purpose.  It is provided "as is"
15 * without express or implied warranty.
16 *
17 * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
19 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
21 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
22 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 *
24 * Author:  Keith Packard, SuSE, Inc.
25 */
26/* $XFree86: xc/lib/font/builtins/fpe.c,v 1.3 1999/12/30 02:29:51 robin Exp $ */
27
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31#include    <X11/fonts/fntfilst.h>
32#include "builtin.h"
33
34static int  font_file_type;
35
36static const char builtin_fonts[] = "built-ins";
37
38static int
39BuiltinNameCheck (char *name)
40{
41    return (strcmp (name, builtin_fonts) == 0);
42}
43
44static int
45BuiltinInitFPE (FontPathElementPtr fpe)
46{
47    int			status;
48    FontDirectoryPtr	dir;
49
50    status = BuiltinReadDirectory (fpe->name, &dir);
51
52    if (status == Successful)
53	fpe->private = (pointer) dir;
54    return status;
55}
56
57/* ARGSUSED */
58static int
59BuiltinResetFPE (FontPathElementPtr fpe)
60{
61    FontDirectoryPtr	dir;
62
63    dir = (FontDirectoryPtr) fpe->private;
64    /* builtins can't change! */
65    return Successful;
66}
67
68static int
69BuiltinFreeFPE (FontPathElementPtr fpe)
70{
71    FontFileFreeDir ((FontDirectoryPtr) fpe->private);
72    return Successful;
73}
74
75void
76BuiltinRegisterFpeFunctions(void)
77{
78    BuiltinRegisterFontFileFunctions ();
79
80    font_file_type = RegisterFPEFunctions(BuiltinNameCheck,
81					  BuiltinInitFPE,
82					  BuiltinFreeFPE,
83					  BuiltinResetFPE,
84					  FontFileOpenFont,
85					  FontFileCloseFont,
86					  FontFileListFonts,
87					  FontFileStartListFontsWithInfo,
88					  FontFileListNextFontWithInfo,
89					  (WakeupFpeFunc) 0,
90					  (ClientDiedFunc) 0,
91					  (LoadGlyphsFunc) 0,
92					  (StartLaFunc) 0,
93					  (NextLaFunc) 0,
94					  (SetPathFunc) 0);
95}
96