font 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. .TH FONT 6
  2. .SH NAME
  3. font, subfont \- external format for fonts and subfonts
  4. .SH SYNOPSIS
  5. .B #include <libg.h>
  6. .SH DESCRIPTION
  7. Fonts and subfonts are described in
  8. .IR cachechars (2).
  9. .PP
  10. External fonts are described by a plain text file that can be read using
  11. .IR openfont .
  12. The format of the file is a header followed by any number of
  13. subfont range specifications.
  14. The header contains two numbers: the height and the ascent, both in pixels.
  15. The height is the inter-line spacing and the ascent is the distance
  16. from the top of the line to the baseline. These numbers are chosen
  17. to display consistently all the subfonts of the font.
  18. A subfont range specification contains two or three numbers and a file name.
  19. The numbers are the inclusive range of characters covered by the subfont,
  20. with an optional starting position within the subfont,
  21. and the file name names an external file suitable for
  22. .I readsubfont
  23. (see
  24. .IR graphics (2)).
  25. The minimum number of a covered range is mapped to the specified starting position
  26. (default zero) of the
  27. corresponding subfont.
  28. If the subfont file name does not begin with a slash, it is taken relative to the
  29. directory containing the font file.
  30. Each field must be followed by some white space.
  31. Each numeric field may be C-format decimal, octal, or hexadecimal.
  32. .PP
  33. External subfonts are represented in a more rigid format
  34. that can be read and written using
  35. .I readsubfont
  36. and
  37. .I writesubfont
  38. (see
  39. .IR subfont (2)).
  40. The format for subfont files is: an image containing character glyphs,
  41. followed by a subfont header, followed by character information.
  42. The image has the format for external image files described in
  43. .IR image (6).
  44. The subfont header has 3
  45. decimal strings:
  46. .BR n ,
  47. .BR height ,
  48. and
  49. .BR ascent .
  50. Each number is right-justified and blank padded in 11 characters, followed by a blank.
  51. The character
  52. .B info
  53. consists of
  54. .BR n +1
  55. 6-byte entries, each giving the
  56. .B Fontchar
  57. .B x
  58. (2 bytes, low order byte first),
  59. .BR top ,
  60. .BR bottom ,
  61. .BR left ,
  62. and
  63. .BR width .
  64. The
  65. .B x
  66. field of the last
  67. .B Fontchar
  68. is used to calculate the image width
  69. of the previous character; the other fields in the last
  70. .B Fontchar
  71. are irrelevant.
  72. .PP
  73. Note that the convention of using the character with value zero (NUL) to represent
  74. characters of zero width (see
  75. .IR draw (2))
  76. means that fonts should have, as their zeroth character,
  77. one with non-zero width.
  78. .SH FILES
  79. .TF /lib/font/bit/*
  80. .TP
  81. .B /lib/font/bit/*
  82. font directories
  83. .SH "SEE ALSO"
  84. .IR graphics (2),
  85. .IR draw (2),
  86. .IR cachechars (2),
  87. .IR subfont (2)