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