chiark / gitweb /
Import upstream version 5.3.
[mup] / mup / docs / uguide / prnttext.html
1 <HTML>
2 <HEAD><TITLE>
3 "Mup commands for printing text
4 </TITLE></HEAD>
5 <BODY>
6 <P>
7 &nbsp;&nbsp;&nbsp;<A HREF="tags.html">&lt;-- previous page</A>
8
9 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="index.html">Table of Contents</A>&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="linecurv.html">next page --&gt;</A>
10 </P>
11          
12 <H2>
13 Printing commands
14 </H2>
15 <P>
16 There are several commands for printing text.
17 There are four commands that have similar formats,
18 differing only in how they justify text.
19 <BR><PRE>
20 <B>print</B> <I>location</I> &quot;<I>text</I>&quot;
21 <B>left</B> <I>location</I> &quot;<I>text</I>&quot;
22 <B>right</B> <I>location</I> &quot;<I>text</I>&quot;
23 <B>center</B> <I>location</I> &quot;<I>text</I>&quot;
24 </PRE><BR>
25 </P>
26 <P>
27 The <I>location</I> is optional. If the <I>location</I> is omitted, the &quot;print&quot;
28 command will cause the <I>text</I> to be printed beginning at the current
29 horizontal and vertical location. The other commands will cause the text to
30 be placed vertically at the current vertical position, but left justified,
31 right justified, or centered within the current margins of the page.
32 </P>
33 <P>
34 The <I>location</I> can be specified using the special keyword of &quot;nl&quot;
35 which means &quot;next line.&quot; This moves the current location to the beginning
36 of the following line before placing the text. In other words, the current
37 vertical position is moved downward by the height of the current text
38 point size (or by as much as necessary
39 if the string is taller than that). Then
40 the <I>text</I> is printed on that line with the given justification style.
41 </P>
42 <P>
43 The other way to specify a <I>location</I> is by using coordinates.
44 The justification then takes place relative to the referenced location.
45 For example, consider the following &quot;right&quot; command containing a reference
46 to an absolute location:
47 <BR><PRE>
48 right (25, 4) &quot;something&quot;
49 </PRE><BR>
50 The y location given is 4. Since this is an absolute location with no location
51 tags being referenced, this means the vertical position will be 4 stepsizes from
52 the bottom of the page. The x location given is 25. Again, this is an
53 absolute location, so the current horizontal position will be 25 stepsizes from
54 the left edge of the page. Since right justification is indicated,
55 the word &quot;something&quot; will be placed such that the right edge of the final &quot;g&quot;
56 will be 25 stepsizes from the left edge of the page. If &quot;center&quot; had been
57 specified, the middle of the word &quot;something&quot; would be at the 25 stepsize point.
58 </P>
59 <P>
60 Here are some other examples:
61 <BR><PRE>
62 print &quot;Author unknown&quot;
63 center nl &quot;subtitle&quot;
64 left (h.x - 1.5, h.n + 2.3) &quot;Ad lib&quot;
65 right (_fine.e + time 3, _note.n + 5) &quot;Duet&quot;
66 </PRE><BR>
67 </P>
68 <P>
69 Another type of print command
70 is &quot;title.&quot; The full format of this command is:
71 <BR><PRE>
72 <B>title</B> <I>fontfamily font size  &quot;text1&quot;  &quot;text2&quot;  &quot;text3&quot;</I>
73 </PRE><BR>
74 However, only the word &quot;title&quot; and one quoted text string are required.
75 The <I>fontfamily</I>, if specified, has one of the values valid for
76 <A HREF="param.html#fontfam">the "fontfamily" parameter</A>
77 (avantgarde, bookman, courier, helvetica,
78 newcentury, palatino, or times). The default is the value of the &quot;fontfamily&quot;
79 parameter.
80 The <I>font</I>, if specified, has one of the values valid for the &quot;font&quot;
81 parameter (rom, bold, ital, or boldital). If no <I>font</I> is specified
82 the default is the value of
83 <A HREF="param.html#font">the "font" parameter.</A>
84 The optional <I>size</I> is a point size within parentheses.
85 If not specified, the default is the value of
86 <A HREF="param.html#size">the "size" parameter.</A>
87 </P>
88 <P>
89 In all cases, the location will be like that obtained via the &quot;nl&quot;
90 location to a print command. In other words, the title text string(s)
91 will be printed on the line below the location that was current when the
92 title command was encountered. If there is only one string given, it will
93 be centered between the margins. If two strings are given, both will be
94 printed on the same line, but the first will be left justified and the
95 second will be right justified. If three strings are given, they will all
96 be printed on the same line, with the first left justified, the second
97 centered, and the last right justified.
98 </P>
99 <P>
100 Some samples:
101 <BR><PRE>
102 title bold (12) &quot;Sonata 12&quot;
103 title (18) &quot;Song Without Words&quot;
104 title ital (12) &quot;Text: John Doe&quot; &quot;Tune: Jane Doe&quot;
105 title &quot;Suite in C&quot; &quot;Trumpet I&quot; &quot;Waltz&quot;
106 title    &quot;&quot;    &quot;A. Composer&quot;
107 </PRE><BR>
108 </P>
109 <P>
110 <A NAME="paragrph">The final command for printing text is</A>
111 the &quot;paragraph&quot; command.
112 This is used when you have a long section of text,
113 and you would like it to automatically wrap around onto as many
114 lines as necessary.
115 You can specify whether you want the right margin to be &quot;justified&quot; or &quot;ragged.&quot;
116 If you don't specify, the type of the previous paragraph is used.
117 The default for the very first paragraph is to be justified.
118 By default, the values of the
119 <A HREF="param.html#fontfam">fontfamily,</A>
120 <A HREF="param.html#font">font,</A>
121 and
122 <A HREF="param.html#size">size</A>
123 parameters are used to determine the text style, but any or all of those
124 parameters can be overridden on the paragraph command. The complete syntax is:
125 <BR>
126  <I>justify_type</I> <B>paragraph</B> <I>fontfamily font</I> <B>(</B><I>size</I><B>) &quot;</B><I>string</I><B>&quot;</B>
127 <BR>
128 Only the keyword &quot;paragraph&quot; and the string are required.
129 Here are some example paragraphs:
130 <BR><PRE>
131 paragraph &quot;This is an example of a paragraph. Since no justification
132 type was specified, and this is the very first paragraph, the default
133 (justified) is used. A paragraph will wrap around
134 to as many lines as needed.
135 An explicit newline is given at the end of this paragraph,
136 to force a blank line between it and the following paragraph.\n&quot;
137
138 ragged paragraph avantgarde ital (15) &quot;This paragraph
139 is ragged rather than flush right. It is in a different font and size.
140 Ragged paragraphs are split onto multiple lines if necessary,
141 but they are not spread out to make lines go all the way to
142 the right margin.&quot;
143
144 justified paragraph (14) &quot;     Here is another paragraph.
145 This one is justified.
146 Only the size was specified for this paragraph; the font was not,
147 so the current default will be used.
148 Some spaces are included at the beginning of the paragraph text,
149 to create an indented first line for the paragraph.&quot;
150
151 paragraph &quot;Here is the final paragraph.
152 Since no justification type was given,
153 that of the previous paragraph (justified in this case) was used.
154 A paragraph may be used for many things,
155 such as describing how you want a piece to be performed,
156 or a biography of the composer.&quot;
157 </PRE><BR>
158 <IMG SRC="mugex81.gif" ALT="Picture of Mup output"><BR>
159 </P>
160 <P>
161 <A NAME="block">Sometimes you may want to mix</A>
162 blocks of text with music.
163 This can be done by specifying a &quot;block&quot; context. The block context
164 will typically contain one or more &quot;paragraph&quot; commands, although any
165 of the printing commands (paragraph, print, left, center, right, or title)
166 can be used. The block can also contain changes in certain parameters, namely
167 <A HREF="param.html#font">font,</A>
168 <A HREF="param.html#size">size,</A>
169 and
170 <A HREF="param.html#fontfam">fontfamily,</A>
171 which will affect the appearance of
172 the following text. A block can also contain
173 <A HREF="newscore.html">"newscore" or "newpage" commands.</A>
174 Using &quot;newscore&quot; will cause vertical space to be added,
175 as would be used to separate scores. The amount of space is affected
176 by the
177 <A HREF="param.html#scoresep">scoresep</A>
178 and
179 <A HREF="param.html#scorepad">scorepad</A>
180 parameters. Using &quot;newpage&quot; will cause a new page to be started.
181 If a newscore or newpage includes a &quot;leftmargin&quot; specification,
182 that will alter the left margin on the block text that follows.
183 A &quot;rightmargin&quot; specification will alter the right margin
184 of the block text that precedes it.
185 </P>
186 <P>
187 Here is an example of a block.
188 <BR><PRE>
189 block
190 title bold &quot;Notation in Simple and Compound Meters&quot;
191 title &quot;&quot;
192 paragraph &quot;It is common for a person familiar
193 with mathematics but not with music to assume
194 that 3/4 and 6/8 time are equivalent,
195 but that is not the case.
196 In 3/4 time (which is known as simple triple meter),
197 a measure containing 3 quarter notes
198 would be notated like this:&quot;
199 score time=3/4
200 music
201 1: c;;;
202 bar
203 block
204 paragraph &quot;whereas in 6/8 time
205 (which is compound duple meter),
206 a measure with 3 quarter notes should be notated thus:&quot;
207 score time=6/8
208 music
209 1: 4c;8~;;4;
210 bar
211 </PRE><BR>
212 <IMG SRC="mugex82.gif" ALT="Picture of Mup output"><BR>
213 </P>
214 <P>
215 The printing commands may occur in the
216 <A HREF="headfoot.html">header, footer, header2, footer2, top, bottom, top2, bottom2,</A>
217 <A HREF="prnttext.html#block">block,</A>
218 and
219 <A HREF="music.html">music</A>
220 contexts.
221 After each printing command,
222 the current location is set to the right edge of the last character printed
223 horizontally and at the baseline of the current line vertically.
224 </P>
225 <H2>
226 Including raw PostScript
227 </H2>
228 <P>
229 <A NAME="postscript">There is another command that looks a lot like the printing commands,</A>
230 but gives you a way to insert raw PostScript into the Mup output.
231 This might be used, for example,
232 to include a picture or logo along with your music.
233 The syntax is
234 <BR><PRE>
235 <B>postscript</B> <I>optional_location</I> <B>&quot;</B><I>raw PostScript</I><B>&quot;</B>
236 </PRE><BR>
237 As with the other print commands, if the location is omitted,
238 the current location is used.
239 </P>
240 <P>
241 The string is copied directly to the Mup output.
242 You can use the usual \&quot; to embed a double quote in the string,
243 but otherwise the string is copied exactly as it is,
244 enclosed inside a PostScript save/restore.
245 After the restore, the current location is reset back to where it
246 was originally.
247 </P>
248 <P>
249 Since the string is copied without any interpretation,
250 Mup does not reserve any space on the page for the PostScript,
251 and it is your responsibility to provide valid PostScript.
252 The PostScript language is beyond the scope of this User's Guide;
253 consult a book on PostScript if you need more information.
254 </P>
255 <P>
256 As a simple example, you might include an Encapsulated PostScript file
257 near the lower left corner of the current page using
258 <BR><PRE>
259 postscript &quot;50 50 translate (file.eps) run&quot;
260 </PRE><BR>
261 </P>
262 <P>
263 Or you could print a message in red italics
264 near the bottom of the page like this:
265 <BR><PRE>
266 postscript (70, 20) &quot;
267               1 0 0 setrgbcolor
268               /NewCenturySchlbk-Italic findfont
269               16 scalefont setfont
270               (Photocopying prohibited) show
271               &quot;
272 </PRE><BR>
273 </P>
274 <HR><P>
275 &nbsp;&nbsp;&nbsp;<A HREF="tags.html">&lt;-- previous page</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="index.html">Table of Contents</A>&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="linecurv.html">next page --&gt;</A>
276 </P>
277 </BODY></HTML>