mercoledì 7 dicembre 2011

Specimen Sheet Generator

When I started dabbling with DTP, one of the big issue I always had there have always been few programs capable to print decent specimen sheets. While there's little about roleplaying in this post, I think that serious indie game designers could really benefit from a proper specimen sheet.
So, in all of its glory, here's the ConTeXt source to create specimen sheets out of Serif, Sans and Mono fonts. As it is, this code works with ConTeXt/pdfTex, using its default fonts.
However, if you properly setup typescripts -- a subject of a next post, rest assured -- you can generate a handy pdf of 21 specimens of your favorite font set.
It's public domain and it's yours to enjoy!



\setupfontsynonym[Sans][handling=highquality]
\setupfontsynonym[SansBold][handling=highquality]
\setupfontsynonym[SansItalic][handling=highquality]
\setupfontsynonym[SansBoldItalic][handling=highquality]
\setupfontsynonym[SansSlanted][handling=highquality]
\setupfontsynonym[SansBoldSlanted][handling=highquality]
\setupfontsynonym[SansSmallCaps][handling=highquality]
\setupfontsynonym[Serif][handling=highquality]
\setupfontsynonym[SerifBold][handling=highquality]
\setupfontsynonym[SerifItalic][handling=highquality]
\setupfontsynonym[SerifBoldItalic][handling=highquality]
\setupfontsynonym[SerifSlanted][handling=highquality]
\setupfontsynonym[SerifBoldSlanted][handling=highquality]
\setupfontsynonym[SerifSmallCaps][handling=highquality]
\setupfontsynonym[Mono][handling=highquality]
\setupfontsynonym[MonoBold][handling=highquality]
\setupfontsynonym[MonoItalic][handling=highquality]
\setupfontsynonym[MonoBoldItalic][handling=highquality]
\setupfontsynonym[MonoSlanted][handling=highquality]
\setupfontsynonym[MonoBoldSlanted][handling=highquality]
\setupfontsynonym[MonoSmallCaps][handling=highquality]

\setupfonthandling[hz][min=0, max=90, step=5]
\setupalign[hanging,hz,spacing]
\setupinterlinespace
[height=.72,
depth=.28,
top=1.0,
bottom=0.4,
line=3ex]



%---------------- page size, spacing ------------------------------
\setuppapersize[a4][a4] % this is default and may be omitted


\setuplayout
[leftmargin=10mm,
rightmargin=10mm,
leftmargindistance=5mm,
rightmargindistance=5mm,
backspace=20mm,
cutspace=20mm,
header=5mm,
footer=7mm,
height=middle,
topspace=8mm,
bottomspace=10mm,
width=middle]
\setuppagenumbering[location=right,marginedge,style=\tfxx]


\def\SpecimenLine#1#2#3#4#5#6
{
\switchtobodyfont[rm,9pt]
\setupinterlinespace[line=9pt]
\vskip 1mm
\hairline
{\tt #5 #3}
\vskip 1mm
\switchtobodyfont[#1,#2,#3]
\setupinterlinespace[height=.72,
depth=.28,
top=1.0,
bottom=0.4,
line=3.5em]
#4
#6
\switchtobodyfont[rm,9pt]
\setupinterlinespace[line=9pt]
\tt
\par
}

\def\SpecimenPage#1#2#3#4{\bgroup
\SpecimenLine{#1}{#2}{72pt}{#3}{#4}{Watson?}
\SpecimenLine{#1}{#2}{48pt}{#3}{#4}{you excel yourself!}
\SpecimenLine{#1}{#2}{36pt}{#3}{#4}{\& said H\"olme\cc  , p\"u\${\.h}in\.g b\aa c\=k  h\=\i s 22 chairs}
\SpecimenLine{#1}{#2}{24pt}{#3}{#4}{and l\'ight\`ing \`a {\k c}ig{\d a}re{\=t}te. -- I am b\`o\`und t\~o s\^ay that i\~n all the ac\cc ounts }
\SpecimenLine{#1}{#2}{18pt}{#3}{#4}{which you have been so good as to give of my own
small achievements you have habitually underrated your own
abilities. }
\hairline
\vskip 3mm
\startcolumns[n=2]
\SpecimenLine{#1}{#2}{14pt}{#3}{#4}{It may be that you are not yourself luminous, but you
are a conductor of light. Some people without possessing genius
have a remarkable power of stimulating it.}
\SpecimenLine{#1}{#2}{12pt}{#3}{#4}{He had never said as much before, and I must admit that his words
gave me keen pleasure, for I had often been piqued by his
indifference to my admiration and to the attempts which I had
made to give publicity to his methods.}
\SpecimenLine{#1}{#2}{10pt}{#3}{#4}{I was proud, too, to think
that I had so far mastered his system as to apply it in a way
which earned his approval. He now took the stick from my hands
and examined it for a few minutes}
\stopcolumns
\hairline
\switchtobodyfont[#1,#2,9pt]
#3
\parindent=6pt
\startcolumns[n=3]
\baselineskip=12pt
\setuplayout[grid=yes]
Mr. Sherlock Holmes, who was usually very late in the mornings,
save upon those not infrequent occasions when he was up all
night, was seated at the breakfast table. I stood upon the
hearth-rug and picked up the stick which our visitor had left
behind him the night before. It was a fine, thick piece of wood,
bulbous-headed, of the sort which is known as a "Penang lawyer."
Just under the head was a broad silver band nearly an inch
across. "To James Mortimer, M.R.C.S., from his friends of the
C.C.H.," was engraved upon it, with the date "1884." It was just
such a stick as the old-fashioned family practitioner used to
carry--dignified, solid, and reassuring.
\par
"Well, Watson, what do you make of it?"
\par
Holmes was sitting with his back to me, and I had given him no
sign of my occupation.
\par
"How did you know what I was doing? I believe you have eyes in
the back of your head."
\par
"I have, at least, a well-polished, silver-plated coffee-pot in
front of me," said he. "But, tell me, Watson, what do you make of
our visitor's stick? Since we have been so unfortunate as to miss
him and have no notion of his errand, this accidental souvenir
becomes of importance. Let me hear you reconstruct the man by an
examination of it."
\par
"I think," said I, following as far as I could the methods of my
companion, "that Dr. Mortimer is a successful, elderly medical
man, well-esteemed since those who know him give him this mark of
their appreciation."
\par
"Good!" said Holmes. "Excellent!"
\stopcolumns
\setuplayout[grid=no]
\parindent=0pt
\page
\egroup}

\def\SpecimenFamily#1#2#3{
\SpecimenPage{#1}{#2}{\tf}{#3 Regular}
\SpecimenPage{#1}{#2}{\bf}{#3 BoldFace}
\SpecimenPage{#1}{#2}{\it}{#3 Italic}
\SpecimenPage{#1}{#2}{\bi}{#3 BoldItalic}
\SpecimenPage{#1}{#2}{\sl}{#3 Slanted}
\SpecimenPage{#1}{#2}{\bs}{#3 BoldSlanted}
\SpecimenPage{#1}{#2}{\sc}{#3 SmallCaps}
}

\starttext

\setupbodyfont[rm,9pt]
\SpecimenFamily{ff-font}{rm}{name of serif font}
\SpecimenFamily{ff-font}{ss}{name of sans font}
% \SpecimenFamily{ff-font}{tt}{name of mono font}
\stoptext
This is a sample of the output it produces:

Nessun commento:

Posta un commento