home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 August - Disc 2 / chip_20018102_hu.iso / linux / X-4.1.0 / doc / bdf.txt < prev    next >
Encoding:
Text File  |  2001-06-27  |  8.7 KB  |  529 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.          Bitmap Distribution Format
  10.  
  11.             Version 2.1
  12.  
  13.            X Consortium Standard
  14.  
  15.          X Version 11, Release 6.4
  16.  
  17.  
  18.  
  19. Copyright 1984, 1987, 1988 Adobe Systems, Inc.
  20.  
  21. Permission to use, copy, modify, and distribute this soft-
  22. ware and its documentation for any purpose and without fee
  23. is hereby granted, provided that the above copyright notice
  24. appear in all copies and that both that copyright notice and
  25. this permission notice appear in supporting documentation.
  26.  
  27.  
  28.  
  29.  
  30.  
  31. The Bitmap Distribution Format (BDF), Version 2.1, is an X
  32. Consortium standard for font interchange, intended to be
  33. easily understood by both humans and computers.
  34.  
  35. File Format
  36.  
  37. Character bitmap information will be distributed in an
  38. USASCII-encoded, human-readable form.  Each file is encoded
  39. in the printable characters (octal 40 through 176) of
  40. USASCII plus carriage return and linefeed.  Each file con-
  41. sists of a sequence of variable-length lines.  Each line is
  42. terminated either by a carriage return (octal 015) and line-
  43. feed (octal 012) or by just a linefeed.
  44.  
  45. The information about a particular family and face at one
  46. size and orientation will be contained in one file.  The
  47. file begins with information pertaining to the face as a
  48. whole, followed by the information and bitmaps for the indi-
  49. vidual characters.
  50.  
  51. A font bitmap description file has the following general
  52. form, where each item is contained on a separate line of
  53. text in the file.  Tokens on a line are separated by spaces.
  54. Keywords are in upper case, and must appear in upper case in
  55. the file.
  56.  
  57. 1.   The word STARTFONT followed by a version number indi-
  58.      cating the exact file format used.  The version
  59.      described here is 2.1.
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                  -2-
  71.  
  72.  
  73. 2.   Lines beginning with the word COMMENT may appear any-
  74.      where between the STARTFONT line and the ENDFONT line.
  75.      These lines are ignored by font compilers.
  76.  
  77. 3.   The word FONT followed by either the XLFD font name (as
  78.      specified in part III) or some private font name.    Cre-
  79.      ators of private font name syntaxes are encouraged to
  80.      register unique font name prefixes with the X Consor-
  81.      tium to prevent naming conflicts.    Note that the name
  82.      continues all the way to the end of the line and may
  83.      contain spaces.
  84.  
  85. 4.   The word SIZE followed by the point size of the charac-
  86.      ters, the x resolution, and the y resolution of the
  87.      device for which these characters were intended.
  88.  
  89. 5.   The word FONTBOUNDINGBOX followed by the width in x,
  90.      height in y, and the x and y displacement of the lower
  91.      left corner from the origin.  (See the examples in the
  92.      next section.)
  93.  
  94. 6.   Optionally, the word STARTPROPERTIES followed by the
  95.      number of properties (p) that follow.
  96.  
  97. 7.   Then come p lines consisting of a word for the property
  98.      name followed by either an integer or string surrounded
  99.      by double-quote (octal 042).  Internal double-quote
  100.      characters are indicated by using two in a row.
  101.  
  102.      Properties named FONT_ASCENT, FONT_DESCENT, and
  103.      DEFAULT_CHAR should be provided to define the logical
  104.      font-ascent and font-descent and the default-char for
  105.      the font.    These properties will be removed from the
  106.      actual font properties in the binary form produced by a
  107.      compiler.    If these properties are not provided, a com-
  108.      piler may reject the font or may compute (arbitrary)
  109.      values for these properties.
  110.  
  111. 8.   The property section, if it exists, is terminated by
  112.      ENDPROPERTIES.
  113.  
  114. 9.   The word CHARS followed by the number of character seg-
  115.      ments (c) that follow.
  116.  
  117. 10.  Then come c character segments of the form:
  118.  
  119.      a.   The word STARTCHAR followed by up to 14 characters
  120.       (no blanks) of descriptive name of the glyph.
  121.  
  122.      b.   The word ENCODING followed by one of the following
  123.       forms:
  124.  
  125.       i.   <n> - the glyph index, that is, a positive
  126.            integer representing the character code used
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                  -3-
  137.  
  138.  
  139.            to access the glyph in X requests, as defined
  140.            by the encoded character set given by the
  141.            CHARSET_REGISTRY-CHARSET_ENCODING font prop-
  142.            erties for XLFD conforming fonts.  If these
  143.            XLFD font properties are not defined, the
  144.            encoding scheme is font-dependent.
  145.  
  146.       ii.  -1 <n> - equivalent to form above.  This syn-
  147.            tax is provided for backward compatibility
  148.            with previous versions of this specification
  149.            and is not recommended for use with new
  150.            fonts.
  151.  
  152.       iii. -1 - an unencoded glyph.  Some font compilers
  153.            may discard unencoded glyphs, but, in gen-
  154.            eral, the glyph names may be used by font
  155.            compilers and X servers to implement dynamic
  156.            mapping of glyph repertoires to character
  157.            encodings as seen through the X protocol.
  158.  
  159.      c.   The word SWIDTH followed by the scalable width in
  160.       x and y of character.  Scalable widths are in
  161.       units of 1/1000th of the size of the character.
  162.       If the size of the character is p points, the
  163.       width information must be scaled by p/1000 to get
  164.       the width of the character in printer's points.
  165.       This width information should be considered as a
  166.       vector indicating the position of the next charac-
  167.       ter's origin relative to the origin of this char-
  168.       acter.  To convert the scalable width to the width
  169.       in device pixels, multiply SWIDTH times p/1000
  170.       times r/72, where r is the device resolution in
  171.       pixels per inch.  The result is a real number giv-
  172.       ing the ideal print width in device pixels.  The
  173.       actual device width must of course be an integral
  174.       number of device pixels and is given in the next
  175.       entry.  The SWIDTH y value should always be zero
  176.       for a standard X font.
  177.  
  178.      d.   The word DWIDTH followed by the width in x and y
  179.       of the character in device units.  Like the
  180.       SWIDTH, this width information is a vector indi-
  181.       cating the position of the next character's origin
  182.       relative to the origin of this character.  Note
  183.       that the DWIDTH of a given ``hand-tuned'' WYSIWYG
  184.       glyph may deviate slightly from its ideal device-
  185.       independent width given by SWIDTH in order to
  186.       improve its typographic characteristics on a dis-
  187.       play.  The DWIDTH y value should always be zero
  188.       for a standard X font.
  189.  
  190.      e.   The word BBX followed by the width in x (BBw),
  191.       height in y (BBh), and x and y displacement (BBox,
  192.       BBoy) of the lower left corner from the origin of
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                  -4-
  203.  
  204.  
  205.       the character.
  206.  
  207.      f.   The optional word ATTRIBUTES followed by the
  208.       attributes as 4 hex-encoded characters.  The
  209.       interpretation of these attributes is undefined in
  210.       this document.
  211.  
  212.      g.   The word BITMAP.
  213.  
  214.      h.   h lines of hex-encoded bitmap, padded on the right
  215.       with zeros to the nearest byte (that is, multiple
  216.       of 8).
  217.  
  218.      i.   The word ENDCHAR.
  219.  
  220. 11.  The file is terminated with the word ENDFONT.
  221.  
  222. Metric Information
  223.  
  224. Figures 1 and 2 best illustrate the bitmap format and char-
  225. acter metric information.
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                  -5-
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.       BBw = 9, BBh = 22, BBox = -2, BBoy = -6
  303.             DWIDTH = 8 0
  304.                SWIDTH = 355 0
  305.          ``+'' = character origin and width
  306.  
  307.         Figure 1: An example of a descender
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                  -6-
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.       BBh = 6, BBw = 4, BBox = +2, BBoy = +12
  369.             DWIDTH = 5 0
  370.                SWIDTH = 223 0
  371.  
  372. Figure 2: An example with the origin outside the bounding box
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                  -7-
  401.  
  402.  
  403. An Example File
  404.  
  405. The following is an abbreviated example of a bitmap file
  406. containing the specification of two characters (the j and
  407. quoteright in figures 1 and 2).
  408.  
  409.  
  410.      STARTFONT 2.1
  411.      COMMENT This is a sample font in 2.1 format.
  412.      FONT -Adobe-Helvetica-Bold-R-Normal--24-240-75-75-P-65-ISO8859-1
  413.      SIZE 24 75 75
  414.      FONTBOUNDINGBOX 9 24 -2 -6
  415.      STARTPROPERTIES 19
  416.      FOUNDRY "Adobe"
  417.      FAMILY "Helvetica"
  418.      WEIGHT_NAME "Bold"
  419.      SLANT "R"
  420.      SETWIDTH_NAME "Normal"
  421.      ADD_STYLE_NAME ""
  422.      PIXEL_SIZE 24
  423.      POINT_SIZE 240
  424.      RESOLUTION_X 75
  425.      RESOLUTION_Y 75
  426.      SPACING "P"
  427.      AVERAGE_WIDTH 65
  428.      CHARSET_REGISTRY "ISO8859"
  429.      CHARSET_ENCODING "1"
  430.      MIN_SPACE 4
  431.      FONT_ASCENT 21
  432.      FONT_DESCENT 7
  433.      COPYRIGHT "Copyright (c) 1987 Adobe Systems, Inc."
  434.      NOTICE "Helvetica is a registered trademark of Linotype Inc."
  435.      ENDPROPERTIES
  436.      CHARS 2
  437.      STARTCHAR j
  438.      ENCODING 106
  439.      SWIDTH 355 0
  440.      DWIDTH 8 0
  441.      BBX 9 22 -2 -6
  442.      BITMAP
  443.      0380
  444.      0380
  445.      0380
  446.      0380
  447.      0000
  448.      0700
  449.      0700
  450.      0700
  451.      0700
  452.      0E00
  453.      0E00
  454.      0E00
  455.      0E00
  456.      0E00
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                  -8-
  467.  
  468.  
  469.      1C00
  470.      1C00
  471.      1C00
  472.      1C00
  473.      3C00
  474.      7800
  475.      F000
  476.      E000
  477.      ENDCHAR
  478.      STARTCHAR quoteright
  479.      ENCODING 39
  480.      SWIDTH 223 0
  481.      DWIDTH 5 0
  482.      BBX 4 6 2 12
  483.      ATTRIBUTES 01C0
  484.      BITMAP
  485.      70
  486.      70
  487.      70
  488.      60
  489.      E0
  490.      C0
  491.      ENDCHAR
  492.      ENDFONT
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.