home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / doc / fontserver / design.ms next >
Encoding:
Text File  |  1991-08-15  |  41.4 KB  |  1,499 lines

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