|
|
1.1 root 1: .TH FONT 9.5
2: .CT 2 comm_term
3: .SH NAME
4: font \- jerq font layouts
5: .SH SYNOPSIS
6: .B #include <jerq.h>
7: .br
8: .B #include <font.h>
9: .PP
10: .B typedef struct Fontchar Fontchar;
11: .br
12: .B typedef struct Font Font;
13: .PP
14: .B extern Font defont;
15: .SH DESCRIPTION
16: A
17: .I Font
18: is a character set, stored as a single
19: Bitmap
20: with the characters
21: placed side-by-side.
22: It is described by the following data structures.
23: .IP
24: .EX
25: .ta +.5i +\w'unsigned char bottom; 'u
26: typedef struct Fontchar {
27: short x; /* left edge of bits */
28: unsigned char top; /* first non-zero scan-line */
29: unsigned char bottom; /* last non-zero scan-line */
30: char left; /* offset of baseline */
31: unsigned char width; /* width of baseline */
32: } Fontchar;
33: typedef struct Font {
34: short n; /* number of chars in font */
35: char height; /* height of bitmap */
36: char ascent; /* top of bitmap to baseline */
37: long unused;
38: Bitmap *bits; /* where the characters are */
39: Fontchar info[n+1]; /* n+1 character descriptors */
40: } Font;
41: .EE
42: .PP
43: Characters in
44: .L bits
45: abut exactly, so the displayed width of the character
46: .I c
47: is
48: .BI Font.info[ c +1].x\ -\ Font.info[ c ].x .
49: The first
50: .L left
51: columns of pixels in a character overlap the previous character.
52: The upper left corner of the nonempty columns appears at
53: .RB ( x, 0)
54: in the bitmap.
55: .L Width
56: is the distance to move horizontally after drawing a character.
57: The font bitmap has a fixed
58: .LR height ;
59: parameters
60: .L top
61: and
62: .L bottom
63: may speed up the copying of a character.
64: .PP
65: Characters are positioned by their upper left corners.
66: .PP
67: Fonts are stored on disk in binary with byte
68: order that of the terminal.
69: First in the file is the Font structure
70: with
71: .B bits
72: elided.
73: The data for the bitmap follows.
74: The header for the bitmap must be inferred from
75: .B Font.height
76: and
77: .BR Font.info[Font.n].x .
78: .SH EXAMPLES
79: .EX
80: Fontchar *i = f->info + c;
81: bitblt(f->bits, Rect(i->x, i->top, (i+1)->x, i->bottom),
82: &display, Pt(p.x+i->left, p.y+i->top), fc);
83: p.x += i->width;
84: .EE
85: .ns
86: .IP
87: Copy character
88: .I c
89: from font
90: .I f
91: to point
92: .I p
93: with Code
94: .B F_XOR
95: or
96: .BR F_OR .
97: .PP
98: For Code
99: .LR F_STORE ,
100: use
101: .LR "Rect(i->x, 0, (i+1)->x, f->height)" .
102: .SH SEE ALSO
103: .IR jf (9.1),
104: .IR string (9.3),
105: .IR getfont (9.1)
106: .SH BUGS
107: The
108: .L unused
109: field is used, by
110: .IR getfont (9.1).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.