Am 14.04.2013 um 14:34 schrieb H. Özoguz <h.oezo...@mmnetz.de>:

> Hoping for some hints .... :)

What you’re looking for is the \definefont command, in one way a low level 
method to access a font
but also a usefull command to create styles for headings etc.


Let me start with the following example:

  \definefont[Test][texgyrepagellaregular at 12pt]

  \starttext
  \Test VA ffl
  \stoptext

What I do here is to create the new command \Test which loads the file 
“texgrepagellaregular”
at a size 12pt. With the optional prefix on front of the font name you can 
specify the search method,
context provides the three different methods a) file b) name and c) spec.

  a) \definefont[Test][file:texgyrepagellaregular]
  b) \definefont[Test][name:texgyrepagellaregular]
  c) \definefont[Test][spec:texgyrepagella-normal-normal]


Instead of a fixed size for the font you can also use a relative size which 
depends on the bodyfont.

  \definefont[Test][texgyrepagellaregular sa 1]

  \starttext
  \Test VA ffl \switchtobodyfont[20pt]\Test VA ffl
  \stoptext

When you use “sa XX” as argument for the size your font scales also when you 
change the bodyfont
in the middle of the document.


One problem of the definitions above is that kerning, ligatures etc. aren’t 
activated for the font
because no feature isn’t applied. To apply a feature set you have to use a 
different method than
the one which is used in a typescript because \definefont has no feature-key. 
What you have to
do to apply the set is to append it after the name name and separate both with 
a asterisks.

  \definefont[Test][texgyrepagellaregular*default sa 1]

  \starttext
  \Test VA ffl
  \stoptext


Instead of the real name of a file you can also use a symbolic name from a 
typescript.

  \definefont[Test][SansBold sa 1]

  \starttext
  \Test VA ffl
  \stoptext

In this example I used the bold version of the sans style for my \Test font, in 
this case
you don’t have to add the name of a feature because it has been already set in 
the typescript.


A complete example in a document could be look like this:

\definetypeface[mainface][rm][specserif][Antykwa Poltawskiego]
\definetypeface[mainface][ss][specsans] [Iwona]

\definefont[ChapterStyle][SansBold sa 3]

\setuphead[chapter][style=ChapterStyle]

\setupbodyfont[mainface]

\starttext

\chapter{Knuth}

\input knuth

\stoptext


Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to