STRING(3R)

NAME
string, FONTWIDTH, FONTHEIGHT, smallfont, mediumfont, largefont - draw string in bitmap

SYNOPSIS
#include <dmd.h>
#include <font.h>

Point string (ft, s, b, p, f)
Font *ft;
char *s;
Bitmap *b;
Point p;
Code f;

int FONTWIDTH (fnt)
int FONTHEIGHT (fnt)

Font fnt;

Font smallfont;
Font mediumfont;
Font largefont;

DESCRIPTION
The string function draws the null-terminated string s using characters from Font *ft in Bitmap *b at Point p with function Code f. The returned Point value is the location of the first character position following the string s. The returned Point can be passed to successive calls to string to concatenate strings.

The drawing of the characters is done such that the bounding rectangle of the maximum height character in the font would have its origin at p. Therefore, a character drawn on the screen at the point Drect.origin will occupy the upper-leftmost character position of the application's window.

The string function draws characters as they are in the font. No special action is taken for control characters such as tabs and newlines.

The globals smallfont, mediumfont, and largefont are the names of, not pointers to, the three resident fonts in the 630 MTG.

The FONTWIDTH macro returns the width of the space character in the given font. This is only useful if all the characters in the font have the same width. The FONTHEIGHT macro returns the height of the given font.

EXAMPLE
The following example demonstrates the use of string. The simple subroutine prints "hello world" using the resident font called largefont .

    #include <dmd.h>
    #include <font.h>
    Point add();
    Point string();
    hello_world()
    {
    	Font *f;
    	Point p;
    	f = &largefont;
    	p = add (Drect.origin, Pt(4,4));
    	string (f, "hello world", &display, p, F_XOR);
    }

SEE ALSO
loadfont(1), jstring(3R), structures(3R).