1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
/* This file contains the textangle method, which is a GNu extension to
libplot. Together with fontname() and fontsize(), it determines the
font used for text. In particular, it sets a drawing attribute: the
rotation angle, in counterclockwise degrees from the horizontal (in the
user frame), of labels subsequently drawn on the graphics device.
Textangle returns the size of the font, in user units. This may change
when the rotation angle is changed, since some fonts may not be
available at all rotation angles, so that a default font must be
switched to. */
#include "sys-defines.h"
#include "plot.h"
#include "extern.h"
int
#ifdef _HAVE_PROTOS
_m_textangle (int angle)
#else
_m_textangle (angle)
int angle;
#endif
{
if (!_plotter->open)
{
_plotter->error ("textangle: invalid operation");
return -1;
}
if (_plotter->outstream)
{
if (_plotter->portable_output)
fprintf (_plotter->outstream, "%c %d\n",
TEXTANGLE, angle);
else
{
putc (TEXTANGLE, _plotter->outstream);
_emit_integer (angle);
}
}
/* invoke generic method */
return _g_textangle (angle);
}
double
#ifdef _HAVE_PROTOS
_m_ftextangle (double angle)
#else
_m_ftextangle (angle)
double angle;
#endif
{
if (!_plotter->open)
{
_plotter->error ("ftextangle: invalid operation");
return -1;
}
if (_plotter->outstream == NULL)
return 0.0;
if (_plotter->portable_output)
fprintf (_plotter->outstream, "%c %g\n",
TEXTANGLE, angle);
else
{
putc (FTEXTANGLE, _plotter->outstream);
_emit_float (angle);
}
/* invoke generic method */
return _g_ftextangle (angle);
}
|