xfs-design.xml revision ce6676db
1ce6676dbSmrg<?xml version="1.0" encoding="utf-8"?>
2ce6676dbSmrg<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3ce6676dbSmrg    "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
4ce6676dbSmrg<!-- lifted from troff+ms by doclifter -->
5ce6676dbSmrg<!-- previous version was in xorg-docs/specs/xfs/design.ms -->
6ce6676dbSmrg<!-- encoding notes:
7ce6676dbSmrg	- for lack of a better match, the systemitem tag is used for
8ce6676dbSmrg	  protocol request names
9ce6676dbSmrg  -->
10ce6676dbSmrg<article id='designms'>
11ce6676dbSmrg  <articleinfo>
12ce6676dbSmrg    <title>Font server implementation overview</title>
13ce6676dbSmrg    <author>
14ce6676dbSmrg      <firstname>Dave</firstname>
15ce6676dbSmrg      <surname>Lemke</surname>
16ce6676dbSmrg      <affiliation>
17ce6676dbSmrg        <orgname>Network Computing Devices, Inc.</orgname>
18ce6676dbSmrg      </affiliation>
19ce6676dbSmrg    </author>
20ce6676dbSmrg    <copyright>
21ce6676dbSmrg      <year>1991</year>
22ce6676dbSmrg      <holder>Network Computing Devices, Inc.</holder>
23ce6676dbSmrg    </copyright>
24ce6676dbSmrg  </articleinfo>
25ce6676dbSmrg  <sect1 id='introduction'>
26ce6676dbSmrg    <title>Introduction</title>
27ce6676dbSmrg    <para>The font server uses the same client/server model as X.
28ce6676dbSmrg    The basic structure is that of the X Consortium X11R5 X server,
29ce6676dbSmrg    and those who know that code should find the
30ce6676dbSmrg    <firstterm remap='I'>os</firstterm> and
31ce6676dbSmrg    <firstterm remap='I'>difs</firstterm> (device independent font
32ce6676dbSmrg    server) layers familiar.</para>
33ce6676dbSmrg    <literallayout class='monospaced'>
34ce6676dbSmrg                        &boxdr;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxdl;
35ce6676dbSmrg                  &boxdr;&boxh;&boxh;&boxh;&boxh;&boxh;&boxvl;      difs       &boxvr;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxdl;
36ce6676dbSmrg                  &boxv;     &boxur;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxul;      &boxv;
37ce6676dbSmrg                  &boxv;                              &boxv;
38ce6676dbSmrg                &boxdr;&boxh;&boxhu;&boxh;&boxh;&boxdl;                  &boxdr;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxhu;&boxh;&boxh;&boxh;&boxdl;
39ce6676dbSmrg                &boxv; os &boxv;                  &boxv; renderers  &boxv;
40ce6676dbSmrg                &boxur;&boxh;&boxh;&boxh;&boxh;&boxul;                  &boxur;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxh;&boxul;
41ce6676dbSmrg    </literallayout>
42ce6676dbSmrg   <sect2 id='definitions'>
43ce6676dbSmrg    <title>Definitions</title>
44ce6676dbSmrg    <glosslist>
45ce6676dbSmrg      <glossentry>
46ce6676dbSmrg        <glossterm>
47ce6676dbSmrg          <firstterm>Renderer</firstterm>
48ce6676dbSmrg	  <indexterm><primary>renderer</primary></indexterm>
49ce6676dbSmrg        </glossterm>
50ce6676dbSmrg        <glossdef><para>Code that knows how to take font data in
51ce6676dbSmrg          its raw format and convert it to the font server's
52ce6676dbSmrg          format.</para></glossdef>
53ce6676dbSmrg      </glossentry>
54ce6676dbSmrg      <glossentry>
55ce6676dbSmrg        <glossterm>
56ce6676dbSmrg          <firstterm>Font Path Element (<acronym>FPE</acronym>)</firstterm>
57ce6676dbSmrg	  <indexterm><primary>Font Path Element</primary></indexterm>
58ce6676dbSmrg	  <indexterm><primary><acronym>FPE</acronym></primary><see>Font Path Element</see></indexterm>
59ce6676dbSmrg        </glossterm>
60ce6676dbSmrg        <glossdef><para>An instance of a renderer, associated with a specific
61ce6676dbSmrg	font source, (ie a directory of PCF bitmaps).</para></glossdef>
62ce6676dbSmrg      </glossentry>
63ce6676dbSmrg    </glosslist>
64ce6676dbSmrg
65ce6676dbSmrg    <para><indexterm><primary>difs layer</primary></indexterm>
66ce6676dbSmrg          The <firstterm>difs</firstterm> layer interprets the
67ce6676dbSmrg          requests, and handles the renderer independent work. This
68ce6676dbSmrg          includes error checking of requests, and the top level
69ce6676dbSmrg          font database. It also contains various utility
70ce6676dbSmrg          functionality such as caching and byte swapping.</para>
71ce6676dbSmrg
72ce6676dbSmrg    <para><indexterm><primary>os layer</primary></indexterm>
73ce6676dbSmrg	  The <firstterm>os</firstterm> layer sets up the
74ce6676dbSmrg          communications channel, reads requests and sends the raw
75ce6676dbSmrg          data of replies and events. It also handles font server
76ce6676dbSmrg          configuration issues, controlled by command line
77ce6676dbSmrg          arguments and a configuration file.</para>
78ce6676dbSmrg
79ce6676dbSmrg    <para><indexterm><primary>renderer layer</primary></indexterm>
80ce6676dbSmrg	  The <firstterm>renderer</firstterm> layer contains all
81ce6676dbSmrg          font-specific code, and is responsible for rendering a font
82ce6676dbSmrg          (which may mean just reading a bitmap from disk, or may
83ce6676dbSmrg          include scaling of outline data), computing a fonts
84ce6676dbSmrg          properties and header information.</para>
85ce6676dbSmrg
86ce6676dbSmrg   </sect2>
87ce6676dbSmrg  </sect1>
88ce6676dbSmrg  <sect1 id='startup'>
89ce6676dbSmrg    <title>Startup</title>
90ce6676dbSmrg    <para>At startup, the font server handles any command line
91ce6676dbSmrg	  arguments, initializes any OS-specific data, and then sets up
92ce6676dbSmrg	  the communications. Various internal databases are then
93ce6676dbSmrg	  initialized (extensions, the font catalogue, etc).</para>
94ce6676dbSmrg
95ce6676dbSmrg    <para><indexterm><primary>configuration file</primary></indexterm>
96ce6676dbSmrg          The config file, an ordered list of font sources, cache
97ce6676dbSmrg	  size hints, default resolutions, and security information, is
98ce6676dbSmrg	  then read in. Each of these source names could be a directory
99ce6676dbSmrg	  name, the name of another font server, or some other string
100ce6676dbSmrg	  that a particular renderer can recognize.</para>
101ce6676dbSmrg
102ce6676dbSmrg    <para>The default font catalogue is then built up by taking
103ce6676dbSmrg	  each of the font source names and comparing it with the
104ce6676dbSmrg	  names a renderer recognizes. The one that matches this name
105ce6676dbSmrg	  will become attached to this source. A renderer will
106ce6676dbSmrg	  &ldquo;understand&rdquo; a name if it can parse the data in
107ce6676dbSmrg	  that directory, or recognize that it is a valid font server
108ce6676dbSmrg	  address, or recognizes a special string. Thus a collection
109ce6676dbSmrg	  of valid font path elements is built up. Each
110ce6676dbSmrg	  <emphasis remap='B'>FPE</emphasis> has a set of functions to
111ce6676dbSmrg	  support opening a font and accessing its data.</para>
112ce6676dbSmrg
113ce6676dbSmrg    <para>Font information is accessed via method functions in the
114ce6676dbSmrg     <indexterm><primary><structname>Font</structname></primary></indexterm>
115ce6676dbSmrg	  <structname>Font</structname>. When a font is first
116ce6676dbSmrg	  loaded, the header information and properties are
117ce6676dbSmrg	  loaded/computed. The font also initializes its function
118ce6676dbSmrg	  pointers to do the proper work. When specific metrics or
119ce6676dbSmrg	  bitmaps are required, they are access via the font's
120ce6676dbSmrg	  functions.  A disk-based bitmap font will probably want to
121ce6676dbSmrg	  load all data when first accessed. A scaled font or FS font
122ce6676dbSmrg	  may want to do more selective caching. In both cases, the
123ce6676dbSmrg	  renderer can use the utility functions to keep track of this
124ce6676dbSmrg	  data. Changing values of bitmap formats could result in the
125ce6676dbSmrg	  font having multiple copies of data in different formats,
126ce6676dbSmrg	  which the renderer may use the utility functions to
127ce6676dbSmrg	  manage.</para>
128ce6676dbSmrg  </sect1>
129ce6676dbSmrg  <sect1 id='per_client_processing'>
130ce6676dbSmrg    <title>Per client processing</title>
131ce6676dbSmrg    <para>Each entity attaching to the server is a client. Each
132ce6676dbSmrg	  client has its own authorization and resolution information,
133ce6676dbSmrg	  and its own view of the font database. A font open to one
134ce6676dbSmrg	  client may not be open to another, though the font server
135ce6676dbSmrg	  may have it loaded.</para>
136ce6676dbSmrg
137ce6676dbSmrg    <para>After initialization, new clients can attach to the font
138ce6676dbSmrg	  server and have their requests processed. For each request that
139ce6676dbSmrg	  is searching for a font (<systemitem>OpenBitmapFont</systemitem>) or
140ce6676dbSmrg	  listing font names (<systemitem>ListFonts</systemitem>,
141ce6676dbSmrg	  <systemitem>ListFontsWithXInfo</systemitem>), the pattern
142ce6676dbSmrg	  is given to each <emphasis remap='B'>FPE</emphasis>.</para>
143ce6676dbSmrg
144ce6676dbSmrg    <para><indexterm><primary><systemitem>OpenBitmapFont</systemitem></primary></indexterm>
145ce6676dbSmrg          <systemitem>OpenBitmapFont</systemitem> will take the supplied
146ce6676dbSmrg	  name and pass it to each <emphasis remap='B'>FPE</emphasis>.
147ce6676dbSmrg	  The <emphasis remap='B'>FPE</emphasis> will return one of
148ce6676dbSmrg	  three things: <errorname>Success</errorname>, and the font
149ce6676dbSmrg	  object; <errorname>BadFont</errorname>, because it doesn't
150ce6676dbSmrg	  know the font; or <errorname>BadFont</errorname> and an
151ce6676dbSmrg	  alias name, when it has an alias for the font. If
152ce6676dbSmrg	  <errorname>Success</errorname> is returned, the server goes
153ce6676dbSmrg	  on to create an ID (or find an existing one) and return a
154ce6676dbSmrg	  reply. If <errorname>BadFont</errorname> is returned, it
155ce6676dbSmrg	  goes on to the next <emphasis remap='B'>FPE</emphasis>. If
156ce6676dbSmrg	  it reaches the end without finding a font, an error is
157ce6676dbSmrg	  returned to the client. If an alias is returned, the search
158ce6676dbSmrg	  resets to the first <emphasis remap='B'>FPE</emphasis> and
159ce6676dbSmrg	  starts again, using the alias as the new font name. This
160ce6676dbSmrg	  allows aliases to work across different
161ce6676dbSmrg	  <emphasis remap='B'>FPEs</emphasis>, without any ordering
162ce6676dbSmrg	  restrictions.</para>
163ce6676dbSmrg
164ce6676dbSmrg    <para>When each <emphasis remap='B'>FPE</emphasis> receives a font
165ce6676dbSmrg	  name to open, it searches for the font's existence. If it
166ce6676dbSmrg	  can't find, or can only find an alias, it returns
167ce6676dbSmrg	  <errorname>BadFont</errorname> and any alias. If it finds
168ce6676dbSmrg	  the font, it checks the authorization and license status of
169ce6676dbSmrg	  the font to that of the client. If it passes, it then
170ce6676dbSmrg	  creates a new font object, and reads and/or computes at
171ce6676dbSmrg	  least the font's header information and properties. (It may
172ce6676dbSmrg	  also want to produce the bitmaps and extents, but that
173ce6676dbSmrg	  choice is left to the renderer.)</para>
174ce6676dbSmrg
175ce6676dbSmrg    <para>When a font's information is accessed, the interpreter
176ce6676dbSmrg	  routine looks up the font ID to find the font object, and
177ce6676dbSmrg	  then uses the font's access functions to get the data. These
178ce6676dbSmrg	  functions will return the data in the format expected by the
179ce6676dbSmrg	  client.</para>
180ce6676dbSmrg  </sect1>
181ce6676dbSmrg
182ce6676dbSmrg  <sect1 id='client_shutdown'>
183ce6676dbSmrg    <title>Client shutdown</title>
184ce6676dbSmrg    <para>When a client disconnects, all its references to any
185ce6676dbSmrg    fonts it still has opened are removed. If no other clients
186ce6676dbSmrg    reference these fonts, they may be freed, though the server may
187ce6676dbSmrg    choose to cache them.</para>
188ce6676dbSmrg  </sect1>
189ce6676dbSmrg
190ce6676dbSmrg  <sect1 id='server_reset_and_cleanup'>
191ce6676dbSmrg    <title>Server reset and cleanup</title>
192ce6676dbSmrg    <para>A server may be reset to flush the caches, re-read the
193ce6676dbSmrg    configuration file, and a new list of
194ce6676dbSmrg    <emphasis remap='B'>FPEs</emphasis> to be built, via an
195ce6676dbSmrg    OS-specific outside action. In UNIX, this will be handled via
196ce6676dbSmrg    signals; in VMS it could be handled via an async trap or event
197ce6676dbSmrg    flag.</para>
198ce6676dbSmrg  </sect1>
199ce6676dbSmrg
200ce6676dbSmrg  <sect1 id='server_offloading'>
201ce6676dbSmrg    <title>Server offloading</title>
202ce6676dbSmrg    <para>In order to deal with numerous clients without major
203ce6676dbSmrg    performance degradation, the server must be able to clone
204ce6676dbSmrg    itself, or provide the client with a substitute server via the
205ce6676dbSmrg    alternate server mechanism. Since both strategies have their
206ce6676dbSmrg    uses, both will be supported. For a server that has plenty of
207ce6676dbSmrg    host memory or CPU, but insufficient sockets, cloning may be a
208ce6676dbSmrg    good choice. For a host with limited memory, assigning an
209ce6676dbSmrg    alternate server on a different host may be a good choice. The
210ce6676dbSmrg    server will make this decision based on configuration options.</para>
211ce6676dbSmrg  </sect1>
212ce6676dbSmrg
213ce6676dbSmrg  <sect1 id='font_server_data_structures'>
214ce6676dbSmrg    <title>Font server data structures</title>
215ce6676dbSmrg    <para>The
216ce6676dbSmrg     <indexterm><primary><structname>Client</structname></primary></indexterm>
217ce6676dbSmrg     <firstterm id='struct_client'><structname>Client</structname></firstterm>
218ce6676dbSmrg	  handles per-client information and interpreter status.
219ce6676dbSmrg    <synopsis>
220ce6676dbSmrgtypedef struct _Client {
221ce6676dbSmrg    int         index;
222ce6676dbSmrg    pointer     osPrivate;
223ce6676dbSmrg    int         noClientException;
224ce6676dbSmrg    int         (**requestVector) ();
225ce6676dbSmrg    pointer     requestBuffer;
226ce6676dbSmrg    int         clientGone;
227ce6676dbSmrg    int         sequence;
228ce6676dbSmrg    Bool        swapped;
229ce6676dbSmrg    long        last_request_time;
230ce6676dbSmrg    void        (*pSwapReplyFunc) ();
231ce6676dbSmrg    AuthContextPtr auth;
232ce6676dbSmrg    char       *catalogues;
233ce6676dbSmrg    int         num_catalogues;
234ce6676dbSmrg    Mask        eventmask;
235ce6676dbSmrg    fsResolution *resolutions;
236ce6676dbSmrg    int         num_resolutions;
237ce6676dbSmrg}           ClientRec, *ClientPtr;
238ce6676dbSmrg    </synopsis></para>
239ce6676dbSmrg    <para>The
240ce6676dbSmrg     <indexterm><primary><structname>Font</structname></primary></indexterm>
241ce6676dbSmrg     <firstterm id='struct_font'><structname>Font</structname></firstterm>
242ce6676dbSmrg	  contains basic font  information, including header information and
243ce6676dbSmrg	  properties.
244ce6676dbSmrg    <synopsis>
245ce6676dbSmrgtypedef struct _font	{
246ce6676dbSmrg	int	refcount;
247ce6676dbSmrg	fsHeader	header;
248ce6676dbSmrg	fsBitmapFormat	format;
249ce6676dbSmrg	int	(*get_glyphs)();
250ce6676dbSmrg	int	(*get_metrics)();
251ce6676dbSmrg	int	(*get_extents)();
252ce6676dbSmrg	int	(*get_bitmaps)();
253ce6676dbSmrg	int	(*unload_font)();
254ce6676dbSmrg	FontPathElementPtr	fpe;
255ce6676dbSmrg	int	*client_ids;
256ce6676dbSmrg	Bool	restricted_font;
257ce6676dbSmrg}	FontRec *FontPtr;
258ce6676dbSmrg    </synopsis></para>
259ce6676dbSmrg    <para>The
260ce6676dbSmrg     <indexterm><primary><structname>ClientFont</structname></primary></indexterm>
261ce6676dbSmrg     <firstterm id='struct_clientfont'><structname>ClientFont</structname></firstterm>
262ce6676dbSmrg	  is a wrapper on top of <structname>Font</structname>,
263ce6676dbSmrg	  handling client specific font information.
264ce6676dbSmrg    <synopsis>
265ce6676dbSmrgtypedef struct _clientfont {
266ce6676dbSmrg	FontPtr	font;
267ce6676dbSmrg	int	clientindex;
268ce6676dbSmrg}	ClientFontRec, *ClientFontRec;
269ce6676dbSmrg    </synopsis></para>
270ce6676dbSmrg    <para>The
271ce6676dbSmrg     <indexterm><primary><structname>AuthContext</structname></primary></indexterm>
272ce6676dbSmrg
273ce6676dbSmrg     <firstterm id='struct_authcontext'><structname>AuthContext</structname></firstterm>
274ce6676dbSmrg	  contains authorization information.
275ce6676dbSmrg    <synopsis>
276ce6676dbSmrgtypedef 	struct _authcontext	{
277ce6676dbSmrg	char	*authname;
278ce6676dbSmrg	char	*authdata;
279ce6676dbSmrg	FSID	acid;
280ce6676dbSmrg}	AuthContextRec *AuthContextPtr;
281ce6676dbSmrg    </synopsis></para>
282ce6676dbSmrg  </sect1>
283ce6676dbSmrg  <sect1 id='font_path_element_functions'>
284ce6676dbSmrg    <title>Font Path Element functions</title>
285ce6676dbSmrg    <indexterm id='fpe_functions' class='startofrange'>
286ce6676dbSmrg      <primary>Font Path Element</primary></indexterm>
287ce6676dbSmrg    <para>These functions are associated with each renderer, and
288ce6676dbSmrg    handle all aspects of font access. Font data access is
289ce6676dbSmrg    controlled via another set of functions described later. These
290ce6676dbSmrg    functions are intended to support the R5 X server as well as
291ce6676dbSmrg    the font server. As a result, some design decisions were made
292ce6676dbSmrg    to support both models. When the
293ce6676dbSmrg    <emphasis remap='I'>difs</emphasis> layer needs to access a
294ce6676dbSmrg    font, it uses these functions.</para>
295ce6676dbSmrg
296ce6676dbSmrg
297ce6676dbSmrg    <synopsis>
298ce6676dbSmrgtypedef unsigned long Mask;
299ce6676dbSmrgtypedef unsigned char *pointer;
300ce6676dbSmrg
301ce6676dbSmrgtypedef struct _FontPathElement {
302ce6676dbSmrg    int         name_length;
303ce6676dbSmrg    char       *name;
304ce6676dbSmrg    int         type;
305ce6676dbSmrg    int         refcount;
306ce6676dbSmrg    pointer     private;
307ce6676dbSmrg}           FontPathElementRec, *FontPathElementPtr;
308ce6676dbSmrg    </synopsis>
309ce6676dbSmrg
310ce6676dbSmrg
311ce6676dbSmrg    <para>The FPE's reference count is incremented when it is added
312ce6676dbSmrg    to the current list of FPEs and when it opens a font. It is
313ce6676dbSmrg    decremented when it is no longer in the current list and when
314ce6676dbSmrg    it closes a font. All reference changes are handled by the
315ce6676dbSmrg    <emphasis remap='I'>difs</emphasis> layer. The count is required
316ce6676dbSmrg    to support font catalogue changes that may occur while the
317ce6676dbSmrg    fontserver has fonts open, and keeps FPEs from being
318ce6676dbSmrg    lost.</para>
319ce6676dbSmrg
320ce6676dbSmrg
321ce6676dbSmrg    <synopsis>
322ce6676dbSmrgtypedef struct FontNames {
323ce6676dbSmrg    int	nnames;
324ce6676dbSmrg    int	size;
325ce6676dbSmrg    int	*length;
326ce6676dbSmrg    char	**names;
327ce6676dbSmrg}	    FontNamesRec, *FontNamesPtr;
328ce6676dbSmrg
329ce6676dbSmrgtypedef struct {
330ce6676dbSmrg	Bool	(*name_check)();
331ce6676dbSmrg	int	(*init_fpe)();
332ce6676dbSmrg	int	(*reset_fpe)();
333ce6676dbSmrg	int	(*free_fpe)();
334ce6676dbSmrg	int	(*open_font)();
335ce6676dbSmrg	int	(*close_font)();
336ce6676dbSmrg	int	(*list_fonts)();
337ce6676dbSmrg	int	(*start_list_fonts_with_info)();
338ce6676dbSmrg	int	(*list_next_font_with_info)();
339ce6676dbSmrg	int	(*wakeup_fpe)();
340ce6676dbSmrg	int	(*client_died);
341ce6676dbSmrg	FontNamesPtr	renderer_names;
342ce6676dbSmrg} FPEFunctions;
343ce6676dbSmrg
344ce6676dbSmrgint	init_fpe_type(Bool (name_func)(),
345ce6676dbSmrg		int (init_func)(), int (free_func)(), int (reset_func),
346ce6676dbSmrg		int (open_func)(), int (close_func)(),
347ce6676dbSmrg		int (list_func)(),
348ce6676dbSmrg		int (start_lfwi_func)(), int (next_lfwi_func)(),
349ce6676dbSmrg		int (wakeup_func)(),
350ce6676dbSmrg		int (client_died_func)()
351ce6676dbSmrg		)
352ce6676dbSmrg    </synopsis>
353ce6676dbSmrg    <para>This is called by the renderer when it is initialized at
354ce6676dbSmrg    the beginning of time, and sets up an FPEFunctions entry for
355ce6676dbSmrg    the renderer.</para>
356ce6676dbSmrg    <para>The
357ce6676dbSmrg    <emphasis remap='B'>FPEFunctions</emphasis> have the following
358ce6676dbSmrg    parameters:</para>
359ce6676dbSmrg    <para>
360ce6676dbSmrg      <synopsis>
361ce6676dbSmrgBool	name_check(char *<parameter>name</parameter>);
362ce6676dbSmrg      </synopsis>
363ce6676dbSmrg
364ce6676dbSmrg      If <parameter class="function">name</parameter> is something the
365ce6676dbSmrg      renderer recognizes as a valid font source name, it returns
366ce6676dbSmrg      <constant>True</constant>, otherwise <constant>False</constant>.
367ce6676dbSmrg      ie, if <parameter class="function">name</parameter>
368ce6676dbSmrg      is a directory name, or is prefixed by the renderer's prefix,
369ce6676dbSmrg      and the directory contains font data the renderer can interpret,
370ce6676dbSmrg      it would return <constant>True</constant>.
371ce6676dbSmrg    </para>
372ce6676dbSmrg    <para>
373ce6676dbSmrg      <synopsis>
374ce6676dbSmrgint	init_fpe(FontPathElementPtr <parameter>fpe</parameter>);
375ce6676dbSmrg      </synopsis>
376ce6676dbSmrg      Does any initialization work for the renderer. The name in
377ce6676dbSmrg      <parameter class="function">fpe</parameter> will be one whose prefix
378ce6676dbSmrg      matches the list returned when the renderer was initialized.
379ce6676dbSmrg    </para>
380ce6676dbSmrg    <para>
381ce6676dbSmrg      <synopsis>
382ce6676dbSmrgint	reset_fpe(FontPathElementPtr <parameter>fpe</parameter>);
383ce6676dbSmrg      </synopsis>
384ce6676dbSmrg      Tells <parameter class="function">fpe</parameter> to reset any
385ce6676dbSmrg      internal state about what fonts it has available. This will typically be
386ce6676dbSmrg      called because the font server's <emphasis remap='B'>FPE</emphasis>
387ce6676dbSmrg      search list has been changed. The
388ce6676dbSmrg      <parameter class="function">fpe</parameter> should reset any cached state
389ce6676dbSmrg      of available fonts (ie, re-read <filename>fonts.dir</filename>)
390ce6676dbSmrg    </para>
391ce6676dbSmrg    <para>
392ce6676dbSmrg      <synopsis>
393ce6676dbSmrgint	free_fpe(FontPathElementPtr <parameter>fpe</parameter>);
394ce6676dbSmrg      </synopsis>
395ce6676dbSmrg      Frees any renderer-specific data and closes any files or sockets.
396ce6676dbSmrg    </para>
397ce6676dbSmrg    <para>
398ce6676dbSmrg      <synopsis>
399ce6676dbSmrgint	open_font(pointer <parameter>client</parameter>, FontPathElementPtr <parameter>fpe</parameter>, Mask <parameter>flags</parameter>,
400ce6676dbSmrg		  char *<parameter>fontname</parameter>, int <parameter>namelength</parameter>,
401ce6676dbSmrg		  fsBitmapFormat <parameter>format_hint</parameter>, fsBitmapFormatMask <parameter>format_mask</parameter>,
402ce6676dbSmrg		  XID <parameter>fontid</parameter>, FontPtr *<parameter>ppfont</parameter>, char **<parameter>alias</parameter>);
403ce6676dbSmrg      </synopsis>
404ce6676dbSmrg
405ce6676dbSmrg      Opens the font. The bits marked by
406ce6676dbSmrg      <parameter class="function">format_mask</parameter> and
407ce6676dbSmrg      <parameter class="function">format_hint</parameter>
408ce6676dbSmrg      are used where applicable. The resulting FontPtr is returned in
409ce6676dbSmrg      <parameter class="function">ppfont</parameter>. The
410ce6676dbSmrg      <parameter class="function">client</parameter> is optional state
411ce6676dbSmrg      information for use with blocking renderers. If the
412ce6676dbSmrg      <parameter class="function">fontname</parameter> resolves to an
413ce6676dbSmrg      alias, it is returned in <parameter class="function">alias</parameter>
414ce6676dbSmrg      with a <errorcode>FontNameAlias</errorcode> error. This tells
415ce6676dbSmrg      the calling code to start searching again, using
416ce6676dbSmrg      <parameter class="function">alias</parameter> as the font name. The
417ce6676dbSmrg      renderer is expected to fill in any information specified by the
418ce6676dbSmrg      <parameter class="function">flags</parameter>.
419ce6676dbSmrg    </para>
420ce6676dbSmrg    <para>Possible <parameter class="function">flags</parameter> values are:
421ce6676dbSmrg      <synopsis>
422ce6676dbSmrg#define FontLoadInfo    0x0001		/* font header info */
423ce6676dbSmrg#define FontLoadProps   0x0002		/* font properties */
424ce6676dbSmrg#define FontLoadMetrics 0x0004		/* font extents */
425ce6676dbSmrg#define FontLoadBitmaps 0x0008		/* glyph bitmaps */
426ce6676dbSmrg#define FontLoadAll     0x000f
427ce6676dbSmrg#define FontOpenSync    0x0010		/* force synchronous loading */
428ce6676dbSmrg      </synopsis>
429ce6676dbSmrg    </para>
430ce6676dbSmrg
431ce6676dbSmrg    <para>Once a font has been opened, the server may place it and
432ce6676dbSmrg      the pattern it matched into a name cache, to avoid lengthy
433ce6676dbSmrg      searching if the font is reopened. If the renderer does not wish
434ce6676dbSmrg      the font to be in this cache (for licensing reasons), it should
435ce6676dbSmrg      set the font's <emphasis remap='I'>restricted_access</emphasis>
436ce6676dbSmrg      flag.
437ce6676dbSmrg    </para>
438ce6676dbSmrg
439ce6676dbSmrg    <para>
440ce6676dbSmrg      <synopsis>
441ce6676dbSmrgint	close_font(FontPtr <parameter>pfont</parameter>);
442ce6676dbSmrg      </synopsis>
443ce6676dbSmrg
444ce6676dbSmrg      Frees up all the data associated with the font.
445ce6676dbSmrg    </para>
446ce6676dbSmrg
447ce6676dbSmrg    <para>
448ce6676dbSmrg      <synopsis>
449ce6676dbSmrgint	list_fonts(pointer <parameter>client</parameter>, FontPathElementPtr <parameter>fpe</parameter>,
450ce6676dbSmrg		char *<parameter>pattern</parameter>, int <parameter>pattern_length</parameter>, int <parameter>maxnames</parameter>,
451ce6676dbSmrg		FontNamesPtr *<parameter>paths</parameter>);
452ce6676dbSmrg      </synopsis>
453ce6676dbSmrg
454ce6676dbSmrg      Returns in <parameter class="function">paths</parameter> up to
455ce6676dbSmrg      <parameter class="function">maxnames</parameter> font names the fpe
456ce6676dbSmrg      recognizes as matching the given pattern.
457ce6676dbSmrg    </para>
458ce6676dbSmrg
459ce6676dbSmrg    <para>
460ce6676dbSmrg      <synopsis>
461ce6676dbSmrgint	start_list_fonts_with_info(pointer <parameter>client</parameter>,
462ce6676dbSmrg		FontPathElementPtr <parameter>fpe</parameter>, char *<parameter>pattern</parameter>, int <parameter>pattern_length</parameter>,
463ce6676dbSmrg		int <parameter>maxnames</parameter>, pointer <parameter>fpe_data</parameter>);
464ce6676dbSmrg      </synopsis>
465ce6676dbSmrg
466ce6676dbSmrg      Initiates a <systemitem>ListFontsWithXInfo</systemitem>.
467ce6676dbSmrg      Typically, a disk-based renderer will do the equivalent of
468ce6676dbSmrg      <systemitem>ListFonts</systemitem> to gather all the font names
469ce6676dbSmrg      matching the pattern. A font server renderer will send the
470ce6676dbSmrg      request.  <parameter class="function">fpe_data</parameter>
471ce6676dbSmrg      provides a handle for any FPE-private data that needs to be
472ce6676dbSmrg      passed in later via
473ce6676dbSmrg      <function>list_next_font_with_info()</function>, eg, the list of
474ce6676dbSmrg      font names for a disk-based renderer.
475ce6676dbSmrg    </para>
476ce6676dbSmrg
477ce6676dbSmrg    <para>
478ce6676dbSmrg      <synopsis>
479ce6676dbSmrgint	list_next_font_with_info(pointer <parameter>client</parameter>, FontPathElementPtr <parameter>fpe</parameter>,
480ce6676dbSmrg		char **<parameter>name</parameter>, int *<parameter>namelen</parameter>, FontInfoPtr *<parameter>pinfo</parameter>,
481ce6676dbSmrg		int *<parameter>num_fonts</parameter>, pointer <parameter>fpe_data</parameter>);
482ce6676dbSmrg      </synopsis>
483ce6676dbSmrg
484ce6676dbSmrg      Returns the next font's information. The renderer should keep any state
485ce6676dbSmrg      it requires in the <parameter class="function">fpe_data</parameter>
486ce6676dbSmrg      field.  <parameter class="function">num_fonts</parameter> contains the
487ce6676dbSmrg      number of replies remaining.
488ce6676dbSmrg    </para>
489ce6676dbSmrg
490ce6676dbSmrg    <para>These two routines are split for because of the way both
491ce6676dbSmrg      disk-based renderers and font server renderers handle this
492ce6676dbSmrg      request. The first function initiates the action, the second is
493ce6676dbSmrg      used to gather the results. For a disk-based renderer, a list of
494ce6676dbSmrg      font names matching the pattern is first built up when
495ce6676dbSmrg      <function>start_list_fonts_with_info()</function>is called, and
496ce6676dbSmrg      the results are gathered with each call to
497ce6676dbSmrg      <function>list_next_font_with_info()</function>. In a font
498ce6676dbSmrg      server renderer, the first function sends the
499ce6676dbSmrg      <systemitem>ListFontsWithXInfo</systemitem> request, and the
500ce6676dbSmrg      second processes the replies.
501ce6676dbSmrg    </para>
502ce6676dbSmrg
503ce6676dbSmrg    <para>
504ce6676dbSmrg    <synopsis>
505ce6676dbSmrgint	wakeup_fpe(FontPathElementPtr <parameter>fpe</parameter>, unsigned long *<parameter>mask</parameter>)
506ce6676dbSmrg    </synopsis>
507ce6676dbSmrg
508ce6676dbSmrg      Optional function which can be used for blocking
509ce6676dbSmrg      renderers. Typical usage is for a font server renderer, where it
510ce6676dbSmrg      is called when a reply is received, allowing the data to be read
511ce6676dbSmrg      and the client to be signaled and unblocked.
512ce6676dbSmrg    </para>
513ce6676dbSmrg
514ce6676dbSmrg    <para>
515ce6676dbSmrg      <synopsis>
516ce6676dbSmrgint	client_died(pointer <parameter>client</parameter>, FontPathElementPtr <parameter>fpe</parameter>)
517ce6676dbSmrg      </synopsis>
518ce6676dbSmrg
519ce6676dbSmrg
520ce6676dbSmrg      This function is called when a client dies in the middle of a
521ce6676dbSmrg      blocked request, allowing the renderer to clean up.
522ce6676dbSmrg    </para>
523ce6676dbSmrg    <indexterm startref='fpe_functions' class='endofrange' />
524ce6676dbSmrg  </sect1>
525ce6676dbSmrg  <sect1 id='font_specific_functions'>
526ce6676dbSmrg    <title>Font specific functions</title>
527ce6676dbSmrg    <indexterm id='font_functions' class='startofrange'>
528ce6676dbSmrg      <primary><structname>Font</structname></primary></indexterm>
529ce6676dbSmrg    <para>These functions are contained in each
530ce6676dbSmrg    <structname>Font</structname>. For many renderers, every
531ce6676dbSmrg    font will use the same functions, but some renderers may wish
532ce6676dbSmrg    to use different interfaces for different fonts.</para>
533ce6676dbSmrg
534ce6676dbSmrg
535ce6676dbSmrg    <synopsis>
536ce6676dbSmrgtypedef struct {
537ce6676dbSmrg	INT16	left B16,
538ce6676dbSmrg		right B16;
539ce6676dbSmrg	INT16	width B16;
540ce6676dbSmrg	INT16	ascent B16,
541ce6676dbSmrg		descent B16;
542ce6676dbSmrg	CARD16	attributes B16;
543ce6676dbSmrg}	fsCharInfo;
544ce6676dbSmrg
545ce6676dbSmrgtypedef struct {
546ce6676dbSmrg    CARD8	low,
547ce6676dbSmrg		high;
548ce6676dbSmrg}           fsChar2b;
549ce6676dbSmrg
550ce6676dbSmrgtypedef struct {
551ce6676dbSmrg    fsChar2b	min_char,
552ce6676dbSmrg		max_char;
553ce6676dbSmrg}           fsRange;
554ce6676dbSmrg
555ce6676dbSmrgint	get_extents(pointer <parameter>client</parameter>,
556ce6676dbSmrg		FontPtr <parameter>pfont</parameter>, Mask <parameter>flags</parameter>, int <parameter>num_ranges</parameter>, fsRange *<parameter>ranges</parameter>,
557ce6676dbSmrg		int *<parameter>num_extents</parameter>, fsCharInfo **<parameter>extents</parameter>);
558ce6676dbSmrg    </synopsis>
559ce6676dbSmrg
560ce6676dbSmrg
561ce6676dbSmrg    <para>Possible flags:</para>
562ce6676dbSmrg
563ce6676dbSmrg
564ce6676dbSmrg    <synopsis>
565ce6676dbSmrgLoadAll		/* ignore the ranges and get everything */
566ce6676dbSmrgFinishRange	/* magic for range completion as specified by protocol */
567ce6676dbSmrg    </synopsis>
568ce6676dbSmrg
569ce6676dbSmrg
570ce6676dbSmrg    <para>Builds up the requested array of extents. The extent data
571ce6676dbSmrg    (which the renderer allocates) is returned, as well as the
572ce6676dbSmrg    number of extents.
573ce6676dbSmrg    <emphasis remap='I'>closure</emphasis> contains any blocking
574ce6676dbSmrg    state information.</para>
575ce6676dbSmrg
576ce6676dbSmrg    <synopsis>
577ce6676dbSmrg
578ce6676dbSmrg
579ce6676dbSmrgint	get_bitmaps(pointer <parameter>client</parameter>,
580ce6676dbSmrg		FontPtr <parameter>pfont</parameter>, fsBitmapFormat <parameter>format</parameter>, Mask <parameter>flags</parameter>,
581ce6676dbSmrg		int <parameter>num_ranges</parameter>, fsRange *<parameter>ranges</parameter>,
582ce6676dbSmrg		unsigned long *<parameter>size</parameter>, unsigned long *<parameter>num_glyphs</parameter>,
583ce6676dbSmrg		unsigned long **<parameter>offsets</parameter>, pointer *<parameter>glyph_data</parameter>);
584ce6676dbSmrg    </synopsis>
585ce6676dbSmrg
586ce6676dbSmrg
587ce6676dbSmrg    <para>Possible flags:</para>
588ce6676dbSmrg
589ce6676dbSmrg    <synopsis>
590ce6676dbSmrgLoadAll
591ce6676dbSmrgFinishRange	/* magic for range completion as specified by protocol */
592ce6676dbSmrg    </synopsis>
593ce6676dbSmrg
594ce6676dbSmrg
595ce6676dbSmrg    <para>Builds up the requested array of bitmaps. The glyph and
596ce6676dbSmrg    offset data (which the renderer allocates) is returned, as well
597ce6676dbSmrg    as the number of glyphs. The
598ce6676dbSmrg    <emphasis remap='I'>closure</emphasis> contains any blocking
599ce6676dbSmrg    state information. This function will build up the bitmap data
600ce6676dbSmrg    in the format specified by
601ce6676dbSmrg    <parameter class="function">format</parameter> so that the interpreter
602ce6676dbSmrg    can return it without any additional modification. This should
603ce6676dbSmrg    minimize data massaging, since outline renderers will hopefully
604ce6676dbSmrg    be able to produce the bitmaps in the proper format.</para>
605ce6676dbSmrg
606ce6676dbSmrg    <synopsis>
607ce6676dbSmrgvoid	unload_font(FontPtr <parameter>pfont</parameter>)
608ce6676dbSmrg    </synopsis>
609ce6676dbSmrg
610ce6676dbSmrg
611ce6676dbSmrg    <para>The render will free any allocated data. Note that the
612ce6676dbSmrg    <emphasis remap='B'>FPE</emphasis> function
613ce6676dbSmrg    <function>close_font()</function> will also be called, and
614ce6676dbSmrg    should handle any
615ce6676dbSmrg    <emphasis remap='B'>FPE</emphasis> data allocated for the
616ce6676dbSmrg    font.</para>
617ce6676dbSmrg
618ce6676dbSmrg    <synopsis>
619ce6676dbSmrgint	get_glyphs()
620ce6676dbSmrgint	get_metrics()
621ce6676dbSmrg    </synopsis>
622ce6676dbSmrg
623ce6676dbSmrg
624ce6676dbSmrg    <para>These two functions are used by the X server for loading
625ce6676dbSmrg    glyphs and metrics. They expect the results in a considerably
626ce6676dbSmrg    different form. The
627ce6676dbSmrg    <function>get_bitmaps()</function> and
628ce6676dbSmrg    <function>get_extents()</function> routines both allow for
629ce6676dbSmrg    better cache control by the renderer.</para>
630ce6676dbSmrg    <indexterm startref='font_functions' class='endofrange' />
631ce6676dbSmrg  </sect1>
632ce6676dbSmrg  <sect1 id='font_directories_and_aliases'>
633ce6676dbSmrg    <title>Font directories and aliases</title>
634ce6676dbSmrg    <para>Existing bitmap renderers already have their own concept
635ce6676dbSmrg	of font organization. In the X sample server, the files
636ce6676dbSmrg	<filename>fonts.dir</filename> and <filename>fonts.alias</filename>
637ce6676dbSmrg	are used to list the known fonts. <filename>fonts.dir</filename>
638ce6676dbSmrg	maps file names to font names, while <filename>fonts.alias</filename>
639ce6676dbSmrg	maps font names to other font names.
640ce6676dbSmrg    </para>
641ce6676dbSmrg    <para>These concepts will also be needed by other forms of
642ce6676dbSmrg    fonts which the sample X server does not currently use, but the
643ce6676dbSmrg    font server will, like Bitstream outlines.</para>
644ce6676dbSmrg  </sect1>
645ce6676dbSmrg  <sect1 id='handling_scalable_fonts'>
646ce6676dbSmrg    <title>Handling scalable fonts</title>
647ce6676dbSmrg    <para>For those renderers that support scalable fonts, several
648ce6676dbSmrg    issues must be addressed:</para>
649ce6676dbSmrg    <variablelist spacing='compact'>
650ce6676dbSmrg      <varlistentry>
651ce6676dbSmrg        <term><link linkend='name_parsing'>Name Parsing</link>.</term>
652ce6676dbSmrg        <listitem>
653ce6676dbSmrg          <para>An <acronym>XLFD</acronym> name must be parsed to
654ce6676dbSmrg          determine the requested resolutions and/or sizes.</para>
655ce6676dbSmrg        </listitem>
656ce6676dbSmrg      </varlistentry>
657ce6676dbSmrg      <varlistentry>
658ce6676dbSmrg        <term><link linkend='property_scaling'>Property scaling</link>.</term>
659ce6676dbSmrg        <listitem>
660ce6676dbSmrg          <para>Many of the standard font
661ce6676dbSmrg          properties have values that depend on scaling (eg,
662ce6676dbSmrg          <property>RESOLUTION_X</property>,
663ce6676dbSmrg          <property>POINT_SIZE</property>). </para>
664ce6676dbSmrg        </listitem>
665ce6676dbSmrg      </varlistentry>
666ce6676dbSmrg      <varlistentry>
667ce6676dbSmrg        <term><link linkend='default_values'>Default values</link>.</term>
668ce6676dbSmrg        <listitem>
669ce6676dbSmrg          <para>If resolution information is
670ce6676dbSmrg          wildcarded, the proper default resolution should be
671ce6676dbSmrg          supplied.</para>
672ce6676dbSmrg        </listitem>
673ce6676dbSmrg      </varlistentry>
674ce6676dbSmrg    </variablelist>
675ce6676dbSmrg    <sect2 id='name_parsing'>
676ce6676dbSmrg      <title>Name Parsing</title>
677ce6676dbSmrg      <para>The font name pattern supplied to
678ce6676dbSmrg          <systemitem>OpenBitmapFont</systemitem> or
679ce6676dbSmrg          <systemitem>ListFonts</systemitem> may require some
680ce6676dbSmrg          parsing to be recognized as a scalable font known to the
681ce6676dbSmrg          renderer. The
682ce6676dbSmrg          <property>PIXEL_SIZE</property>,
683ce6676dbSmrg          <property>POINT_SIZE</property>,
684ce6676dbSmrg          <property>RESOLUTION_X</property>,
685ce6676dbSmrg          <property>RESOLUTION_Y</property>, and
686ce6676dbSmrg          <property>AVERAGE_WIDTH</property> all need to
687ce6676dbSmrg          determined from the font name pattern. The master font
688ce6676dbSmrg          must then be found, and scaled appropriately. Any
689ce6676dbSmrg          unspecified values that cannot be determined should be
690ce6676dbSmrg          replaced by the proper defaults. For size fields, this is
691ce6676dbSmrg          whatever the configuration specifies. For resolution
692ce6676dbSmrg          fields, these should be taken from the client's
693ce6676dbSmrg          resolution list, if set, or from the server's
694ce6676dbSmrg          configuration.</para>
695ce6676dbSmrg    </sect2>
696ce6676dbSmrg    <sect2 id='property_scaling'>
697ce6676dbSmrg      <title>Property scaling</title>
698ce6676dbSmrg          <para>Part of scaling a font is scaling its properties.
699ce6676dbSmrg          Many scalable fonts will have a very large number of
700ce6676dbSmrg          scalable properties. One way to deal with these is for
701ce6676dbSmrg          the &ldquo;master&rdquo; outline to keep track of the
702ce6676dbSmrg          property names, and supply new values for each instance
703ce6676dbSmrg          of the font. If the property names are stored as Atoms,
704ce6676dbSmrg          memory usage is kept to a minimum.</para>
705ce6676dbSmrg    </sect2>
706ce6676dbSmrg    <sect2 id='default_values'>
707ce6676dbSmrg      <title>Using defaults</title>
708ce6676dbSmrg          <para>Using default values as substitutions for missing
709ce6676dbSmrg          values was covered above. These defaults will also be
710ce6676dbSmrg          useful in handling <systemitem>ListFonts</systemitem> requests.
711ce6676dbSmrg          Returning a scalable font with an instance using the
712ce6676dbSmrg          default values will provide the most user-friendly
713ce6676dbSmrg          environment.</para>
714ce6676dbSmrg    </sect2>
715ce6676dbSmrg  </sect1>
716ce6676dbSmrg  <sect1 id='access_control'>
717ce6676dbSmrg    <title>Access control</title>
718ce6676dbSmrg    <para>The font server will also support large grain security.
719ce6676dbSmrg    It will have both a limit of the number of users, and on the
720ce6676dbSmrg    hosts which it will support.</para>
721ce6676dbSmrg    <para>Limiting the number of users is as much a server loading
722ce6676dbSmrg    issue as a security issue. The limitation will be typically be
723ce6676dbSmrg    set via configuration options or OS limitations. To change it,
724ce6676dbSmrg    use:</para>
725ce6676dbSmrg
726ce6676dbSmrg    <synopsis>
727ce6676dbSmrgvoid	AccessSetConnectionLimit(int <parameter>limit</parameter>)
728ce6676dbSmrg    </synopsis>
729ce6676dbSmrg
730ce6676dbSmrg
731ce6676dbSmrg    <para>A
732ce6676dbSmrg    <parameter class="function">limit</parameter> of 0 will set it to a
733ce6676dbSmrg    compiled constant based on OS resources (eg, number of file
734ce6676dbSmrg    descriptors).</para>
735ce6676dbSmrg
736ce6676dbSmrg    <para>Client-host based access control can be used to
737ce6676dbSmrg      supplement licensing, and support font server load balancing by
738ce6676dbSmrg      restricting access. As with licensing, this is OS-specific
739ce6676dbSmrg      code. To manipulate these functions, use:
740ce6676dbSmrg
741ce6676dbSmrg    <synopsis>
742ce6676dbSmrgtypedef struct _host_address {
743ce6676dbSmrg	int	type;
744ce6676dbSmrg	pointer	address;
745ce6676dbSmrg	struct _host_address *next;
746ce6676dbSmrg} HostAddress;
747ce6676dbSmrg
748ce6676dbSmrgtypedef HostAddress	*HostList;
749ce6676dbSmrg
750ce6676dbSmrgint	AddHost(HostList <parameter>list</parameter>, HostAddress *<parameter>address</parameter>)
751ce6676dbSmrgint	RemoveHost(HostList <parameter>list</parameter>, HostAddress *<parameter>address</parameter>)
752ce6676dbSmrgBool	ValidHost(HostList <parameter>list</parameter>, HostAddress *<parameter>address</parameter>)
753ce6676dbSmrg    </synopsis>
754ce6676dbSmrg
755ce6676dbSmrg
756ce6676dbSmrg      <function>AddHost()</function> adds a host to the
757ce6676dbSmrg      <parameter class="function">list</parameter>.
758ce6676dbSmrg      <function>RemoveHost()</function> removes it, and
759ce6676dbSmrg      <function>ValidHost()</function> checks to see if its on the
760ce6676dbSmrg      <parameter class="function">list</parameter>. In all functions,
761ce6676dbSmrg      the <parameter class="function">address</parameter> will ignore
762ce6676dbSmrg      any value in the <structfield>next</structfield> field.
763ce6676dbSmrg    </para>
764ce6676dbSmrg    <para>Network addresses are used here to avoid issues with host
765ce6676dbSmrg      name aliases. The caller fills in the desired type, and an
766ce6676dbSmrg      address of that form is returned. This is highly OS-specific,
767ce6676dbSmrg      but values for the <structfield>type</structfield> and
768ce6676dbSmrg      <structfield>address</structfield> fields could include:
769ce6676dbSmrg
770ce6676dbSmrg      <synopsis>
771ce6676dbSmrg#define	HOST_AF_INET	1
772ce6676dbSmrgstruct in_addr	*address;
773ce6676dbSmrg
774ce6676dbSmrg#define	HOST_AF_DECnet	2
775ce6676dbSmrgstruct	dn_addr	*address;
776ce6676dbSmrg      </synopsis>
777ce6676dbSmrg    </para>
778ce6676dbSmrg
779ce6676dbSmrg    <para>The server will use a global host list, but having the
780ce6676dbSmrg    list as an argument will allow licensing schemes to have their
781ce6676dbSmrg    own host lists.</para>
782ce6676dbSmrg  </sect1>
783ce6676dbSmrg  <sect1 id='licensing'>
784ce6676dbSmrg    <title>Licensing</title>
785ce6676dbSmrg    <para>Licensing is a tricky issue, which each renderer will
786ce6676dbSmrg    support in a different way. The sample font server will attempt
787ce6676dbSmrg    to provide some guidelines, and present a possible
788ce6676dbSmrg    implementation of some simple licensing schemes.</para>
789ce6676dbSmrg    <sect2>
790ce6676dbSmrg      <title>Host Address licensing</title>
791ce6676dbSmrg      <para>This is simplistic licensing based on the client's host.
792ce6676dbSmrg	    With this form of licensing, a font may be accessible to some
793ce6676dbSmrg	    host but not others. To get the current client's host, the
794ce6676dbSmrg	    following is used:
795ce6676dbSmrg
796ce6676dbSmrg      <synopsis>
797ce6676dbSmrgvoid	GetHostAddress(HostAddress *<parameter>address</parameter>);
798ce6676dbSmrg      </synopsis>
799ce6676dbSmrg
800ce6676dbSmrg            A renderer can also use the host access functions to keep
801ce6676dbSmrg	    a list of the licensed hosts, and <function>ValidHost()</function>
802ce6676dbSmrg	    to check a client.</para>
803ce6676dbSmrg    </sect2>
804ce6676dbSmrg    <sect2>
805ce6676dbSmrg      <title>Simultaneous use license</title>
806ce6676dbSmrg      <para>This licensing allows for a limited number of copies of
807ce6676dbSmrg	    the font to be open at once. Since this should be a simple
808ce6676dbSmrg	    per-font counter, no support should be required outside of the
809ce6676dbSmrg	    renderer.</para>
810ce6676dbSmrg    </sect2>
811ce6676dbSmrg  </sect1>
812ce6676dbSmrg  <sect1 id='difs_contents'>
813ce6676dbSmrg    <title>DIFS contents</title>
814ce6676dbSmrg    <indexterm id='difs_functions' class='startofrange'>
815ce6676dbSmrg	<primary>difs layer</primary></indexterm>
816ce6676dbSmrg    <para>This contains the protocol dispatcher, interpreter and
817ce6676dbSmrg    reply encoding routines.</para>
818ce6676dbSmrg
819ce6676dbSmrg    <para>The interpreter is table driven off the request code. The
820ce6676dbSmrg    dispatcher gets a request from the os layer from
821ce6676dbSmrg    <function>WaitForSomething()</function>, and uses the
822ce6676dbSmrg    request code to determine which function to call. eg, a
823ce6676dbSmrg    <systemitem>CloseFont</systemitem> request would call
824ce6676dbSmrg    <function>ProcCloseFont()</function>.</para>
825ce6676dbSmrg
826ce6676dbSmrg    <para>Each request's routine handles any applicable error
827ce6676dbSmrg    checking, and then does as much work as it can. For font
828ce6676dbSmrg    related requests, this means converting the request to the
829ce6676dbSmrg    proper arguments for the renderers.</para>
830ce6676dbSmrg
831ce6676dbSmrg    <para>If any replies are generated, the reply data is gathered
832ce6676dbSmrg    into the bytestream format, and sent via
833ce6676dbSmrg    <emphasis remap='I'>os</emphasis> write functions to the
834ce6676dbSmrg    client.</para>
835ce6676dbSmrg
836ce6676dbSmrg    <para>If the byte order of the client and server differ, the
837ce6676dbSmrg    above is modified by having the dispatcher call an intermediate
838ce6676dbSmrg    function which re-orders the request to the proper byte order.
839ce6676dbSmrg    Replies go through similar swapping.</para>
840ce6676dbSmrg
841ce6676dbSmrg    <sect2>
842ce6676dbSmrg      <title>Client blocking</title>
843ce6676dbSmrg    <para>To minimize delay caused by font server request, clients
844ce6676dbSmrg    can be blocked while they wait for data to be produced. This is
845ce6676dbSmrg    primarily intended for
846ce6676dbSmrg    <emphasis remap='B'>FPEs</emphasis> using a remote font server,
847ce6676dbSmrg    but can be used anywhere where the font server can pause to
848ce6676dbSmrg    handle other client requests while data needed to satisfy
849ce6676dbSmrg    another is produced (possibly via multiple processes).</para>
850ce6676dbSmrg
851ce6676dbSmrg    <para>
852ce6676dbSmrg      <synopsis>
853ce6676dbSmrgBool	ClientSleep(ClientPtr <parameter>client</parameter>, Bool (*<parameter>function</parameter>)(), pointer <parameter>closure</parameter>)
854ce6676dbSmrg      </synopsis>
855ce6676dbSmrg
856ce6676dbSmrg      Puts a client to 'sleep'. This means the client will no
857ce6676dbSmrg      longer be considered while the server is dispatching requests.
858ce6676dbSmrg      <parameter class="function">function</parameter> will be called
859ce6676dbSmrg      when the client is signaled, with the
860ce6676dbSmrg      <parameter class="function">client</parameter> and
861ce6676dbSmrg      <parameter class="function">closure</parameter> as its arguments.
862ce6676dbSmrg    </para>
863ce6676dbSmrg
864ce6676dbSmrg    <para>
865ce6676dbSmrg      <synopsis>
866ce6676dbSmrg      Bool ClientSignal(ClientPtr <parameter>client</parameter>)
867ce6676dbSmrg      </synopsis>
868ce6676dbSmrg
869ce6676dbSmrg      This should be called when the client is ready to do more
870ce6676dbSmrg      work. At this point, the function given to
871ce6676dbSmrg      <function>ClientSleep()</function> will be called.
872ce6676dbSmrg    </para>
873ce6676dbSmrg
874ce6676dbSmrg    <para>
875ce6676dbSmrg      <synopsis>
876ce6676dbSmrg      void ClientWakeup(ClientPtr <parameter>client</parameter>)
877ce6676dbSmrg      </synopsis>
878ce6676dbSmrg
879ce6676dbSmrg      Puts the client back to its normal state processing requests.
880ce6676dbSmrg    </para>
881ce6676dbSmrg
882ce6676dbSmrg    <para>
883ce6676dbSmrg      <synopsis>
884ce6676dbSmrg      Bool ClientIsAsleep(ClientPtr <parameter>client</parameter>)
885ce6676dbSmrg      </synopsis>
886ce6676dbSmrg
887ce6676dbSmrg
888ce6676dbSmrg      Can be used to check if a client is asleep. This is
889ce6676dbSmrg      useful for handling client termination, so that any requests
890ce6676dbSmrg      the client is waiting upon can be properly cleaned up.
891ce6676dbSmrg    </para>
892ce6676dbSmrg    </sect2>
893ce6676dbSmrg    <sect2>
894ce6676dbSmrg      <title>Sample Usage</title>
895ce6676dbSmrg
896ce6676dbSmrg    <para>For handling a font server renderer request for
897ce6676dbSmrg    <function>OpenBitmapFont</function> the renderer will
898ce6676dbSmrg    send the request to the remote font server, and the call
899ce6676dbSmrg    <function>ClientSleep()</function>. The font server
900ce6676dbSmrg    will then continue processing requests from other clients,
901ce6676dbSmrg    while the one making the request is blocked. When the reply
902ce6676dbSmrg    returns, the renderer will notice when its
903ce6676dbSmrg    <function>wakeup_fpe()</function> function is called. At this
904ce6676dbSmrg    point the font server renderer will read and process the reply,
905ce6676dbSmrg    <function>ClientSignal()</function> will be called,
906ce6676dbSmrg    and the <parameter>closure</parameter> function will be called.
907ce6676dbSmrg    It will request the data from the renderer, completing the
908ce6676dbSmrg    request, and call
909ce6676dbSmrg    <function>ClientWakeup()</function> to return the
910ce6676dbSmrg    client to normal status.</para>
911ce6676dbSmrg
912ce6676dbSmrg    <para>This layer also contains the resource database, which
913ce6676dbSmrg    associates fonts with IDs, extension interface functions and
914ce6676dbSmrg    the server initialization and reset control.</para>
915ce6676dbSmrg    <indexterm startref='difs_functions' class='endofrange' />
916ce6676dbSmrg    </sect2>
917ce6676dbSmrg  </sect1>
918ce6676dbSmrg  <sect1 id='os_contents'>
919ce6676dbSmrg    <title>OS contents</title>
920ce6676dbSmrg    <indexterm id='os_functions' class='startofrange'>
921ce6676dbSmrg      <primary>os layer</primary></indexterm>
922ce6676dbSmrg    <para>This layer contains OS specific routines for
923ce6676dbSmrg    configuration, command line parsing, client/server
924ce6676dbSmrg    communications, and various OS-dependent utilities such as
925ce6676dbSmrg    memory management and error handling.</para>
926ce6676dbSmrg    <para><function>ReadRequestFromClient()</function>
927ce6676dbSmrg    returns a full request to the dispatcher.
928ce6676dbSmrg    <function>WaitForSomething()</function> is where the
929ce6676dbSmrg    server spends its idle time, waiting for any action from a
930ce6676dbSmrg    client or processing any work left from a blocked
931ce6676dbSmrg    client.</para>
932ce6676dbSmrg
933ce6676dbSmrg    <para>When a client attempts to connect, the server will
934ce6676dbSmrg    call
935ce6676dbSmrg
936ce6676dbSmrg      <synopsis>
937ce6676dbSmrgint	CheckClientAuthorization(ClientPtr <parameter>client</parameter>, AuthPtr <parameter>client_auth</parameter>,
938ce6676dbSmrg		int *<parameter>accept</parameter>, int *<parameter>index</parameter>, int *<parameter>size</parameter>, char **<parameter>authdata</parameter>)
939ce6676dbSmrg      </synopsis>
940ce6676dbSmrg
941ce6676dbSmrg      to see if the server is set to allow the client to connect. It
942ce6676dbSmrg      may use licensing or configuration information to determine if
943ce6676dbSmrg      the client can connect.
944ce6676dbSmrg    </para>
945ce6676dbSmrg
946ce6676dbSmrg    <para>When then connection is established, the server will use the
947ce6676dbSmrg
948ce6676dbSmrg      <synopsis>
949ce6676dbSmrgtypedef struct _alt_server {
950ce6676dbSmrg    char        subset;
951ce6676dbSmrg    char        namelen;
952ce6676dbSmrg    char       *name;
953ce6676dbSmrg}           AlternateServerRec, *AlternateServerPtr;
954ce6676dbSmrg
955ce6676dbSmrgint	ListAlternateServers(AlternateServerPtr *<parameter>servers</parameter>)
956ce6676dbSmrg      </synopsis>
957ce6676dbSmrg
958ce6676dbSmrg
959ce6676dbSmrg      to return any alternate server information it may have.
960ce6676dbSmrg    </para>
961ce6676dbSmrg    <para>When the client limit is reached, the font server may
962ce6676dbSmrg    attempt to copy itself, by calling
963ce6676dbSmrg
964ce6676dbSmrg    <synopsis>
965ce6676dbSmrgint	CloneMyself()
966ce6676dbSmrg    </synopsis>
967ce6676dbSmrg
968ce6676dbSmrg
969ce6676dbSmrg    This function will (if the configuration options allow)
970ce6676dbSmrg    start a new font server process. This is done in such a way
971ce6676dbSmrg    that no pending connections should be lost, and that the
972ce6676dbSmrg    original server will accept no new connections. Once the
973ce6676dbSmrg    original server has no more clients, it will exit.</para>
974ce6676dbSmrg
975ce6676dbSmrg    <sect2>
976ce6676dbSmrg      <title>Catalogue manipulation</title>
977ce6676dbSmrg
978ce6676dbSmrg    <para>Catalogues are configuration dependent, and hence sent by
979ce6676dbSmrg    OS-dependent methods. In order for the
980ce6676dbSmrg    <emphasis remap='I'>difs</emphasis> layer to get them, it
981ce6676dbSmrg    uses
982ce6676dbSmrg
983ce6676dbSmrg      <synopsis>
984ce6676dbSmrgint	ListCatalogues(char *<parameter>pattern</parameter>, int <parameter>pattern_length</parameter>,
985ce6676dbSmrg		       int <parameter>maxnames</parameter>, char **<parameter>catalogues</parameter>, int *<parameter>len</parameter>)
986ce6676dbSmrg      </synopsis>
987ce6676dbSmrg
988ce6676dbSmrg      which returns the list of all catalogues it supports which match
989ce6676dbSmrg      the pattern. This function will be used by the catalogue
990ce6676dbSmrg      manipulation requests, as well as by renderers when they give
991ce6676dbSmrg      their <systemitem>ListFonts</systemitem> results.
992ce6676dbSmrg    </para>
993ce6676dbSmrg
994ce6676dbSmrg    <para>
995ce6676dbSmrg      <synopsis>
996ce6676dbSmrgint ValidateCatalogues(int <parameter>number</parameter>, char *<parameter>catalogues</parameter>)
997ce6676dbSmrg      </synopsis>
998ce6676dbSmrg      Can be used to validate a list of catalogues, returning
999ce6676dbSmrg      <constant>True</constant> if the list is acceptable.</para>
1000ce6676dbSmrg   <indexterm startref='os_functions' class='endofrange' />
1001ce6676dbSmrg   </sect2>
1002ce6676dbSmrg  </sect1>
1003ce6676dbSmrg  <sect1 id='utility_functions'>
1004ce6676dbSmrg    <title>Utility functions</title>
1005ce6676dbSmrg    <sect2>
1006ce6676dbSmrg      <title>Client data functions</title>
1007ce6676dbSmrg
1008ce6676dbSmrg      <para>These provide access to the current client's resolution
1009ce6676dbSmrg      and authorization data. This form of interface is supplied
1010ce6676dbSmrg      rather than passing it to all renderers in the <emphasis
1011ce6676dbSmrg      remap='B'>FPE</emphasis> functions because the data may be
1012ce6676dbSmrg      complex and/or uninteresting to all renderers.</para>
1013ce6676dbSmrg
1014ce6676dbSmrg      <para><synopsis>
1015ce6676dbSmrgAuthContextPtr	GetClientAuthorization()
1016ce6676dbSmrg      </synopsis>
1017ce6676dbSmrg
1018ce6676dbSmrg      <indexterm><primary><structname>AuthContext</structname></primary></indexterm>
1019ce6676dbSmrg      Returns the authorization data for the current client.</para>
1020ce6676dbSmrg
1021ce6676dbSmrg      <para><synopsis>
1022ce6676dbSmrgfsResolution	*GetClientResolutions(int  *<parameter>num_resolutions</parameter>)
1023ce6676dbSmrg      </synopsis>
1024ce6676dbSmrg
1025ce6676dbSmrg
1026ce6676dbSmrg      Returns the list of resolutions that the current client has set.</para>
1027ce6676dbSmrg    </sect2>
1028ce6676dbSmrg    <sect2>
1029ce6676dbSmrg      <title>Caching functions</title>
1030ce6676dbSmrg
1031ce6676dbSmrg      <para>These are functions that simplify caching of renderer
1032ce6676dbSmrg      data. These are for use by renderers that take significant
1033ce6676dbSmrg      resources to produce data. The data must be re-creatable -- the
1034ce6676dbSmrg      cache is not meant for general storage. The data may also be
1035ce6676dbSmrg      moved by the cache, so it should only be accessed by
1036ce6676dbSmrg      CacheID.</para>
1037ce6676dbSmrg
1038ce6676dbSmrg      <para><synopsis>
1039ce6676dbSmrgtypedef void (*CacheFree)();
1040ce6676dbSmrgtypedef unsigned long	CacheID;
1041ce6676dbSmrgtypedef unsigned long	Cache;
1042ce6676dbSmrg
1043ce6676dbSmrgCache CacheInit(int <parameter>renderer_id</parameter>)
1044ce6676dbSmrg      </synopsis>
1045ce6676dbSmrg
1046ce6676dbSmrg
1047ce6676dbSmrg      Initializes a cache object for the renderer. the returned
1048ce6676dbSmrg      ID should be passed to <function>CacheStoreMemory()</function>
1049ce6676dbSmrg      when adding an object to the cache.</para>
1050ce6676dbSmrg
1051ce6676dbSmrg      <para><synopsis>
1052ce6676dbSmrgvoid CacheStats(Cache <parameter>cid</parameter>, unsigned long *<parameter>num_entries</parameter>,
1053ce6676dbSmrg	unsigned long *<parameter>max_storage</parameter>, unsigned long *<parameter>current_storage</parameter>,
1054ce6676dbSmrg	unsigned long *<parameter>num_lookups</parameter>, unsigned long *<parameter>hit_ratio</parameter>)
1055ce6676dbSmrg      </synopsis>
1056ce6676dbSmrg
1057ce6676dbSmrg
1058ce6676dbSmrg      Returns statistics on the cache. Useful if the renderer
1059ce6676dbSmrg      wants some hints about whether to place an object in the cache.
1060ce6676dbSmrg      If the cache is nearly full, and the priority low, it may want
1061ce6676dbSmrg      to take different action.</para>
1062ce6676dbSmrg
1063ce6676dbSmrg      <para><synopsis>
1064ce6676dbSmrgCacheID	CacheStoreMemory(Cache <parameter>cacheid</parameter>, pointer <parameter>data</parameter>, unsigned long <parameter>size</parameter>,
1065ce6676dbSmrg			CacheFree <parameter>free_func</parameter>)
1066ce6676dbSmrg      </synopsis>
1067ce6676dbSmrg
1068ce6676dbSmrg
1069ce6676dbSmrg      The renderer hands the cache some chunk of contiguous
1070ce6676dbSmrg      memory, which the cache timestamps and stores. When it needs to
1071ce6676dbSmrg      remove them, it calls the
1072ce6676dbSmrg      <parameter class="function">free_func</parameter>, which must
1073ce6676dbSmrg      take responsibility for properly freeing the data.
1074ce6676dbSmrg      <parameter class="function">size</parameter> is primarily a hint
1075ce6676dbSmrg      to the cache, so that cache limits can be properly calculated. A
1076ce6676dbSmrg      return value of zero means the store failed, probably because
1077ce6676dbSmrg      the given size was over the cache limit. If the given data is
1078ce6676dbSmrg      too large for the current cache, it will attempt to free old
1079ce6676dbSmrg      data to make room. The returned ID is a unique value that refers
1080ce6676dbSmrg      both to the object and the cache in which it was placed.</para>
1081ce6676dbSmrg
1082ce6676dbSmrg      <para><synopsis>
1083ce6676dbSmrgpointer CacheFetchMemory(CacheID <parameter>cid</parameter>, Bool <parameter>update</parameter>)
1084ce6676dbSmrg      </synopsis>
1085ce6676dbSmrg
1086ce6676dbSmrg
1087ce6676dbSmrg      Returns the memory attached to the id. If
1088ce6676dbSmrg      <parameter class="function">update</parameter> is set, the
1089ce6676dbSmrg      timestamp is updated. (Some accesses may wish to be 'silent',
1090ce6676dbSmrg      which allows some control over the freeing scheduling.) If the
1091ce6676dbSmrg      cid is invalid, <constant>NULL</constant> is returned.</para>
1092ce6676dbSmrg
1093ce6676dbSmrg      <para><synopsis>
1094ce6676dbSmrgpointer CacheFetchMemory(CacheID <parameter>cid</parameter>, Bool <parameter>update</parameter>)
1095ce6676dbSmrg      </synopsis>
1096ce6676dbSmrg
1097ce6676dbSmrg
1098ce6676dbSmrg      Allows the cache to flush the data. If
1099ce6676dbSmrg      <emphasis remap='I'>notify</emphasis> is set, the CacheFree
1100ce6676dbSmrg      function passed in when the data was cached will also be
1101ce6676dbSmrg      called.</para>
1102ce6676dbSmrg
1103ce6676dbSmrg      <para><synopsis>
1104ce6676dbSmrgvoid	MemoryFreed(CacheID <parameter>cid</parameter>, pointer <parameter>data</parameter>, int <parameter>reason</parameter>)
1105ce6676dbSmrg      </synopsis>
1106ce6676dbSmrg
1107ce6676dbSmrg
1108ce6676dbSmrg      Callback function from the cache to the renderer notifying
1109ce6676dbSmrg      it that its data has been flushed. This function then has the
1110ce6676dbSmrg      responsibility to free that data.
1111ce6676dbSmrg      <parameter class="function">reason</parameter> may be one of:
1112ce6676dbSmrg
1113ce6676dbSmrg      <synopsis>
1114ce6676dbSmrgCacheReset	/* all cache freed because of server reset */
1115ce6676dbSmrgCacheEntryFreed	/* explicit request via free_memory() */
1116ce6676dbSmrgCacheEntryOld	/* cache hit limit, and memory being freed because its old */
1117ce6676dbSmrg      </synopsis>
1118ce6676dbSmrg
1119ce6676dbSmrg
1120ce6676dbSmrg      and is supplied so that the renderer may choose how to
1121ce6676dbSmrg      deal with the free request. (It will probably be ignored by
1122ce6676dbSmrg      most, but some may want to keep the memory around by bypassing
1123ce6676dbSmrg      the cache, or re-inserting it.) Note that the cache will
1124ce6676dbSmrg      consider the data gone, so it <emphasis remap='B'>must</emphasis>
1125ce6676dbSmrg      be re-inserted to keep it alive.</para>
1126ce6676dbSmrg
1127ce6676dbSmrg      <para><synopsis>
1128ce6676dbSmrgvoid	CacheSimpleFree(CacheID <parameter>cid</parameter>, pointer <parameter>data</parameter>, int <parameter>reason</parameter>)
1129ce6676dbSmrg    </synopsis>
1130ce6676dbSmrg
1131ce6676dbSmrg
1132ce6676dbSmrg      Just calls <function>free()</function> on the data. Simple
1133ce6676dbSmrg      CacheFree defined here to prevent it being redefined in each
1134ce6676dbSmrg      renderer.</para>
1135ce6676dbSmrg
1136ce6676dbSmrg      <para>Typical usage of the cache is for the renderer to store a
1137ce6676dbSmrg      CacheID rather than a pointer to the cacheable data. The
1138ce6676dbSmrg      renderer is responsible for both allocating and freeing the
1139ce6676dbSmrg      data, as well as keeping track of just what it is. When the
1140ce6676dbSmrg      renderer needs the cached data, it will request it from the
1141ce6676dbSmrg      cache. If it fails, it must rebuild it.</para>
1142ce6676dbSmrg
1143ce6676dbSmrg      <para>A possible configuration parameter is the size of the
1144ce6676dbSmrg      cache. when the cache is filled (with the calculation based on
1145ce6676dbSmrg      the given size), it sweeps the cache and frees old data. The
1146ce6676dbSmrg      amount of memory actually freed may wish to be tunable: some
1147ce6676dbSmrg      systems may want to keep the cache as full as possible, others
1148ce6676dbSmrg      may want to free some percentage such that sweeps occur less
1149ce6676dbSmrg      frequently.</para>
1150ce6676dbSmrg
1151ce6676dbSmrg      <para>Cache statistics may want to be available for
1152ce6676dbSmrg      administrators. They could be dumped to a file when a signal is
1153ce6676dbSmrg      received. (SNMP seems like a perfect match, but apparently the
1154ce6676dbSmrg      technology isn't there yet.)</para>
1155ce6676dbSmrg
1156ce6676dbSmrg      <para>Cached data could also be compressed, if the memory/CPU
1157ce6676dbSmrg      tradeoffs make it worthwhile.</para>
1158ce6676dbSmrg
1159ce6676dbSmrg      <note><title>ISSUE: Is a time-based freeing schedule sufficient?</title>
1160ce6676dbSmrg	<para>Should priorities or size also be taken into account? [ No.
1161ce6676dbSmrg      Anything that the renderer thinks should have a higher priority
1162ce6676dbSmrg      should probably not be placed into the cache. ]</para></note>
1163ce6676dbSmrg
1164ce6676dbSmrg    </sect2>
1165ce6676dbSmrg    <sect2>
1166ce6676dbSmrg      <title>Byte swapping</title>
1167ce6676dbSmrg
1168ce6676dbSmrg      <para>Functions for swapping a 4-byte quantity, a 2-byte
1169ce6676dbSmrg      quantity and inverting a byte.</para>
1170ce6676dbSmrg
1171ce6676dbSmrg    <synopsis>
1172ce6676dbSmrgvoid	BitOrderInvert(pointer <parameter>buffer</parameter>, unsigned long <parameter>num_bytes</parameter>)
1173ce6676dbSmrgvoid	TwoByteSwap(pointer <parameter>buffer</parameter>, unsigned long <parameter>num_shorts</parameter>)
1174ce6676dbSmrgvoid	FourByteSwap(pointer <parameter>buffer</parameter>, unsigned long <parameter>num_longs</parameter>)
1175ce6676dbSmrg    </synopsis>
1176ce6676dbSmrg
1177ce6676dbSmrg
1178ce6676dbSmrg    </sect2>
1179ce6676dbSmrg    <sect2>
1180ce6676dbSmrg      <title>Bitmap padding</title>
1181ce6676dbSmrg
1182ce6676dbSmrg      <para>Functions taking a desired extents and a bitmap that will
1183ce6676dbSmrg      return the bitmap properly padded.</para>
1184ce6676dbSmrg
1185ce6676dbSmrg      <para><synopsis>
1186ce6676dbSmrgint	RepadBitmap(pointer <parameter>src</parameter>, pointer <parameter>dst</parameter>, fsFormat <parameter>src_format</parameter>,
1187ce6676dbSmrg		 fsFormat <parameter>dst_format</parameter>, int <parameter>width</parameter>, int <parameter>height</parameter>)
1188ce6676dbSmrg        </synopsis>
1189ce6676dbSmrg
1190ce6676dbSmrg      Takes a bitmap in <parameter class="function">src_format</parameter>
1191ce6676dbSmrg      and converts it to one in
1192ce6676dbSmrg      <parameter class="function">dst_format</parameter>.</para>
1193ce6676dbSmrg
1194ce6676dbSmrg    </sect2>
1195ce6676dbSmrg    <sect2>
1196ce6676dbSmrg      <title>Atoms</title>
1197ce6676dbSmrg
1198ce6676dbSmrg      <para>Existing bitmap-based renderers use atoms to store strings
1199ce6676dbSmrg      for property information. Rather than duplicate this code in
1200ce6676dbSmrg      each renderer, it lives in the
1201ce6676dbSmrg      <filename class="directory">util</filename> directory.</para>
1202ce6676dbSmrg
1203ce6676dbSmrg      <para>Atoms will be especially useful for property information,
1204ce6676dbSmrg      to prevent many copies of the same strings from being saved.
1205ce6676dbSmrg      Using atoms for comparison when modifying properties after
1206ce6676dbSmrg      scaling is also more efficient. Since
1207ce6676dbSmrg      <emphasis remap='I'>atoms</emphasis> will will exist until the
1208ce6676dbSmrg      server is reset, they may want to be used sparingly for property
1209ce6676dbSmrg      values to avoid extraneous string data.</para>
1210ce6676dbSmrg
1211ce6676dbSmrg      <para><synopsis>
1212ce6676dbSmrgtypedef unsigned long	Atom;
1213ce6676dbSmrg
1214ce6676dbSmrgAtom	MakeAtom(char *<parameter>string</parameter>, unsigned int <parameter>length</parameter>, Bool <parameter>create</parameter>)
1215ce6676dbSmrg      </synopsis>
1216ce6676dbSmrg
1217ce6676dbSmrg
1218ce6676dbSmrg        Returns the atom associated with
1219ce6676dbSmrg        <parameter class='function'>string</parameter>. If
1220ce6676dbSmrg        <parameter>create</parameter> is true, a new atom will be
1221ce6676dbSmrg        created.
1222ce6676dbSmrg      </para>
1223ce6676dbSmrg
1224ce6676dbSmrg      <para><synopsis>
1225ce6676dbSmrgchar	*NameForAtom(Atom atom)
1226ce6676dbSmrg      </synopsis>
1227ce6676dbSmrg
1228ce6676dbSmrg        Returns the string associated with
1229ce6676dbSmrg        <parameter class="function">atom</parameter>.
1230ce6676dbSmrg      </para>
1231ce6676dbSmrg    </sect2>
1232ce6676dbSmrg  </sect1>
1233ce6676dbSmrg  <sect1 id='server_request_details'>
1234ce6676dbSmrg    <title>Server request details</title>
1235ce6676dbSmrg    <para>This section describes in-depth the action of each
1236ce6676dbSmrg    protocol request. In all cases, the request is first error
1237ce6676dbSmrg    checked for simple length or value errors, with the server
1238ce6676dbSmrg    immediately returning an error if one is encountered.</para>
1239ce6676dbSmrg    <sect2 id='connection'>
1240ce6676dbSmrg      <title>Connection</title>
1241ce6676dbSmrg      <para>When a new client attempts to connect, the server first
1242ce6676dbSmrg      checks its initial authorization information to see if the
1243ce6676dbSmrg      server is willing to talk to it. This will be handled in some
1244ce6676dbSmrg      OS-specific form using <function>CheckClientAuthorization()</function>.
1245ce6676dbSmrg      If it passes this test, and the server has sufficient to
1246ce6676dbSmrg      resources to talk to it, the server sends accepts the
1247ce6676dbSmrg      connection and returns its connection block. If the
1248ce6676dbSmrg      connection fails, the server returns the proper status and a
1249ce6676dbSmrg      list of any alternate servers it may know of (gathered from
1250ce6676dbSmrg      <function>
1251ce6676dbSmrg      ListAlternateServers().)</function></para>
1252ce6676dbSmrg    </sect2>
1253ce6676dbSmrg    <sect2 id='listextension'>
1254ce6676dbSmrg      <title>ListExtension</title>
1255ce6676dbSmrg      <para>Returns the list of extensions the server knows about.
1256ce6676dbSmrg      Any extensions will be initialized when the server is first
1257ce6676dbSmrg      started.</para>
1258ce6676dbSmrg    </sect2>
1259ce6676dbSmrg    <sect2 id='queryextension'>
1260ce6676dbSmrg      <title>QueryExtension</title>
1261ce6676dbSmrg      <para>Returns the information about the requested extension,
1262ce6676dbSmrg      which was set when the extension was initialized.</para>
1263ce6676dbSmrg    </sect2>
1264ce6676dbSmrg    <sect2 id='listcatalogues'>
1265ce6676dbSmrg      <title>ListCatalogues</title>
1266ce6676dbSmrg      <para>Returns the catalogues the server recognizes (the
1267ce6676dbSmrg      results of <function>ListCatalogues()</function>.)</para>
1268ce6676dbSmrg    </sect2>
1269ce6676dbSmrg    <sect2 id='setcatalogues'>
1270ce6676dbSmrg      <title>SetCatalogues</title>
1271ce6676dbSmrg      <para>Sets the requesting client's catalogues after verifying
1272ce6676dbSmrg      them with the supported catalogues.</para>
1273ce6676dbSmrg    </sect2>
1274ce6676dbSmrg    <sect2 id='getcatalogues'>
1275ce6676dbSmrg      <title>GetCatalogues</title>
1276ce6676dbSmrg      <para>Returns the requesting client's catalogues.</para>
1277ce6676dbSmrg    </sect2>
1278ce6676dbSmrg    <sect2 id='createac'>
1279ce6676dbSmrg      <title>CreateAC</title>
1280ce6676dbSmrg      <para>Creates a new authorization context and fills it in.
1281ce6676dbSmrg      The list of authorization protocols is then checked by the
1282ce6676dbSmrg      server with
1283ce6676dbSmrg      <function>CheckClientAuthorization()</function>. If
1284ce6676dbSmrg      any are accepted, the
1285ce6676dbSmrg      <emphasis remap='B'>AC</emphasis> is placed in the resource
1286ce6676dbSmrg      database and <constant>Success</constant> is returned with the
1287ce6676dbSmrg      name of the accepted protocol. If more than one is accepted,
1288ce6676dbSmrg      <constant>Continue</constant> is returned with each
1289ce6676dbSmrg      of the accepted protocols, until the last one which has
1290ce6676dbSmrg      status <constant>Success</constant>. Otherwise
1291ce6676dbSmrg      <constant>Denied</constant> is returned.</para>
1292ce6676dbSmrg    </sect2>
1293ce6676dbSmrg    <sect2 id='freeac'>
1294ce6676dbSmrg      <title>FreeAC</title>
1295ce6676dbSmrg      <para>Looks up the
1296ce6676dbSmrg      <emphasis remap='B'>AC</emphasis> in the resource database,
1297ce6676dbSmrg      and frees it if it finds it. Otherwise an
1298ce6676dbSmrg      <errorname>Access</errorname> error is returned.</para>
1299ce6676dbSmrg    </sect2>
1300ce6676dbSmrg    <sect2 id='setauthorization'>
1301ce6676dbSmrg      <title>SetAuthorization</title>
1302ce6676dbSmrg     <indexterm><primary><structname>AuthContext</structname></primary></indexterm>
1303ce6676dbSmrg      <para>Looks up the
1304ce6676dbSmrg      <emphasis remap='B'>AC</emphasis> in the resource database,
1305ce6676dbSmrg      and set the client's AuthContextPtr to its value if it is
1306ce6676dbSmrg      found. Otherwise it sends an
1307ce6676dbSmrg      <errorname>Access</errorname> error.</para>
1308ce6676dbSmrg    </sect2>
1309ce6676dbSmrg    <sect2 id='setresolution'>
1310ce6676dbSmrg      <title>SetResolution</title>
1311ce6676dbSmrg      <para>Sets the requesting client's resolution list to the
1312ce6676dbSmrg      supplied list.</para>
1313ce6676dbSmrg    </sect2>
1314ce6676dbSmrg    <sect2 id='getresolution'>
1315ce6676dbSmrg      <title>GetResolution</title>
1316ce6676dbSmrg      <para>Returns the requesting client's list of resolutions.</para>
1317ce6676dbSmrg    </sect2>
1318ce6676dbSmrg    <sect2 id='listfonts'>
1319ce6676dbSmrg      <title>ListFonts</title>
1320ce6676dbSmrg      <para>Iterates over each open FPE, calling the FPE's
1321ce6676dbSmrg      <function>list_fonts()</function>routine passing it the
1322ce6676dbSmrg      pattern. When all FPE's have been processed, the list that
1323ce6676dbSmrg      has been built up is returned. Note that the same
1324ce6676dbSmrg      <structname>FontNamesPtr</structname> is sent to each
1325ce6676dbSmrg      FPE in turn, so that one list is built up. An FPE may
1326ce6676dbSmrg      restrict the fonts it returns based on the client's
1327ce6676dbSmrg      catalogue.</para>
1328ce6676dbSmrg    </sect2>
1329ce6676dbSmrg    <sect2 id='listfontswithxinfo'>
1330ce6676dbSmrg      <title>ListFontsWithXInfo</title>
1331ce6676dbSmrg      <para>Iterates over each FPE, calling its
1332ce6676dbSmrg      <function>start_list_fonts_with_info()</function>function to
1333ce6676dbSmrg      prime the FPE's renderer. It then calls the FPE's
1334ce6676dbSmrg      <function>list_next_font_with_info()</function>, sending each font's
1335ce6676dbSmrg      data to the client until no more fonts remain. When all FPEs
1336ce6676dbSmrg      have been processed, the final reply with a zero-length name
1337ce6676dbSmrg      is then sent to mark the end of the replies. An FPE may
1338ce6676dbSmrg      restrict the fonts it returns based on the client's
1339ce6676dbSmrg      catalogue. Note: an issue exists with font aliases which may
1340ce6676dbSmrg      require this to change, since an FPE may contain an alias
1341ce6676dbSmrg      pointing to another FPE, and cannot therefore return the
1342ce6676dbSmrg      font's info.</para>
1343ce6676dbSmrg    </sect2>
1344ce6676dbSmrg    <sect2 id='openbitmapfont'>
1345ce6676dbSmrg      <title>OpenBitmapFont</title>
1346ce6676dbSmrg      <para>The pattern is first searched for in the font server's
1347ce6676dbSmrg      name cache. If it doesn't find it, the server iterates over
1348ce6676dbSmrg      each FPE, calling its
1349ce6676dbSmrg      <function>open_font</function> function with the
1350ce6676dbSmrg      supplied pattern. This will return one of the following
1351ce6676dbSmrg      values:</para>
1352ce6676dbSmrg      <itemizedlist remap='IP'>
1353ce6676dbSmrg          <listitem>
1354ce6676dbSmrg            <para>an <errorname>Access</errorname> error, which means
1355ce6676dbSmrg            the renderer has the font but the client does not have
1356ce6676dbSmrg            access to it because of some form of licensing
1357ce6676dbSmrg            restriction</para>
1358ce6676dbSmrg          </listitem>
1359ce6676dbSmrg          <listitem>
1360ce6676dbSmrg            <para>a <errorname>Font</errorname> error and a NULL
1361ce6676dbSmrg            <emphasis remap='I'>alias</emphasis> parameter, which
1362ce6676dbSmrg            will cause the next FPE to be tried</para>
1363ce6676dbSmrg          </listitem>
1364ce6676dbSmrg          <listitem>
1365ce6676dbSmrg            <para>a <errorname>Font</errorname> error but a non-NULL
1366ce6676dbSmrg            <emphasis remap='I'>alias</emphasis>, which will cause
1367ce6676dbSmrg            the search to start over with the first FPE using
1368ce6676dbSmrg            <emphasis remap='I'>alias</emphasis> as the new font
1369ce6676dbSmrg            pattern</para>
1370ce6676dbSmrg          </listitem>
1371ce6676dbSmrg          <listitem>
1372ce6676dbSmrg            <para><errorname>Success</errorname>,
1373ce6676dbSmrg            in which case a valid font has been found.</para>
1374ce6676dbSmrg          </listitem>
1375ce6676dbSmrg      </itemizedlist>
1376ce6676dbSmrg
1377ce6676dbSmrg      <para>If the end of the FPE list is reached without having found
1378ce6676dbSmrg        the font, an error is returned to the client. If an
1379ce6676dbSmrg        <errorname>Access</errorname> error was encountered, it is
1380ce6676dbSmrg        returned, otherwise a <errorname>Font</errorname> error is
1381ce6676dbSmrg        returned.  If a valid font is found, its reference count will
1382ce6676dbSmrg        be incremented and it will be checked to see if the client has
1383ce6676dbSmrg        already opened it before. If so, the previous ID will be
1384ce6676dbSmrg        returned. Otherwise the font will be placed in the resource
1385ce6676dbSmrg        database.</para>
1386ce6676dbSmrg
1387ce6676dbSmrg      <para>The renderer will fill in the font's header and property
1388ce6676dbSmrg        information, and may also choose to load or create the font's
1389ce6676dbSmrg        metrics or glyphs. If the glyphs are built, they will use any
1390ce6676dbSmrg        supplied <emphasis remap='I'>format hint</emphasis>.</para>
1391ce6676dbSmrg
1392ce6676dbSmrg      <para>Whenever a new font is successfuly opened, the font and
1393ce6676dbSmrg        its name pattern will be placed in a name cache. This cache
1394ce6676dbSmrg        exists to minimize the amount of work spent searching for a
1395ce6676dbSmrg        font. It will be flushed when the font catalogue is
1396ce6676dbSmrg        modified. Client's with private font catalogues will require
1397ce6676dbSmrg        private name caches.</para>
1398ce6676dbSmrg
1399ce6676dbSmrg    </sect2>
1400ce6676dbSmrg    <sect2 id='queryxinfo'>
1401ce6676dbSmrg      <title>QueryXInfo</title>
1402ce6676dbSmrg      <para>The
1403ce6676dbSmrg      <emphasis remap='I'>fontid</emphasis> is looked up in the
1404ce6676dbSmrg      resource database, and the font's header and property info is
1405ce6676dbSmrg      returned.</para>
1406ce6676dbSmrg    </sect2>
1407ce6676dbSmrg    <sect2 id='queryxextents8_queryxextents16'>
1408ce6676dbSmrg      <title>QueryXExtents8 QueryXExtents16</title>
1409ce6676dbSmrg      <para>The
1410ce6676dbSmrg      <emphasis remap='I'>fontid</emphasis> is looked up in the
1411ce6676dbSmrg      resource database. The supplied list of characters
1412ce6676dbSmrg      (interpreted according to request type) is then translated
1413ce6676dbSmrg      into a list of ranges. The font's
1414ce6676dbSmrg      <function>get_extents()</function>function is then called. It
1415ce6676dbSmrg      builds the requested list of extents, and returns them along
1416ce6676dbSmrg      with the number of extents. The results are properly swapped
1417ce6676dbSmrg      and sent to the client.</para>
1418ce6676dbSmrg    </sect2>
1419ce6676dbSmrg    <sect2 id='queryxbitmaps8_queryxbitmaps16'>
1420ce6676dbSmrg      <title>QueryXBitmaps8 QueryXBitmaps16</title>
1421ce6676dbSmrg      <para>The
1422ce6676dbSmrg      <emphasis remap='I'>fontid</emphasis> is looked up in the
1423ce6676dbSmrg      resource database. The supplied list of characters
1424ce6676dbSmrg      (interpreted according to request type) is then translated
1425ce6676dbSmrg      into a list of ranges. The font's
1426ce6676dbSmrg      <function>get_bitmaps()</function>function is called, and the
1427ce6676dbSmrg      renderer will build up the requested bitmaps, using the
1428ce6676dbSmrg      specified
1429ce6676dbSmrg      <emphasis remap='I'>format</emphasis>, and returns the
1430ce6676dbSmrg      bitmaps, the number of glyphs and the offsets. The offsets
1431ce6676dbSmrg      are properly swapped and the offsets and bitmaps are sent to
1432ce6676dbSmrg      the clients.</para>
1433ce6676dbSmrg    </sect2>
1434ce6676dbSmrg    <sect2 id='closefont'>
1435ce6676dbSmrg      <title>CloseFont</title>
1436ce6676dbSmrg      <para>The font's reference count is decremented. If this was
1437ce6676dbSmrg      the last reference, the font's
1438ce6676dbSmrg      <function>unload_font()</function>function is called to free
1439ce6676dbSmrg      the renderer's data, and the font's FPE
1440ce6676dbSmrg      <function>close_font()</function>function is called to free
1441ce6676dbSmrg      up any FPE specific data.</para>
1442ce6676dbSmrg    </sect2>
1443ce6676dbSmrg  </sect1>
1444ce6676dbSmrg  <sect1 id='configuration'>
1445ce6676dbSmrg    <title>Configuration</title>
1446ce6676dbSmrg	<indexterm><primary>configuration file</primary></indexterm>
1447ce6676dbSmrg    <para>The configuration mechanism is a simple keyword-value
1448ce6676dbSmrg    pair, separated by an '<literal>=</literal>'.</para>
1449ce6676dbSmrg    <variablelist>
1450ce6676dbSmrg      <title>Configuration types:</title>
1451ce6676dbSmrg      <varlistentry>
1452ce6676dbSmrg	<term><type>cardinal</type></term>
1453ce6676dbSmrg	<listitem><para>non-negative number</para></listitem>
1454ce6676dbSmrg      </varlistentry>
1455ce6676dbSmrg      <varlistentry>
1456ce6676dbSmrg	<term><type>boolean</type></term>
1457ce6676dbSmrg	<listitem><para>"[Yy]es", "[Yy]" "on", "1", "[Nn]o", "[Nn]", "off", "0"</para></listitem>
1458ce6676dbSmrg      </varlistentry>
1459ce6676dbSmrg      <varlistentry>
1460ce6676dbSmrg	<term><type>resolution</type></term>
1461ce6676dbSmrg	<listitem><para><type>cardinal</type><literal>,</literal><type>cardinal</type></para></listitem>
1462ce6676dbSmrg      </varlistentry>
1463ce6676dbSmrg      <varlistentry>
1464ce6676dbSmrg	<term><type>list of foo</type></term>
1465ce6676dbSmrg	<listitem><para>1 or more of foo, separated by commas</para></listitem>
1466ce6676dbSmrg      </varlistentry>
1467ce6676dbSmrg    </variablelist>
1468ce6676dbSmrg    <variablelist>
1469ce6676dbSmrg      <title>Here is an incomplete list of the supported keywords:</title>
1470ce6676dbSmrg      <varlistentry>
1471ce6676dbSmrg	<term><literal>#</literal></term>
1472ce6676dbSmrg	<listitem><para>in the first column, a comment character</para></listitem>
1473ce6676dbSmrg      </varlistentry>
1474ce6676dbSmrg<!--
1475ce6676dbSmrg      <varlistentry>
1476ce6676dbSmrg	<term><literal>cache-size</literal> <type>(cardinal)</type></term>
1477ce6676dbSmrg	<listitem><para>Size in bytes of the FS cache.r</para></listitem>
1478ce6676dbSmrg      </varlistentry>
1479ce6676dbSmrg -->
1480ce6676dbSmrg      <varlistentry>
1481ce6676dbSmrg	<term><literal>catalogue</literal> <type>(list of string)</type></term>
1482ce6676dbSmrg	<listitem><para>Ordered list of font path element names.</para></listitem>
1483ce6676dbSmrg      </varlistentry>
1484ce6676dbSmrg      <varlistentry>
1485ce6676dbSmrg	<term><literal>alternate-servers</literal> <type>(list of string)</type></term>
1486ce6676dbSmrg	<listitem><para>List of alternate servers for this FS.</para></listitem>
1487ce6676dbSmrg      </varlistentry>
1488ce6676dbSmrg      <varlistentry>
1489ce6676dbSmrg	<term><literal>client-limit</literal> <type>(cardinal)</type></term>
1490ce6676dbSmrg	<listitem><para>Number of clients this FS will support before refusing
1491ce6676dbSmrg		service.</para></listitem>
1492ce6676dbSmrg      </varlistentry>
1493ce6676dbSmrg      <varlistentry>
1494ce6676dbSmrg	<term><literal>clone-self</literal> <type>(boolean)</type></term>
1495ce6676dbSmrg	<listitem><para>Whether this FS should attempt to clone itself or
1496ce6676dbSmrg		use delegates when it reachs the client-limit.</para></listitem>
1497ce6676dbSmrg      </varlistentry>
1498ce6676dbSmrg      <varlistentry>
1499ce6676dbSmrg	<term><literal>default-point-size</literal> <type>(cardinal)</type></term>
1500ce6676dbSmrg	<listitem><para>The default pointsize (in decipoints) for fonts that
1501ce6676dbSmrg		don't specify.</para></listitem>
1502ce6676dbSmrg      </varlistentry>
1503ce6676dbSmrg      <varlistentry>
1504ce6676dbSmrg	<term><literal>default-resolutions</literal> <type>(list of resolutions)</type></term>
1505ce6676dbSmrg	<listitem><para>Resolutions the server supports by default.
1506ce6676dbSmrg		This information may be used as a hint for pre-rendering.</para></listitem>
1507ce6676dbSmrg      </varlistentry>
1508ce6676dbSmrg      <varlistentry>
1509ce6676dbSmrg	<term><literal>error-file</literal> <type>(string)</type></term>
1510ce6676dbSmrg	<listitem><para>Filename of the error file.  All warnings and errors
1511ce6676dbSmrg		will be logged here. This information may be used as a hint
1512ce6676dbSmrg		for pre-rendering.</para></listitem>
1513ce6676dbSmrg      </varlistentry>
1514ce6676dbSmrg      <varlistentry>
1515ce6676dbSmrg	<term><literal>port</literal> <type>(cardinal)</type></term>
1516ce6676dbSmrg	<listitem><para>
1517ce6676dbSmrg		The TCP port on which the server will listen for connections.
1518ce6676dbSmrg	</para></listitem>
1519ce6676dbSmrg      </varlistentry>
1520ce6676dbSmrg      <varlistentry>
1521ce6676dbSmrg	<term><literal>use-syslog</literal> <type>(boolean)</type></term>
1522ce6676dbSmrg	<listitem><para>
1523ce6676dbSmrg		Whether syslog(3) is to be used for errors.
1524ce6676dbSmrg	</para></listitem>
1525ce6676dbSmrg      </varlistentry>
1526ce6676dbSmrg<!--
1527ce6676dbSmrg      <varlistentry>
1528ce6676dbSmrg	<term><literal>trusted-clients</literal> <type>(list of string)</type></term>
1529ce6676dbSmrg	<listitem><para>
1530ce6676dbSmrg		Those clients the fontserver will talk to.  Others
1531ce6676dbSmrg		will be refused for the initial connection.  An empty
1532ce6676dbSmrg		list means the server will talk to any client.
1533ce6676dbSmrg	</para></listitem>
1534ce6676dbSmrg      </varlistentry>
1535ce6676dbSmrg -->
1536ce6676dbSmrg    </variablelist>
1537ce6676dbSmrg    <para>Each renderer may also want private configuration
1538ce6676dbSmrg    options. The names should be prefixed by the renderer name, ie
1539ce6676dbSmrg    <literal>pcf-</literal>, <literal>atm-</literal>.</para>
1540ce6676dbSmrg    <example>
1541ce6676dbSmrg      <title>Sample Configuration Entries:</title>
1542ce6676dbSmrg      <programlisting>
1543ce6676dbSmrg# allow a ~a megabyte of memory to be reserved for cache data
1544ce6676dbSmrgcache-size = 1000000
1545ce6676dbSmrg
1546ce6676dbSmrgcatalogue = pcf:/usr/lib/X11/fonts/misc,speedo:/usr/lib/fonts/speedo
1547ce6676dbSmrg      </programlisting>
1548ce6676dbSmrg    </example>
1549ce6676dbSmrg  </sect1>
1550ce6676dbSmrg  <index/>
1551ce6676dbSmrg</article>
1552