home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 August - Disc 2 / chip_20018102_hu.iso / linux / X-4.1.0 / doc / xfs-design.TXT < prev    next >
Encoding:
Text File  |  2001-06-27  |  41.1 KB  |  1,783 lines

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