Text Routines.


VOGLE supports hardware and software fonts. The software fonts are based on the character set digitized by Dr Allen V. Hershey while working at the U. S. National Bureau of Standards. Exactly what hardware fonts are supported depends on the device, but it is guaranteed that the names "large" and "small" will result in something readable. For X11 displays the default large and small fonts used by the program can be overridden by placing the following defaults in the ~/.Xdefaults file:

  vogle.smallfont: X11-font-name
  vogle.largefont: X11-font-name

It is noted here that text is always assumed to be drawn parallel to the (x, y) plane, using whatever the current z coordinate is. The following software fonts are supported:

   astrology       cursive         cyrillic        futura.l
   futura.m        gothic.eng      gothic.ger      gothic.ita
   greek           markers         math.low        math.upp
   meteorology     music           script          symbolic
   times.g         times.i         times.ib        times.r
   times.rb        japanese

A markers font "markers" is also provided for doing markers - you need to have centertext mode on for this to give sensible results when placing the markers.

If the environment variable "VFONTLIB" is set VOGLE looks for the software fonts in the directory given by this value.

the default font is futura.l

text

font(fontname)

Set the current font

   Fortran:
        subroutine font(fontname)
        character*(*) fontname
   C:
        vogle_font(fontname)
             char *fontname

   Pascal:
        procedure Font(fontname: string_t)

WHEN ASK FOR NON-EXISTENT FONT, PROGRAM STOPS



numchars()

Return the number of characters in the current font. Applicable only to software fonts.

   Fortran:
        integer function numchars
   C:
        int vogle_numchars()

   Pascal:
        function NumChars: integer;

textsize(width, height)

Set the maximum size of a character in the current font. Width and height are values in world units. This only applies to software text. This must be done after the font being scaled is loaded. To keep text of different sizes aligned along the same baseline note that you typically need to subtrace the decender height from the Y position

   Fortran:
        subroutine textsize(width, height)
        real width, height
   C:
        vogle_textsize(width, height)
                    float     width, height;

   Pascal:
        procedure TextSize(width, height: real)
text

textang(ang)

Set the text angle. This angles strings and chars. This routine only affects software text. Angle is in degrees

   Fortran:
        subroutine textang(ang)
        real ang
   C:
        vogle_textang(ang)
             float     ang;

   Pascal:
        procedure TexTang(ang: real)
text

fixedwidth(onoff)

Turns fixedwidth text on or off. Non-zero (.true.) causes all text to be printed with a fixed width for each character. Otherwise, the text is spaced proportionally, where each character has a unique width less than or equal to the current fixed font width. This routine only affects software text.

The default at program initialization is fixedwidth(.false.)

   Fortran:
        subroutine fixedwidth(onoff)
        logical onoff
   C:
        vogle_fixedwidth(onoff)
             int onoff;

   Pascal:
        procedure FixedWidth(onoff: boolean)
text

centertext(onoff)

Turns centertext text on or off. Non-zero (.true.) is on. This centers strings and chars. This routine only affects software text.

   Fortran:
        subroutine centertext(onoff)
        logical onoff
   C:
        vogle_centertext(onoff)
             int onoff;

   Pascal:
        procedure CenterText(onoff: boolean)
text

getcharsize(c, width, height)

Get the width and height of a character. At the moment the height returned is always that of the difference between the maximum descender and ascender.

   Fortran:
        subroutine getcharsize(c, width, height)
        character*1 c
        real width, height
   C:
        vogle_getcharsize(c, width, height)
             char c;
             float     *width, *height;

   Pascal:
        procedure GetCharSize(c: char; var width, height: real)

getfontdec(dec)

Get the descender size of a character in a font.

   Fortran:
        real function getfontdec
   C:
        float
        vogle_getfontdec()

   Pascal:
        function NumChars: real;

getfontsize(width, height)

Get the maximum width and height of a character in a font.

   Fortran:
        subroutine getfontsize(width, height)
        real width, height
   C:
        vogle_getfontsize(width, height)
             float     *width, *height;

   Pascal:
        procedure GetFontSize(var width, height: real)

drawchar(c)

Draw the character c. The current graphics position represents the bottom left hand corner of the character space.

   Fortran:
        subroutine drawchar(c)
        character c
   C:
        vogle_drawchar(str)
             char c;

   Pascal:
        procedure DrawChar(c: char)

drawstr(str)

Draw the text in string at the current position.

   Fortran:
        subroutine drawstr(str)
        character*(*) str
   C:
        vogle_drawstr(str)
             char *str;
   Pascal:
        procedure DrawStr(str: string_t)

strlength(str)

Return the length of the string s in world units.

   Fortran:
        real function strlength(str)
        character*(*) str
   C:
        float
        vogle_strlength(char *str)

   Pascal:
        function StrLength(str: string_t): real;

boxtext(x, y, l, h, s)

Draw the string s so that it fits in the imaginary box defined with bottom left hand corner at (x, y), length l, and height h. This only applies to software text.

   Fortran:
        subroutine boxtext(x, y, l, h, s)
        real x, y, l, h, s
   C:
        vogle_boxtext(x, y, l, h, s)
             float     x, y, l, h, s;

   Pascal:
        procedure BoxText(x, y, l, h: real; s: string_t)
text

boxfit(l, h, nchars)

Set scale for text so that a string of the biggest characters in the font will fit in a box l by h. l and h are real values in world dimensions. This only applies to software text.

   Fortran:
        subroutine boxfit(l, h, nchars)
        real l, h
        integer nchars
   C:
        vogle_boxfit(l, h, nchars)
             float     l, h
             int  nchars

   Pascal:
        procedure BoxFit(l, h: real; nchars: integer)

textjustify(val)

General (direct) control of text justification. The value of val is made up of the logical OR of the following predefined constants in vogle.h (FOR C and Fortran only). V_LEFT, V_RIGHT, V_XCENTERED, V_TOP, V_BOTTOM, V_YCENTERED. Centering takes priority, as does RIGHT and TOP justification (if you were silly enough to set it to V_LEFT|V_RIGHT for example that is). A value of 0 (zero) (in all languages) resets the textjustification to the default.

   Fortran:
       subroutine textjustify(val)
       character(kind=c_short) :: ival
       character(kind=c_char)  :: val

       ! from Fortran, use IANY() to OR the array of options, and CHAR()
       ! to convert the integer result to a C_CHAR type. KIND C_CHAR is
       ! defined by loading a the intrinsic module for C bindings ("USE ISO_C_BINDING").
       ival=iany([V_XCENTERED,V_YCENTERED])
       val=char(ival)
       call textjustify(val)

   C:
       vogle_textjustify(val)
          char val;

   Pascal:
       procedure TextJustify(val: integer)
text

leftjustify()

Left justifies text. The text string will begin at the current position and extend to the notional right. Right justification and X centering are turned off.

    Fortran:
        subroutine leftjustify

    C:
        vogle_leftjustify()

    Pascal:
        procedure LeftJustify
text

rightjustify()

Right justifies text. The text string will begin at a point to the notional left of the current position and finish at the current position. Left justification and X centering are turned off.

   Fortran:
       subroutine rightjustify

   C:
       vogle_rightjustify()

   Pascal:
       procedure RightJustify
text

xcentertext()

Centers text in the X direction. The text string will begin at a point to the notional left of the current position and finish at a point to the right of the current position. Left justification and Right justification are turned off.

   Fortran:
       subroutine xcentertext

   C:
       vogle_xcentertext()

   Pascal:
       procedure XcenterText
text

topjustify()

Top justifies text. The text string will be drawn with it's upper edge aligned with the current Y position. Bottom justification and Y centering are turned off.

    Fortran:
        subroutine topjustify

    C:
        vogle_topjustify()

    Pascal:
        procedure TopJustify
text

bottomjustify()

Bottom justifies text. The text string will be drawn with it's lower edge aligned with the current Y position. Top justification and Y centering are turned off.

   Fortran:
       subroutine bottomjustify

   C:
       vogle_bottomjustify()

   Pascal:
       procedure BottomJustify
text

ycentertext()

Centers text in the Y direction. The text string be drawn will so that it's center line is aligned with the current y position. Top justification and Bottom justification are turned off.

   Fortran:
       subroutine ycentertext
   C:
       vogle_ycentertext()

   Pascal:
       procedure YcenterText
text

textslant()

Defines the obliqueness of the fonts. This is a simplistic method that allows you to generate italicized versions of the software fonts. The x- values of the software font coordinates after the current textsize() values are applied are multiplied by (1+val).

Note that this means the same value tilts the characters less the taller the characters are relative to their width.

Generally, practical values are generally between -1 and 1 times the

   Fortran:
       subroutine textslant(var)
       real var
   C:
       vogle_textslant(float var)

   Pascal:
       procedure TextSlant()


textweight()

Defines the weight of the fonts. Currently, the predefined constants in C and Fortran are V_NORMAL and V_BOLD; which correspond to 0 and 1. This is not the same as using linethickess to change the appearance of a software font. The font is redrawn multiple times with a slight offset to create the bold appearance.

   Fortran:
       subroutine textweight(ival)
       integer ival
   C:
       vogle_textweight(int ival)

   Pascal:
       procedure TextWeight(ival: integer)
text