202 Introduction to C++ Programming and Graphics
color(BLACK);
font("/tmp/hfonts/times.ib");
textsize(0.4,0.4);
//--- Draw a string:
drawstr("Hello");
//--- Press key to finish:
getkey();
vexit();
return 0;
}
The code features the following new implementations:
- Themove2function moves the pen to a point specified by the coordinates.
By default, the horizontal and vertical coordinatesxandyvary from -1
to 1. - The text color and font are selected, the text size is defined, and a string
of characters is drawn using thetextstrVoglefunction. The font files
are located in the/tmp/hfontsdirectory.
Fonts
The hfontdirectory containing the fonts should be copied from the
directory07/VOGLEof the software distribution accompanying this book to
the/tmpdirectory of the operating system. Because all users have “read” and
“write” permissions for this directory, they do not have to buy gifts for the
system administrator. However, because this directory is routinely cleaned, the
font directory must be periodically recopied.
The menu of available fonts includes the following:
astrology futura.m greek math.upp symbolic times.r
cursive gothic.eng japanese meteorology times.g times.rb
cyrillic gothic.ger markers music times.i
futura.l gothic.ita math.low script times.ib
The suffixistands for italic,bstands for bold,rstands for roman, andlstands
for low.