.\" Copyright (c) 2008 Hypertriton, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd July 25, 2008
.Dt VG_TEXT 3
.Os
.ds vT Agar API Reference
.ds oS Agar 1.3
.Sh NAME
.Nm VG_Text
.Nd agar-vg text entity
.Sh SYNOPSIS
.Bd -literal
#include
#include
#include
.Ed
.Sh DESCRIPTION
.Nm
is a
.Xr VG 3
node class which displays a text label.
The position and orientation of the label is described by two points.
.Sh INTERFACE
.nr nS 1
.Ft "VG_Text *"
.Fn VG_TextNew "VG_Node *parent" "VG_Point *p1" "VG_Point *p2"
.Pp
.Ft "void"
.Fn VG_TextPrintf "VG_Text *vg" "const char *fmt" "..."
.Pp
.Ft "void"
.Fn VG_TextPrintfPolled "VG_Text *vg" "const char *fmt" "..."
.Pp
.Ft "void"
.Fn VG_TextAlignment "VG_Text *vt" "enum vg_alignment alignment"
.Pp
.Ft "void"
.Fn VG_TextFontFace "VG_Text *vt" "const char *face"
.Pp
.Ft "void"
.Fn VG_TextFontSize "VG_Text *vt" "int points"
.Pp
.Ft "void"
.Fn VG_TextFontFlags "VG_Text *vt" "Uint flags"
.Pp
.Ft "void"
.Fn VG_TextSubstObject "VG_Text *vt" "AG_Object *obj"
.Pp
.nr nS 0
The
.Fn VG_TextNew
function creates a new text entity attached to
.Fa parent .
The text will be aligned with a line described by the points
.Fa p1
and
.Fa p2 .
.Pp
The
.Fn VG_TextPrintf
function sets the text to display.
.Fn VG_TextPolled
specifies a polled format string (see
.Xr AG_Label 3
for details ) .
.Pp
.Fn VG_TextAlignment
specifies the alignment of the text:
.Bd -literal
enum vg_alignment {
VG_ALIGN_TL, VG_ALIGN_TC, VG_ALIGN_TR,
VG_ALIGN_ML, VG_ALIGN_MC, VG_ALIGN_MR,
VG_ALIGN_BL, VG_ALIGN_BC, VG_ALIGN_BR
};
.Ed
.Pp
.Fn VG_TextFontFace
sets the font face to use in rendering the text (for example,
.Sq _agFontVera
which is built-in, or a filename).
See
.Xr AG_Text 3
for details.
.Pp
.Fn VG_TextFontSize
sets the size of the font in points.
.Fn VG_TextFontFlags
sets various text rendering options, as documented in
.Xr AG_Text 3 .
.Pp
The
.Fn VG_TextSubstObject
function enables run-time substitution of
.Xr AG_Variable 3
references in the text.
Before the text is rendered to the display, references of the form "$(foo)"
will be substituted for the contents of the variable
.Sq foo
of object
.Fa obj .
.Sh SEE ALSO
.Xr VG 3 ,
.Xr VG_Point 3
.Sh HISTORY
The
.Nm
class first appeared in Agar 1.3.3.