diff --git a/cpdfmanual.pdf b/cpdfmanual.pdf index 54a320c..7dfcd27 100644 Binary files a/cpdfmanual.pdf and b/cpdfmanual.pdf differ diff --git a/cpdfmanual.tex b/cpdfmanual.tex index 179ee94..4cede8d 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -4504,6 +4504,85 @@ We can draw text in a \textit{text section}, which must start with \texttt{-bt} \fbox{\includegraphics[width=0.3\textwidth]{manualimages/stext.pdf}} \bigskip +\noindent We can use \texttt{-text} multiple times, interspersing operators which change the text state, such as font and font size: + +\begin{framed} + \noindent\small\verb?cpdf -create-pdf AND -draw -mtrans "10 20" -font-size 72?\\ + \noindent\small\verb? -bt -text "Different " -font Times-BoldItalic -text "fonts"?\\ + \noindent\small\verb? -font-size 36 -text " and sizes" -et -o out.pdf?\\ +\end{framed} + +\noindent Here is the result: + +\bigskip +\fbox{\includegraphics[width=0.3\textwidth]{manualimages/fonts.pdf}} +\bigskip + +\noindent We can alter the character space, word space, horizontal scaling (100 = no scaling, <100 shrink, >100 stretch), and text rise: + +\begin{framed} + \noindent\small\verb?cpdf -create-pdf AND -draw -mtrans "10 20" -font-size 72?\\ + \noindent\small\verb? -bt -textscale 75 -charspace 5 -wordspace 20 -text "Different "?\\ + \noindent\small\verb? -font Times-BoldItalic -text "fonts" -font-size 36 -rise 40?\\ + \noindent\small\verb? -text " and sizes" -et -o out.pdf?\\ +\end{framed} + +\noindent Now we see: + +\bigskip +\fbox{\includegraphics[width=0.3\textwidth]{manualimages/fontparams.pdf}} +\bigskip + +\noindent Text may appear on multiple lines. We set up the line spacing with \texttt{-leading} then make new lines with \texttt{-nl}: + +\begin{framed} + \noindent\small\verb?cpdf -create-pdf AND -draw -mtrans "100 200" -font-size 50?\\ + \noindent\small\verb? -leading 55 -bt -text "This is" -nl -text "on multiple"?\\ + \noindent\small\verb? -nl -text "lines" -et -o out.pdf? +\end{framed} + +\noindent Now we have: + +\bigskip +\fbox{\includegraphics[width=0.3\textwidth]{manualimages/lines.pdf}} +\bigskip + +\noindent When composing text, we may need to find the width of a piece of text to see where to break it, or for right alignment. We can use \texttt{-textwidth} for this: + +\begin{framed} + \noindent\small\verb?cpdf -font Times-Roman -font-size 20 -text-width "Hello"? +\end{framed} + +\noindent The result is in points. + +We can change the text rendering mode to show outline text or, in this example, to use text as a clipping region: + +\begin{framed} + \noindent\small\verb?cpdf -create-pdf AND -draw -rendermode 7 -mtrans "100 200" -font-size 50?\\ + \noindent\small\verb? -leading 55 -bt -text "This is" -nl -text "on multiple"?\\ + \noindent\small\verb? -nl -text "lines" -et -circle "100 0 100" -fill -o out.pdf? +\end{framed} + +\bigskip +\fbox{\includegraphics[width=0.3\textwidth]{manualimages/textclip.pdf}} +\bigskip + + +\noindent Here are the text rendering modes: + +\bigskip +\begin{tabular}{ll} +0 & Fill text (default)\\ +1 & Stroke text\\ +2 & Fill, then stroke text\\ +3 & Neither fill nor stroke (invisible)\\ +4 & Fill text and add to path for clipping\\ +5 & Stroke text and add to path for clipping\\ +6 & Fill, then stroke text and add to path for clipping\\ +7 & Add text to path for clipping +\end{tabular} +\bigskip + \section{The next page} {\small\begin{framed} @@ -4521,6 +4600,7 @@ The drawing operation \texttt{-newpage} creates a fresh page of the same dimensi \noindent This will create a two page PDF with "Page 1" written on page one and "Page 2" written on page two. + \clearpage\pagestyle{empty} %We wanted to call this "Chapter M", but the following commands messed up the PDF bookmarks, so this chapter will simply have to float for now, until we can return to this problem. %\setcounter{chapter}{12} diff --git a/manualimages/fontparams.pdf b/manualimages/fontparams.pdf new file mode 100644 index 0000000..5b9ff2a --- /dev/null +++ b/manualimages/fontparams.pdf @@ -0,0 +1,40 @@ +%PDF-2.0 +% +1 0 obj +<> +endobj +2 0 obj +<> +stream +x-M + ̲Va +xf$GB +({b&Te @Yv13gŜX0=Uƕ^p +endstream +endobj +3 0 obj +<>>>/MediaBox[0 0 595.2765 841.89105]/Contents[2 0 R]>> +endobj +4 0 obj +<> +endobj +5 0 obj +<> +endobj +6 0 obj +<> +endobj +xref +0 7 +0000000000 65535 f +0000000015 00000 n +0000000060 00000 n +0000000223 00000 n +0000000356 00000 n +0000000446 00000 n +0000000497 00000 n +trailer +<<84a6ceb9a015940eeeab0d7b671b2c1f>]>> +startxref +592 +%%EOF diff --git a/manualimages/fonts.pdf b/manualimages/fonts.pdf new file mode 100644 index 0000000..a99310c --- /dev/null +++ b/manualimages/fonts.pdf @@ -0,0 +1,39 @@ +%PDF-2.0 +% +1 0 obj +<> +endobj +2 0 obj +<> +stream +x-1 +0 ЫQ6t r*vZ(o{#G/"a +`햤*XAϧVraJmQ +endstream +endobj +3 0 obj +<>>>/MediaBox[0 0 595.2765 841.89105]/Contents[2 0 R]>> +endobj +4 0 obj +<> +endobj +5 0 obj +<> +endobj +6 0 obj +<> +endobj +xref +0 7 +0000000000 65535 f +0000000015 00000 n +0000000060 00000 n +0000000208 00000 n +0000000341 00000 n +0000000431 00000 n +0000000482 00000 n +trailer +<<03010e3b477e40d88f434378e4c3a965>]>> +startxref +577 +%%EOF diff --git a/manualimages/lines.pdf b/manualimages/lines.pdf new file mode 100644 index 0000000..5e22dca --- /dev/null +++ b/manualimages/lines.pdf @@ -0,0 +1,36 @@ +%PDF-2.0 +% +1 0 obj +<>>>/MediaBox[0 0 595.2765 841.89105]/Contents[4 0 R]>> +endobj +2 0 obj +<> +endobj +3 0 obj +<> +endobj +4 0 obj +<> +stream +x]1 +0x'VxD!mfF!e +PF8. +'p -p|%_ +endstream +endobj +5 0 obj +<> +endobj +xref +0 6 +0000000000 65535 f +0000000015 00000 n +0000000139 00000 n +0000000184 00000 n +0000000274 00000 n +0000000423 00000 n +trailer +<]>> +startxref +474 +%%EOF diff --git a/manualimages/textclip.pdf b/manualimages/textclip.pdf new file mode 100644 index 0000000..d3e3832 Binary files /dev/null and b/manualimages/textclip.pdf differ