Initial release of Maemo 5 port of gnuplot
[gnuplot] / term / kyo.trm
1 /* Hello, Emacs, this is -*-C-*-
2  * $Id: kyo.trm,v 1.12 2006/07/21 02:35:47 sfeam Exp $
3  *
4  */
5
6 /* Prescribe (KYOCERA) driver - Michael Waldor */
7
8 /*[
9  * Copyright 1990 - 1993, 1998, 2004
10  *
11  * Permission to use, copy, and distribute this software and its
12  * documentation for any purpose with or without fee is hereby granted,
13  * provided that the above copyright notice appear in all copies and
14  * that both that copyright notice and this permission notice appear
15  * in supporting documentation.
16  *
17  * Permission to modify the software is granted, but not the right to
18  * distribute the complete modified source code.  Modifications are to
19  * be distributed as patches to the released version.  Permission to
20  * distribute binaries produced by compiling modified sources is granted,
21  * provided you
22  *   1. distribute the corresponding source modifications from the
23  *    released version in the form of a patch file along with the binaries,
24  *   2. add special version identification to distinguish your version
25  *    in addition to the base release version number,
26  *   3. provide your name and address as the primary contact for the
27  *    support of your modified version, and
28  *   4. retain our contact information in regard to use of the base
29  *    software.
30  * Permission to distribute the released version of the source code along
31  * with corresponding source modifications in the form of a patch file is
32  * granted with same provisions 2 through 4 for binary distributions.
33  *
34  * This software is provided "as is" without express or implied warranty
35  * to the extent permitted by applicable law.
36 ]*/
37
38 /* Modified for gnuplot 2.0 sk@sun4 24-Apr-1990 13:23 */
39
40 /*
41  * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
42  */
43
44 #include "driver.h"
45
46 #ifdef TERM_REGISTER
47 register_term(prescribe)
48 register_term(kyo)
49 #endif
50
51 #ifdef TERM_PROTO
52 TERM_PUBLIC void PRE_init __PROTO((void));
53 TERM_PUBLIC void KYO_init __PROTO((void));
54 TERM_PUBLIC void PRE_graphics __PROTO((void));
55 TERM_PUBLIC void PRE_text __PROTO((void));
56 TERM_PUBLIC void PRE_linetype __PROTO((int linetype));
57 TERM_PUBLIC void PRE_move __PROTO((unsigned int x, unsigned int y));
58 TERM_PUBLIC void PRE_vector __PROTO((unsigned int x, unsigned int y));
59 TERM_PUBLIC void PRE_put_text __PROTO((unsigned int x, unsigned int y, const char *str));
60 TERM_PUBLIC int PRE_justify_text __PROTO((enum JUSTIFY mode));
61 TERM_PUBLIC void PRE_reset __PROTO((void));
62
63 #define PRE_XMAX 2567
64 #define PRE_YMAX 1815           /* X:Y = sqrt(2) */
65
66 #define PRE_VCHAR (PRE_YMAX/30)
67 #define PRE_HCHAR 33            /* about 9 chars per inch */
68 #define PRE_HTIC (PRE_XMAX/80)
69 #define PRE_VTIC PRE_HTIC
70
71 /* for Courier font: */
72 #define KYO_VCHAR (14*(300/72)) /* 12 pt + 2 pt baselineskip */
73 #define KYO_HCHAR (300/10)      /*  10 chars per inch */
74 #endif /* TERM_PROTO */
75
76 #ifndef TERM_PROTO_ONLY
77 #ifdef TERM_BODY
78
79 #define PRE_XLAST (PRE_XMAX - 1)
80 #define PRE_YLAST (PRE_YMAX - 1)
81
82 enum JUSTIFY pre_justify = LEFT;        /* text is flush left */
83
84 TERM_PUBLIC void
85 PRE_init()
86 {
87     fputs("!R! RES;\n", gpoutfile);
88     /* UNIT: units are dots, 300 dots = 1 in = 72 pt */
89     /* SPO: landscape format */
90     /* STM, SLM set top, left margin */
91     /* Font: bold Helvetica (proportional font) */
92     fputs("PAGE; UNIT D; SPO L; STM 280; SLM 440;\n", gpoutfile);
93     fputs("FTMD 15; FONT 29; SCPI 9;\n", gpoutfile);
94 }
95
96 TERM_PUBLIC void
97 KYO_init()
98 {
99     fputs("!R! RES;\n", gpoutfile);
100     /* UNIT: units are dots, 300 dots = 1 in = 72 pt */
101     /* SPO: landscape format */
102     /* STM, SLM set top, left margin */
103     /* Font: Courier (fixed width font) */
104     fputs("PAGE; UNIT D; SPO L; STM 280; SLM 440;\n", gpoutfile);
105     fputs("FTMD 15; FONT 17; SCPI 10;\n", gpoutfile);
106 }
107
108 TERM_PUBLIC void
109 PRE_graphics()
110 {
111 }
112
113 TERM_PUBLIC void
114 PRE_text()
115 {                               /* eject page after each plot */
116     fputs("PAGE;\n", gpoutfile);
117 }
118
119 TERM_PUBLIC void
120 PRE_linetype(int linetype)
121 {
122     /* actually choose pendiameter */
123     if (linetype < 0)
124         linetype = -linetype;
125     else
126         linetype = 3;
127     (void) fprintf(gpoutfile, "SPD %d;\n", linetype);
128 }
129
130 TERM_PUBLIC void
131 PRE_move(unsigned int x, unsigned int y)
132 {
133     (void) fprintf(gpoutfile, "MAP %1d,%1d;\n", x, PRE_YMAX - y);
134 }
135
136 TERM_PUBLIC void
137 PRE_vector(unsigned int x, unsigned int y)
138 {
139     (void) fprintf(gpoutfile, "DAP %1d, %1d;\n", x, PRE_YMAX - y);
140 }
141
142 TERM_PUBLIC void
143 PRE_put_text(unsigned int x, unsigned int y, const char *str)
144 {
145     PRE_move(x, y);
146     switch (pre_justify) {
147     case RIGHT:
148         (void) fprintf(gpoutfile, "RTXT \"%s\", B;\n", str);
149         break;
150     default:
151         (void) fprintf(gpoutfile, "TEXT \"%s\", B;\n", str);
152     }
153 }
154
155 TERM_PUBLIC int
156 PRE_justify_text(enum JUSTIFY mode)
157 {
158     pre_justify = mode;
159     switch (pre_justify) {
160     case LEFT:
161     case RIGHT:
162         return (TRUE);
163     default:
164         return (FALSE);
165     }
166
167 }
168
169 TERM_PUBLIC void
170 PRE_reset()
171 {
172     fputs("PAGE; RES; EXIT;\n", gpoutfile);
173 }
174
175 #endif /* TERM_BODY */
176
177 #ifdef TERM_TABLE
178 TERM_TABLE_START(prescribe_driver)
179     "prescribe", "Prescribe - for the Kyocera Laser Printer",
180     PRE_XMAX, PRE_YMAX, PRE_VCHAR, PRE_HCHAR,
181     PRE_VTIC, PRE_HTIC, options_null, PRE_init, PRE_reset,
182     PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector,
183     PRE_linetype, PRE_put_text, null_text_angle,
184     PRE_justify_text, line_and_point, do_arrow, set_font_null
185 TERM_TABLE_END(prescribe_driver)
186
187 #undef LAST_TERM
188 #define LAST_TERM prescribe_driver
189
190 TERM_TABLE_START(kyo_driver)
191     "kyo", "Kyocera Laser Printer with Courier font",
192     PRE_XMAX, PRE_YMAX, KYO_VCHAR, KYO_HCHAR,
193     PRE_VTIC, PRE_HTIC, options_null, KYO_init, PRE_reset,
194     PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector,
195     PRE_linetype, PRE_put_text, null_text_angle,
196     PRE_justify_text, line_and_point, do_arrow, set_font_null
197 TERM_TABLE_END(kyo_driver)
198
199 #undef LAST_TERM
200 #define LAST_TERM kyo_driver
201
202 #endif /* TERM_TABLE */
203 #endif /* TERM_PROTO_ONLY */
204
205 #ifdef TERM_HELP
206 START_HELP(kyo)
207 "1 kyo",
208 "?commands set terminal kyo",
209 "?set terminal kyo",
210 "?set term kyo",
211 "?terminal kyo",
212 "?term kyo",
213 "?kyo",
214 "?commands set terminal prescribe",
215 "?set terminal prescribe",
216 "?set term prescribe",
217 "?terminal prescribe",
218 "?term prescribe",
219 "?prescribe",
220 " The `kyo` and `prescribe` terminal drivers support the Kyocera laser printer.",
221 " The only difference between the two is that `kyo` uses \"Helvetica\" whereas",
222 " `prescribe` uses \"Courier\".  There are no options."
223 END_HELP(kyo)
224 #endif