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