<!-- 

     This document is part of the libplot distribution, and is covered
     by the GNU GPL, a copy of which is in the file named COPYING inside the
     distribution.

     This program and it's documentation are distributed in the hope that 
     they will be useful,but WITHOUT ANY WARRANTY; without even the implied 
     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
-->

<!DOCTYPE refentry PUBLIC "-//Davenport//DTD DocBook V3.0//EN">

<refentry id="plot_writestring">
<refmeta>
<refentrytitle>plot_writestring</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>

<refnamediv>
<refname>plot_writestring</refname>
<refpurpose>write a string onto the bitmap</refpurpose>
</refnamediv>

<refsynopsisdiv>
<synopsis>
 #include&amp;lt;libmplot.h&amp;gt;
 int plot_writestring(plot_state *state, char *string);

</synopsis>
</refsynopsisdiv>

<refsect1>
<title>DESCRIPTION</title>
<para>This function writes a string onto the specified bitmap. Note that the function does not implement any form of word wrap. This is the responsibility of the caller of the function. Have a look at the example below for a suggested technique for implementing word wrap.</para>
</refsect1>

<refsect1>
<title>RETURNS</title>
<para>0 on success, -1 otherwise</para>
</refsect1>

<refsect1>
<title>EXAMPLE</title>
<programlisting>
 #include&amp;lt;libmplot.h&amp;gt;
 plot_state *graph;
 char *words[] = {"This", "is", "a", "string", "which", "is", "quite", "long.",
 "It", "demonstrates", "how", "to", "do", "word", "wrap", NULL};
 if((graph = plot_newplot(400, 300)) == NULL){
 ... error ...
 }
 plot_setfontcolor(graph, 26, 22, 249);
 plot_setfont(graph, "/usr/share/fonts/default/Type1/n021004l.pfb", 12);
 plot_settextlocation(graph, 20, 70);
 count = 0;
 while(words[count] != NULL){
 plot_gettextlocation(graph, &amp;amp;textx, &amp;amp;texty);
 if((textx + plot_stringwidth(graph, words[count])) &gt; 380){
 if(texty + 70 &gt; 150)
 break;
 plot_settextlocation(graph, 20, texty + 20);
 }
 plot_writestring(graph, words[count]);
 plot_writestring(graph, " ");
 count++;
 }
</programlisting>
</refsect1>


<refsect1>
    <title>VERSION</title>
    <para>
This documentation was generated for <command>libplot</command> 0.3 by <command>autodocbook</command> (http://www.stillhq.com).
    </para>
</refsect1>

<refsect1>
    <title>AUTHOR</title>
    <para>
<command>libplot</command> is under development by Michael Still (mikal@stillhq.com). All code is Copyright Michael Still 2002,  and is released under the GNU GPL. Code submissions are welcomed. Contact Michael at the address above if you have something you would like to contribute.
</para>
</refsect1>

<refsect1>
    <title>BUGS</title>
    <para>
There  are no known bugs in <command>libplot</command>. If you find one, please contact mikal@stillhq.com and let me know.
</para>
</refsect1>
</refentry>
