FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

document preference for set term ... font "<name>,<size>" · gnuplot/gnuplot-old@160b201 · GitHub

Repository navigation

Commit 160b201

Browse files
sfeam
committed
document preference for set term ... font "<name>,<size>"
1 parent 0537e33 commit 160b201

5 files changed

Lines changed: 59 additions & 21 deletions

File tree

‎ChangeLog‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2011-09-27 Ethan A Merritt <merritt@u.washington.edu>
2+
3+
* term/emf.trm term/fig.trm term/tgif.trm: Prefer the new syntax
4+
set term ... font "<name>,<size>" in the documentation. This does not
5+
change the terminal input, only the docs and the options string echoed
6+
back by "show term".
7+
8+
* term/canvas.trm: Implement set term canvas ... font "<name>,<size>".
9+
Currently the name is ignored.
10+
111
2011-09-23 Ethan A Merritt <merritt@u.washington.edu>
212

313
* docs/gnuplot.doc src/plot2d.c: Defer interpretation of newhistogram

‎term/canvas.trm‎

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Hello, Emacs, this is -*-C-*-
2-
* $Id: canvas.trm,v 1.53 2011/09/06 03:17:42 sfeam Exp $
2+
* $Id: canvas.trm,v 1.54 2011/09/27 23:18:02 sfeam Exp $
33
*
44
*/
55

@@ -102,6 +102,7 @@ static double canvas_dashlength_factor = 1.0;
102102
static double CANVAS_ps = 1; /* pointsize multiplier */
103103
static double canvas_font_size = 10;
104104
static double canvas_fontscale = 1.0;
105+
static char * canvas_font_name = NULL;
105106
static char *canvas_justify = "";
106107
static int canvas_text_angle = 0;
107108
static int canvas_in_a_path = FALSE;
@@ -136,14 +137,16 @@ static struct {
136137
} canvas_state;
137138

138139
enum CANVAS_case {
139-
CANVAS_SIZE, CANVAS_FSIZE, CANVAS_NAME, CANVAS_STANDALONE, CANVAS_TITLE,
140+
CANVAS_SIZE, CANVAS_FONT, CANVAS_FSIZE,
141+
CANVAS_NAME, CANVAS_STANDALONE, CANVAS_TITLE,
140142
CANVAS_LINEWIDTH, CANVAS_MOUSING, CANVAS_JSDIR, CANVAS_ENH, CANVAS_NOENH,
141143
CANVAS_FONTSCALE, CANVAS_SOLID, CANVAS_DASHED, CANVAS_DASHLENGTH,
142144
CANVAS_ROUNDED, CANVAS_BUTT, CANVAS_BACKGROUND, CANVAS_OTHER
143145
};
144146

145147
static struct gen_table CANVAS_opts[] =
146148
{
149+
{ "font", CANVAS_FONT },
147150
{ "fsize", CANVAS_FSIZE },
148151
{ "name", CANVAS_NAME },
149152
{ "size", CANVAS_SIZE },
@@ -194,6 +197,7 @@ TERM_PUBLIC void
194197
CANVAS_options()
195198
{
196199
int canvas_background = 0;
200+
int sep;
197201

198202
/* (c_token == 2) only in the case of 'set termoption' */
199203
/* which is after we have already initialized everything. */
@@ -256,6 +260,27 @@ CANVAS_options()
256260
CANVAS_standalone = TRUE;
257261
break;
258262

263+
case CANVAS_FONT:
264+
/* FIXME: The HTML5 canvas element did not originally provide any */
265+
/* support for text output, let alone fonts.There are now text routines */
266+
/* in the HTML5 draft spec, but they are not yet widely supported. */
267+
/* So for now we will accept a font request, but ignore it. */
268+
/* Eventually the text calls will look something like */
269+
/* ctx.font = "12pt Times"; */
270+
/* ctx.textAlign = "center"; */
271+
/* ctx.fillText( "Oh goody, text support.", x, y ); */
272+
/* */
273+
free(canvas_font_name);
274+
if (!(canvas_font_name = try_to_get_string()))
275+
int_error(c_token,"font: expecting string");
276+
sep = strcspn(canvas_font_name,",");
277+
if (canvas_font_name[sep] == ',') {
278+
sscanf(&(canvas_font_name[sep+1]), "%lf", &canvas_font_size);
279+
if (canvas_font_size <= 0)
280+
canvas_font_size = 10;
281+
}
282+
break;
283+
259284
case CANVAS_FSIZE:
260285
canvas_font_size = real_expression();
261286
if (canvas_font_size <= 0)
@@ -1407,7 +1432,7 @@ START_HELP(canvas)
14071432
" HTML5 canvas element.",
14081433
" Syntax:",
14091434
" set terminal canvas {size <xsize>, <ysize>} {background <rgb_color>}",
1410-
" {fsize <fontsize>}",
1435+
" {font {<fontname>}{,<fontsize>}} | {fsize <fontsize>}",
14111436
" {{no}enhanced} {linewidth <lw>}",
14121437
" {rounded | butt}",
14131438
" {solid | dashed {dashlength <dl>}}",
@@ -1417,10 +1442,14 @@ START_HELP(canvas)
14171442
"",
14181443
" where <xsize> and <ysize> set the size of the plot area in pixels.",
14191444
" The default size in standalone mode is 600 by 400 pixels.",
1420-
" The default font size is 10. NB: Only one font is available, the ascii",
1421-
" portion of Hershey simplex Roman provided in the file canvastext.js.",
1422-
" You can replace this with the file canvasmath.js, which contains also",
1423-
" UTF-8 encoded Hershey simplex Greek and math symbols.",
1445+
" The default font size is 10.",
1446+
"",
1447+
" NB: Only one font is available, the ascii portion of Hershey simplex Roman",
1448+
" provided in the file canvastext.js. You can replace this with the file",
1449+
" canvasmath.js, which contains also UTF-8 encoded Hershey simplex Greek and",
1450+
" math symbols. For consistency with other terminals, it is also possible to",
1451+
" use `font \"name,size\"`. Currently the font `name` is ignored, but browser",
1452+
" support for named fonts is likely to arrive eventually.",
14241453
"",
14251454
" The default `standalone` mode creates an html page containing javascript",
14261455
" code that renders the plot using the HTML 5 canvas element. The html page",

‎term/emf.trm‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Hey Emacs this is -*- C -*-
2-
* $Id: emf.trm,v 1.76 2011/09/01 03:45:32 sfeam Exp $
2+
* $Id: emf.trm,v 1.77 2011/09/27 23:18:02 sfeam Exp $
33
*/
44

55
/* GNUPLOT - emf.trm */
@@ -748,7 +748,7 @@ EMF_options()
748748

749749
emf_colors = emf_monochrome ? 1 : EMF_COLORS;
750750

751-
sprintf(term_options, "%s %s %s \"%s\" %g",
751+
sprintf(term_options, "%s %s %s font \"%s,%g\"",
752752
emf_monochrome ? "monochrome" : "color",
753753
emf_dashed ? "dashed" : "solid",
754754
emf_pentype ? "butt" : "rounded",
@@ -1785,8 +1785,7 @@ START_HELP(emf)
17851785
" {rounded | butt}",
17861786
" {linewidth <LW>} {dashlength <DL>}",
17871787
" {size XX,YY} {background <rgb_color>}",
1788-
" {\"<fontname>\"} {<fontsize>} #old syntax",
1789-
" {font \"<fontname>,<fontsize>\"} #new syntax",
1788+
" {font \"<fontname>{,<fontsize>}\"}",
17901789
" {fontscale <scale>}",
17911790
"",
17921791
" In `monochrome` mode successive line types cycle through dash patterns.",
@@ -1809,7 +1808,7 @@ START_HELP(emf)
18091808
" Selecting `default` sets all options to their default values.",
18101809
"",
18111810
" Examples:",
1812-
" set terminal emf 'Times Roman Italic' 12",
1811+
" set terminal emf 'Times Roman Italic, 12'",
18131812
" set terminal emf color solid # no pesky dashes!"
18141813
END_HELP(emf)
18151814
#endif /* TERM_HELP */

‎term/fig.trm‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Hello, Emacs, this is -*-C-*-
2-
* $Id: fig.trm,v 1.67 2009/03/26 00:49:20 sfeam Exp $
2+
* $Id: fig.trm,v 1.68 2011/09/27 23:18:02 sfeam Exp $
33
*/
44

55
/* GNUPLOT - fig.trm */
@@ -505,7 +505,7 @@ FIG_options()
505505
);
506506
}
507507

508-
sprintf(term_options, "%s %s %s %d %s %s %s%s %s \"%s\" %s %d %s %d %s %d %s %s",
508+
sprintf(term_options, "%s %s %s %d %s %s %s%s %s \"%s,%d\" %s %d %s %d %s %s",
509509
FIG_use_color ? "color" : "monochrome",
510510
FIG_is_big ? "big" : "small",
511511
"pointsmax",
@@ -515,7 +515,7 @@ FIG_options()
515515
FIG_solid ? "solid" : "dashed",
516516
text_flags,
517517
"font", FIG_fonts[FIG_font_id].key,
518-
"fontsize", (FIG_font_s > 0 ? FIG_font_s :
518+
/* fontsize */ (FIG_font_s > 0 ? FIG_font_s :
519519
(FIG_is_big ? BFIG_FONT_S : FIG_FONT_S)),
520520
"linewidth", FIG_default_thickness, "depth", FIG_depth,
521521
"version", FIG_version ); /* JFS, KB, ULIG */
@@ -1307,7 +1307,7 @@ START_HELP(fig)
13071307
" {metric | inches}",
13081308
" {pointsmax <max_points>}",
13091309
" {solid | dashed}",
1310-
" {font <fontname>} {fontsize <fsize>}",
1310+
" {font \"<fontname>{,<fontsize>}\"}",
13111311
" {textnormal | {textspecial texthidden textrigid}}",
13121312
" {{thickness|linewidth} <units>}",
13131313
" {depth <layer>}",

‎term/tgif.trm‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Hello, Emacs, this is -*-C-*- */
2-
/* $Id: tgif.trm,v 1.49 2010/03/24 18:22:37 sfeam Exp $ */
2+
/* $Id: tgif.trm,v 1.50 2011/09/27 23:18:02 sfeam Exp $ */
33

44
/* GNUPLOT - tgif.trm */
55

@@ -433,7 +433,7 @@ TGIF_options()
433433
strcat(term_options, TgifUseColor ? " color" : " monochrome");
434434
sprintf(&(term_options[strlen(term_options)]), " linewidth %f",
435435
dActThick_default);
436-
sprintf(&(term_options[strlen(term_options)]), " %s \"%s\" %u",
436+
sprintf(&(term_options[strlen(term_options)]), " %s font \"%s,%u\"",
437437
TgifSolid ? "solid" : "dashed",
438438
sActFont, uActFontSize);
439439
}
@@ -1733,14 +1733,14 @@ START_HELP(tgif)
17331733
" {monochrome | color}",
17341734
" {{linewidth | lw} <LW>}",
17351735
" {solid | dashed}",
1736-
" {font \"<fontname>\"} {<fontsize>}",
1736+
" {font \"<fontname>{,<fontsize>}\"}",
17371737
"",
17381738
" where <[x,y]> specifies the number of graphs in the x and y directions on the",
17391739
" page, `color` enables color, `linewidth` scales all linewidths by <LW>,",
17401740
" \"<fontname>\" is the name of a valid PostScript font, and <fontsize>",
17411741
" specifies the size of the PostScript font.",
17421742
" `defaults` sets all options to their defaults: `portrait`, `[1,1]`, `color`,",
1743-
" `linwidth 1.0`, `dashed`, `\"Helvetica\"`, and `18`.",
1743+
" `linwidth 1.0`, `dashed`, `\"Helvetica,18\"`.",
17441744
"",
17451745
" The `solid` option is usually prefered if lines are colored, as they often",
17461746
" are in the editor. Hardcopy will be black-and-white, so `dashed` should be",
@@ -1773,7 +1773,7 @@ START_HELP(tgif)
17731773
"",
17741774
" Examples of single plots (or standard multiplot):",
17751775
" set terminal tgif # defaults",
1776-
" set terminal tgif \"Times-Roman\" 24",
1776+
" set terminal tgif \"Times-Roman,24\"",
17771777
" set terminal tgif landscape",
17781778
" set terminal tgif landscape solid",
17791779
"",

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL