|
|
1.1 root 1: .ds ZZ DEVELOPMENT PACKAGE
2: .TH STRING 3R "630 MTG"
3: .XE "string()"
4: .XE "smallfont"
5: .XE "mediumfont"
6: .XE "largefont"
7: .XE "FONTWIDTH()"
8: .XE FONTHEIGHT()"
9: .SH NAME
10: string, FONTWIDTH, FONTHEIGHT, smallfont, mediumfont, largefont \- draw string in bitmap
11: .SH SYNOPSIS
12: \f3
13: #include <dmd.h>
14: .br
15: #include <font.h>
16: .sp
17: Point string (ft, s, b, p, f)
18: .br
19: Font \(**ft;
20: .br
21: char \(**s;
22: .br
23: Bitmap \(**b;
24: .br
25: Point p;
26: .br
27: Code f;
28: .sp
29: int FONTWIDTH (fnt)
30: .br
31: int FONTHEIGHT (fnt)
32: .sp
33: Font fnt;
34: .sp
35: Font smallfont;
36: .br
37: Font mediumfont;
38: .br
39: Font largefont;
40: \f1
41: .SH DESCRIPTION
42: The
43: .I string
44: function
45: draws the null-terminated string
46: .I s
47: using characters from Font
48: .I \(**ft
49: in Bitmap
50: .I \(**b
51: at Point
52: .I p
53: with function Code
54: .IR f .
55: The returned Point value is the location of the first character position
56: following the string
57: .IR s .
58: The returned Point can be passed to successive calls to
59: .I string
60: to concatenate strings.
61: .PP
62: The drawing of the characters is done such that the bounding rectangle
63: of the maximum height character in the font would have its origin at
64: .IR p .
65: Therefore, a character drawn on the screen at the point
66: .I Drect.origin
67: will occupy the upper-leftmost character position of the application's
68: window.
69: .PP
70: The
71: .I string
72: function
73: draws characters as they are in the font.
74: No special action is taken for control characters such as tabs and newlines.
75: .PP
76: The globals
77: .IR smallfont ,
78: .IR mediumfont ,
79: and
80: .IR largefont
81: are the names of, not pointers to, the three resident fonts in the 630
82: MTG.
83: .P
84: The
85: .I FONTWIDTH
86: macro returns the width of the space character in the given
87: font. This is only useful if all
88: the characters in the font have the same width.
89: The
90: .I FONTHEIGHT
91: macro returns the height of the given font.
92: .bp
93: .SH EXAMPLE
94: The following example demonstrates the use of
95: .I string.
96: The simple subroutine prints "hello world" using the resident font
97: called
98: .I largefont .
99: .PP
100: .RS 3
101: .nf
102: .ft CM
103: #include <dmd.h>
104: #include <font.h>
105:
106: Point add();
107: Point string();
108:
109: hello_world()
110: {
111: Font *f;
112: Point p;
113:
114: f = &largefont;
115: p = add (Drect.origin, Pt(4,4));
116: string (f, "hello world", &display, p, F_XOR);
117: }
118: \fR
119: .fi
120: .RE
121: .SH SEE ALSO
122: loadfont(1), jstring(3R), structures(3R).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.