6

I am trying to replicate a Word template that is made ... ahem "beautiful" ... by using a scattering of different fonts all over the place.

The body font is different from the heading fonts.

I have:

\definefont [sectionFont] [name:freakyfontname]

and

\setuphead [section] [style=\sectionFont]

which works except that I would like to add a size to the setuphead style that is relative to the body font size.

I cannot use \tfa and friends because then the typeface in section changes to use the body font (albeit scaled as I would like).

My (uneducated) guess is that I need to do something like:

\definefont [sectionFont] [name:freakyfontname at \some\maths\here]

but I don't know how to do this.

How can I setuphead with a definefont and font size relative to the body font?

  • \definefont[sectionfont] [name:freakyfontname sa 2] – Aditya Jun 23 '16 at 15:17
6

When defining fonts, you can use sa to specify relative font sizes. For example:

\definefont[sectionfont] [name:freakyfontname sa 2]

creates a font that is two times the default fontsize. Say, you want the section titles to be twice the bodyfont size, then you can use:

\definefont [sectionFont] [name:comicneueangularbold sa 2]
\setuphead[section][style=\sectionFont]

Here is a complete example:

\definefont [sectionFont] [name:comicneueangularbold sa 2]
\setuphead[section][style=\sectionFont]

\starttext
\startTEXpage[width=10cm, offset=1mm]
\section{Ward}
\input ward

\switchtobodyfont[14pt]
\section{Ward}
\input ward

\stopTEXpage
\stoptext

which gives

enter image description here

Here is the relevant documentation from font-ini.mkvi

%D There are several ways to specify a font. Three of them are
%D pure \TeX\ ones, the fourth one is new:
%D
%D \starttyping
%D \font\name=cmr12
%D \font\name=cmr12 at 10pt
%D \font\name=cmr12 scaled 2
%D \font\name=cmr12 sa 1.440
%D \stoptyping
%D
%D The non||\TEX\ alternative \type{sa} stands for {\em scaled
%D at}. This means as much as: scale the bodyfontsize with this
%D factor. The scaled option is not that useful as one needs to
%D know the design size.
  • What does sa stand for? – Manuel Jun 23 '16 at 20:30
  • 1
    @Manuel: See updated answer. – Aditya Jun 23 '16 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.