[dev-context] setupbodyfont

Wolfgang Schuster schuster.wolfgang at googlemail.com
Tue Jun 9 09:13:46 CEST 2009


Hi Hans,

I run with my simplefonts module in two problems when I try to set the  
bodyfont,
the regard math and fallback fonts and I was only to solve them by  
redefining
of a few values.


1. I have to set the bodyfont at the same time when I set a individual  
font for
    serif, sans or mono. This works fine for the the three text style  
but not when
    I try to switch to a different math font, which is frozen with the  
first
    \setupbodyfont command and can only be changed when I the main  
fontclass
    (created with \registerfontclass in \definetypeface) and the style  
value
    for rm (I need the 'rm' style to allow e.g. ss as document style).

    Here is a example to illustrate the problem:

\definetypeface[mainface][rm][serif][times][default]

\setupbodyfont[mainface,ss,12pt]

\definetypeface[mainface][ss][sans][helvetica][default]
\definetypeface[mainface][tt][mono][courier][default]

\definetypeface[mainface][mm][math][palatino][default]

% comment/uncomment the following two lines to see how
% the math font changes with/without these redefinitions

\letvalueempty{@@tfmainfacedefault}%
\undefinevalue{@f at st@rm}%
\setupbodyfont[mainface,ss,12pt]

%\definetypeface[mainface][mm][math][cambria][default]

%\letvalueempty{@@tfmainfacedefault}%
%\undefinevalue{@f at st@rm}%
%\setupbodyfont[mainface,ss,12pt]

\starttext

text

\rmtf regular \it italic \bf bold \bi bolditalic

\sstf regular \it italic \bf bold \bi bolditalic

\tttf regular \it italic \bf bold \bi bolditalic

$$ c^2 = a^2 + b^2 $$

\stoptext


2. The fallback for the main style (i.e. \rmtf) is frozen too with
    the first \setupbodyfont line in the document with can be only reset
    when I undefine \newfontidentifier, a example for this is:

\starttypescript [serif] [mainfont]
     \setups[font:fallback:serif]
     \definefontsynonym [Serif] [name:texgyrepagellaregular]  
[fallbacks=mainfont,features=default]
\stoptypescript

\definetypeface [mainfont] [rm] [serif] [mainfont] [default]

\setupbodyfont[mainfont,rm]

\definefontfallback [mainfont] [name:texgyretermesregular]  
[0x0065-0x0070] [force=yes]

% The following line is necessary to enable the fallback font for the  
main
% style after the bodyfont is set, if this isn't done the complete text
% below is typeset in Pagella whereas e-p should be in Times

\undefinevalue\newfontidentifier
\setupbodyfont[mainfont,rm]

\starttext

abcdefghijkmnopqrstuvwxyz

\stoptext


I would prefer something documented (e.g. \setupbodyfont[reload,...])  
which can
be used to get the same effect as I did with my hacks because I like  
now my new
font module, it's lot easier than direct method to set fallback fonts.

TIA
Wolfgang



More information about the dev-context mailing list