Odd Font Behavior in startstop Group
I am experiencing an odd behavior switching text styles in a defined startstop group ("blockquote"). I get different behavior depending on whether the switchtobodyfont in the startstop definition includes the dummy {\it } and {\bf } text. If they are not there, the italic and boldface switches in the second blockquote revert to the gyreschola body font of the main text; but this only happens if there is an earlier blockquote with no style changes. This is with: $ context --version mtx-context | ConTeXt Process Management 1.03 mtx-context | mtx-context | main context file: /usr/local/texlive/texmf-local/tex/context/base/mkiv/context.mkiv mtx-context | current version: 2020.03.10 14:44 mtx-context | main context file: /usr/local/texlive/texmf-local/tex/context/base/mkiv/context.mkxl mtx-context | current version: 2020.03.10 14:44 Do I need a newer version of ConTeXt, or am I doing something wrong? Fonts in ConTeXt are always perilous, alas. For me, anyway. \definefallbackfamily[story][serif][notoserif][range={greekandcoptic,greekextended},force=yes] \definefontfamily[story][serif][TeX Gyre Schola] \definefontfamily[story][sans][modern] \definefontfamily[story][mono][modern] \definefontfamily[story][mm][TeX Gyre Pagella Math] \setupbodyfont[story,11pt] \definestartstop[blockquote] [ before={ \blank \startnarrower \setupwhitespace[2pt] \setupindenting[none] \switchtobodyfont[termes]{\it }{\bf }% This is so weird. Put a comment marker after [termes] for a different result }, after={ \stopnarrower \blank \indenting[next]}, ]% \starttext \chapter{Testing} \input ward \startblockquote \input knuth \stopblockquote \input zapf {\it This is what Italic letters look like.} {\bf And these are bold.} \startblockquote This is what it said, in {\it Italic} and {\bf bold} letters: \bgroup \it\noindent This is what Italic letters look like here. \egroup \bgroup \bf\noindent This is what Bold letters look like here. \egroup \stopblockquote \stoptext
On Sunday, February 6, 2022 12:58:06 AM IST Michael Urban via ntg-context wrote:
Do I need a newer version of ConTeXt, or am I doing something wrong? Fonts in ConTeXt are always perilous, alas. For me, anyway.
(pre)loading the typescripts 'fixes' the issue. \usebodyfont[termes] See below a modified version of your MWE: \definefallbackfamily[story][serif][notoserif] [range={greekandcoptic,greekextended},force=yes] \definefontfamily[story][serif][TeX Gyre Schola] \definefontfamily[story][sans][modern] \definefontfamily[story][mono][modern] \definefontfamily[story][mm][TeX Gyre Pagella Math] \setupbodyfont[story,11pt] \usebodyfont[termes] \definestartstop [blockquote] [before={\blank\startnarrower\setupwhitespace[2pt]\setupindenting[none]}, style={\switchtobodyfont[termes]}, after={\stopnarrower\blank\indenting[next]}] \starttext \input knuth \startblockquote \input knuth \stopblockquote this is normal text \par {\bf this is bold} \par {\it this is italics} \startblockquote this is normal text \par {\bf this is bold} \par {\it this is italics} \stopblockquote \stoptext Best, Sreeram
Michael Urban via ntg-context schrieb am 05.02.2022 um 20:28:
I am experiencing an odd behavior switching text styles in a defined startstop group ("blockquote"). I get different behavior depending on whether the switchtobodyfont in the startstop definition includes the dummy {\it } and {\bf } text. If they are not there, the italic and boldface switches in the second blockquote revert to the gyreschola body font of the main text; but this only happens if there is an earlier blockquote with no style changes. This is with:
[...]
Do I need a newer version of ConTeXt, or am I doing something wrong? Fonts in ConTeXt are always perilous, alas. For me, anyway.
\definefallbackfamily[story][serif][notoserif][range={greekandcoptic,greekextended},force=yes] \definefontfamily[story][serif][TeX Gyre Schola]
The following two font settings are wrong, you're passing the name of a typescript for the third argument while \definefontfamily expects the family name of a font. Even though the usage of the command is wrong you didn't notice it because as a fallback \definefontfamily uses the Latin Modern version of the requested style when no font was found.
\definefontfamily[story][sans][modern] \definefontfamily[story][mono][modern]
The correct settings for both settings are \definefontfamily [story] [sans] [Latin Modern Sans] \definefontfamily [story] [mono] [Latin Modern Mono] [features=none] with the "features=none" for the mono font to ensure no ligatures are formed. An alternative for \definefontfamily is to use \definetypeface and choose a predefined typescript for the Latin Modern family. You can either use \definetypeface [story] [ss] [sans] [modern] [default] \definetypeface [story] [ss] [mono] [modern] [default] which uses the 10pt optical size even for smaller and bigger sizes or you enable optical sizes with the following typescript \definetypeface [story] [ss] [sans] [modern-designsize] [default] \definetypeface [story] [ss] [mono] [modern-designsize] [default]
\definefontfamily[story][mm][TeX Gyre Pagella Math]
I recommend to load the math font with the provided typescript because they ensure existing patches (e.g. spacing corrections) for the selected font are applied. \definetypeface [story] [mm] [math] [pagella] [default]
\setupbodyfont[story,11pt]
\definestartstop[blockquote] [ before={ \blank \startnarrower \setupwhitespace[2pt] \setupindenting[none] \switchtobodyfont[termes]{\it }{\bf }% This is so weird. Put a comment marker after [termes] for a different result }, after={ \stopnarrower \blank \indenting[next]}, ]%
ConTeXt already provides a blockquote-environment which can be configured to have the same style as your custom environment. \startsetups [blockquote:style] \switchtobodyfont[termes] \setupwhitespace[2pt] \stopsetups \setupdelimitedtext [blockquote] [spacebefore=big, style=\directsetup{blockquote:style}, indenting=none, indentnext=yes] Wolfgang
On Sunday, February 6, 2022 3:50:21 PM IST Wolfgang Schuster via ntg-context wrote:
The following two font settings are wrong, you're passing the name of a typescript for the third argument while \definefontfamily expects the family name of a font. […] ConTeXt already provides a blockquote-environment which can be configured to have the same style as your custom environment.
Hi Wolfgang, I have a related question: I noticed that the font settings were wrong in the original MWE of Michael. I am also aware that ConTeXt has a blockquote env (having used it before). In fact, I first tested the following example before responding to Michael's question: %%% SOF \usebodyfont[termes] \setupbodyfont[schola] \setupdelimitedtext [blockquote] [style={\switchtobodyfont[termes]}] \starttext main body font here \startblockquote \input knuth \stopblockquote {\bf test}\par {\it test} \startblockquote {\bf test} {\it test} \stopblockquote \stoptext %%% EOF In the above, if the first line '\usebodyfont[termes]' is removed, the second blockquote env renders in schola not termes. Moreover, on removing the first blockquote env with '\input knuth' the second one appears correctly in termes. Thus, regardless of other things, '\usebodyfont[termes]' seems to be necessary here. Is this correct or am I missing something? Thanks, śrīrāma (Sreeram)
participants (3)
-
Michael Urban
-
Wolfgang Schuster
-
śrīrāma