1
/* This file is part of the GNU plotutils package. Copyright (C) 1995,
2
1996, 1997, 1998, 1999, 2000, 2005, Free Software Foundation, Inc.
4
The GNU plotutils package is free software. You may redistribute it
5
and/or modify it under the terms of the GNU General Public License as
6
published by the Free Software foundation; either version 2, or (at your
7
option) any later version.
9
The GNU plotutils package is distributed in the hope that it will be
10
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
General Public License for more details.
14
You should have received a copy of the GNU General Public License along
15
with the GNU plotutils package; see the file COPYING. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin St., Fifth Floor,
17
Boston, MA 02110-1301, USA. */
1
19
/* This file contains the fontname, fontsize, and textangle methods, which
2
20
are a GNU extension to libplot. They set drawing attributes: the name
3
21
of the font used for text subsequent drawn on the graphics device, the
44
56
if ((s == NULL) || (*s == '\0') || !strcmp(s, "(null)"))
45
57
switch (_plotter->data->default_font_type)
49
s = DEFAULT_HERSHEY_FONT;
52
s = DEFAULT_POSTSCRIPT_FONT;
58
s = DEFAULT_STICK_FONT;
61
s = PL_DEFAULT_HERSHEY_FONT;
64
s = PL_DEFAULT_POSTSCRIPT_FONT;
67
s = PL_DEFAULT_PCL_FONT;
70
s = PL_DEFAULT_STICK_FONT;
62
74
/* save new font name */
63
75
free ((char *)_plotter->drawstate->font_name);
64
font_name = (char *)_plot_xmalloc (strlen (s) + 1);
76
font_name = (char *)_pl_xmalloc (strlen (s) + 1);
65
77
strcpy (font_name, s);
66
78
_plotter->drawstate->font_name = font_name;
68
80
/* retrieve font and metrics; compute `true' font size (may differ) */
69
_set_font (S___(_plotter));
81
_pl_g_set_font (S___(_plotter));
71
83
/* return value is size in user units */
72
84
return _plotter->drawstate->true_font_size;
77
88
_API_ffontsize (R___(Plotter *_plotter) double size)
79
_API_ffontsize (R___(_plotter) size)
80
S___(Plotter *_plotter;)
84
90
if (!_plotter->data->open)
100
106
_plotter->drawstate->font_size = size;
102
108
/* retrieve font and metrics; compute `true' font size (may differ) */
103
_set_font (S___(_plotter));
109
_pl_g_set_font (S___(_plotter));
105
111
/* flag fontsize as having been invoked (so that fsetmatrix will no
106
112
longer automatically adjust the font size to a reasonable value) */
130
130
_plotter->drawstate->text_rotation = angle;
132
132
/* retrieve font and metrics; compute `true' font size (may differ) */
133
_set_font (S___(_plotter));
133
_pl_g_set_font (S___(_plotter));
135
135
/* return quantized user-specified font size */
136
136
return _plotter->drawstate->true_font_size;
144
144
These should be replaced by a properly crafted API for querying font
145
145
names, font metrics, etc. */
149
pl_get_hershey_font_info (S___(Plotter *_plotter))
151
pl_get_hershey_font_info (S___(_plotter))
152
S___(Plotter *_plotter;)
155
return (voidptr_t)_hershey_font_info;
160
pl_get_ps_font_info (S___(Plotter *_plotter))
162
pl_get_ps_font_info (S___(_plotter))
163
S___(Plotter *_plotter;)
166
return (voidptr_t)_ps_font_info;
171
pl_get_pcl_font_info (S___(Plotter *_plotter))
173
pl_get_pcl_font_info (S___(_plotter))
174
S___(Plotter *_plotter;)
177
return (voidptr_t)_pcl_font_info;
182
pl_get_stick_font_info (S___(Plotter *_plotter))
184
pl_get_stick_font_info (S___(_plotter))
185
S___(Plotter *_plotter;)
188
return (voidptr_t)_stick_font_info;
148
_pl_get_hershey_font_info (S___(Plotter *_plotter))
150
return (void *)_pl_g_hershey_font_info;
154
_pl_get_ps_font_info (S___(Plotter *_plotter))
156
return (void *)_pl_g_ps_font_info;
160
_pl_get_pcl_font_info (S___(Plotter *_plotter))
162
return (void *)_pl_g_pcl_font_info;
166
_pl_get_stick_font_info (S___(Plotter *_plotter))
168
return (void *)_pl_g_stick_font_info;