Content-type: text/html Manpage of PLOT_STRINGWIDTH

PLOT_STRINGWIDTH

Section:  (3)
Updated: 08 October 2002
Index Return to Main Contents
 

NAME

plot_stringwidth - determine how many pixels a string will take  

SYNOPSIS

 #include<libplot.h>
 unsigned int plot_stringwidth(plot_state *state, char *string);
 

DESCRIPTION

This function determines how many pixels a string will consume in the current font and size.  

RETURNS

0 on success, -1 otherwise  

EXAMPLE

#include<libplot.h> 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, &textx, &texty); if((textx + plot_stringwidth(graph, words[count])) > 380){ if(texty + 70 > 150) break; plot_settextlocation(graph, 20, texty + 20); } plot_writestring(graph, words[count]); plot_writestring(graph, " "); count++; }  

SEE ALSO

plot_addlinesegment.sgml plot_closeline.sgml plot_endline.sgml plot_getraster.sgml plot_newplot.sgml plot_rectangle.sgml plot_setfillcolor.sgml plot_setfontcolor.sgml plot_setfont.sgml plot_setlinecolor.sgml plot_setlinestart.sgml plot_settextlocation.sgml plot_stringwidth.sgml plot_strokeline.sgml plot_writestring.sgml  

VERSION

This documentation was generated for libplot 0.3 by autodocbook (http://www.stillhq.com).  

AUTHOR

libplot 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.  

BUGS

There are no known bugs in libplot. If you find one, please contact mikal@stillhq.com and let me know.


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURNS
EXAMPLE
SEE ALSO
VERSION
AUTHOR
BUGS

This document was created by man2html, using the manual pages.
Time: 00:51:44 GMT, October 08, 2002