Hello, I'm working through the reference manual trying to understand how things work in regard to fonts. I'll be submitting clarifications and elaborations to the manual in an attempt to help other non-experts to grasp the design of ConTeXt. There's a point that's confusing to me in section 5.5, Line spacing. On page 108 of the manual it says "Linespacing alters when a new bodyfont is used or when linespacing is defined explicitly by \setupinterlinespace (which is explained later)" But on the next page it says, "When you make a font switch the linespacing is adapted when you give the command \setupinterlinespace without any setup parameters and also when you add the key reset, for example..." So here's why I'm confused. When you change fonts, (a) does linespacing get changed automatically, or (b) do you have to say \setupinterlinespace? If (a), then why does the second quote above seem to say you need \setupinterlinespace to make it happen? If (b), then isn't the first quote above inaccurate? Is there a distinction being drawn here between "when a new bodyfont is used" and "when you make a font switch", or are those just variant phrasings for what is intended to mean the same thing? Thanks for your help, Lars
On Tue, 24 Sep 2013, Lars Huttar wrote:
Hello, I'm working through the reference manual trying to understand how things work in regard to fonts. I'll be submitting clarifications and elaborations to the manual in an attempt to help other non-experts to grasp the design of ConTeXt.
There's a point that's confusing to me in section 5.5, Line spacing. On page 108 of the manual it says "Linespacing alters when a new bodyfont is used or when linespacing is defined explicitly by \setupinterlinespace (which is explained later)"
But on the next page it says, "When you make a font switch the linespacing is adapted when you give the command \setupinterlinespace without any setup parameters and also when you add the key reset, for example..."
So here's why I'm confused. When you change fonts, (a) does linespacing get changed automatically, or (b) do you have to say \setupinterlinespace? If (a), then why does the second quote above seem to say you need \setupinterlinespace to make it happen? If (b), then isn't the first quote above inaccurate?
Is there a distinction being drawn here between "when a new bodyfont is used" and "when you make a font switch", or are those just variant phrasings for what is intended to mean the same thing?
Contrast {\switchtobodyfont[14pt] \input ward \endgraf} with {\tfc \input ward \endgraf} Aditya
Aditya wrote,
Contrast
{\switchtobodyfont[14pt] \input ward \endgraf}
with
{\tfc \input ward \endgraf}
Thanks for your help. You've left me to draw my own conclusions from this example, so I'll say what I think this implies, and please correct me if I'm wrong. (Note to other non-TeXnichians: \endgraf is a TeX synonym for \par: end of paragraph.) I think the principle that you're trying to demonstrate is that the answer to my last paragraph is yes: there is an important distinction between "making a font switch," e.g. \tfc, and "using a new body font", of which \switchtobodyfont is apparently an example. Namely, that the latter causes the interlinespace to be automatically adjusted, whereas the former doesn't unless you explicitly use \setupinterlinespace. Can you explain how/why the two ways of increasing the font size should have such different effects? (I have read section 5.8 and 5.9 about selecting bodyfonts and interlinespace but still don't get it.) \tfc is described as a "font selector" command (5.3.2). It seems to me that both \tfc and \switchtobodyfont[20pt] simply attempt to switch to a different size of whatever bodyfont is currently in effect. But there must be something I'm missing. (Or else it's just an arbitrary distinction, but that seems unlikely.) Lars
On 9/24/2013 12:01 PM, Lars Huttar wrote:
Can you explain how/why the two ways of increasing the font size should have such different effects? (I have read section 5.8 and 5.9 about selecting bodyfonts and interlinespace but still don't get it.) \tfc is described as a "font selector" command (5.3.2). It seems to me that both \tfc and \switchtobodyfont[20pt] simply attempt to switch to a different size of whatever bodyfont is currently in effect. But there must be something I'm missing. (Or else it's just an arbitrary distinction, but that seems unlikely.)
Is it that \switchdobodyfont changes the *body* font, which engages the associated bodyfont environment... whereas \tfc changes the *font*, not the *body* font? Lars
On Tue, Sep 24, 2013 at 7:45 PM, Lars Huttar
On 9/24/2013 12:01 PM, Lars Huttar wrote:
Can you explain how/why the two ways of increasing the font size should have such different effects? (I have read section 5.8 and 5.9 about selecting bodyfonts and interlinespace but still don't get it.) \tfc is described as a "font selector" command (5.3.2). It seems to me that both \tfc and \switchtobodyfont[20pt] simply attempt to switch to a different size of whatever bodyfont is currently in effect. But there must be something I'm missing. (Or else it's just an arbitrary distinction, but that seems unlikely.)
Is it that \switchdobodyfont changes the *body* font, which engages the associated bodyfont environment... whereas \tfc changes the *font*, not the *body* font?
Lars
You can look into font-pre.mkiv \tfc augment the fontsize of a factor of 1.728 It's relative to the default fount size not to the current fontsize: {\tfc foo {\tfc foo}} both foo have the same size http://contextgarden.net
But interlinespace is not modified, so we need to reset \starttext OK: \input knuth\blank{\tfx WRONG: \input knuth\blank \tfc WRONG: \input knuth\relax} \page OK: \input knuth\blank{\tfx\setupinterlinespace OK: \input knuth\blank \tfc WRONG: \input knuth\blank} \page OK: \input knuth\blank{\tfx\setupinterlinespace OK: \input knuth\blank \tfc\setupinterlinespace OK: \input knuth\blank} \stoptext -- luigi
Luigi, Thanks for your reply. On 9/24/2013 2:18 PM, luigi scarso wrote:
On Tue, Sep 24, 2013 at 7:45 PM, Lars Huttar
mailto:lars_huttar@sil.org> wrote: Is it that \switchdobodyfont changes the *body* font, which engages the associated bodyfont environment... whereas \tfc changes the *font*, not the *body* font?
Lars
You can look into font-pre.mkiv
OK. I'm looking at it, http://repo.or.cz/w/context.git/blob/HEAD:/tex/context/base/font-pre.mkiv Is there anything in particular you had in mind that I can learn from it? I found some aliases, e.g. \smaller, which are handy to know. But I don't know how much I can rely on the undocumented ones to continue to do what they do now.
\tfc augment the fontsize of a factor of 1.728 It's relative to the default fount size not to the current fontsize: {\tfc foo {\tfc foo}} both foo have the same size
Thank you, this is an important nugget that I didn't understand when reading the documentation. \setsmallbodyfont and \setbigbodyfont, in contrast, change the font size relative to the current size.
But interlinespace is not modified, so we need to reset \starttext OK: \input knuth\blank{\tfx WRONG: \input knuth\blank \tfc WRONG: \input knuth\relax} \page OK: \input knuth\blank{\tfx\setupinterlinespace OK: \input knuth\blank \tfc WRONG: \input knuth\blank} \page OK: \input knuth\blank{\tfx\setupinterlinespace OK: \input knuth\blank \tfc\setupinterlinespace OK: \input knuth\blank} \stoptext
Ok. This confirms what Aditya said, and what the manual says: that you have to use \setupinterlinespace after \tfx or \tfc if you want the interlinespace to be adjusted. But I would really like to understand the categories involved here. So we have one category of font size selector commands, which includes \setsmallbodyfont and \setbigbodyfont, that cause interlinespace to be adjusted automatically. Then we have another category, including \tfc, \tfx, \ita, and others, that do not cause interlinespace to be adjusted. What is the rhyme or reason behind these categories? And that would help me know, which other commands belong to which category? E.g. would \serif cause interlinespace to be adjusted? An experiment would reveal the answer, at least in the circumstances that I think of testing, but I'd like to understand the conceptual model. Maybe the concept is that the first category affects the "body font" (and therefore interacts with the properties of the body font environment), and the second category only affects the "font" (and I'm still not clear on how the "body font" differs from the current font). Thanks for your help, Lars
On Tue, 24 Sep 2013, Lars Huttar wrote:
environment), and the second category only affects the "font" (and I'm still not clear on how the "body font" differs from the current font).
(Sorry for the terse replies...) {\switchtobodyfont[14pt] Text $math$ \sans{Sans} \endgraf} {\tfc Text $math$ \sans{Sans} \endgraf} Aditya
On 9/24/2013 5:25 PM, Aditya Mahajan wrote:
On Tue, 24 Sep 2013, Lars Huttar wrote:
environment), and the second category only affects the "font" (and I'm still not clear on how the "body font" differs from the current font).
(Sorry for the terse replies...)
{\switchtobodyfont[14pt] Text $math$ \sans{Sans} \endgraf}
{\tfc Text $math$ \sans{Sans} \endgraf}
Aditya
I don't know how this answers the above question. Can anybody explain? Clearly you're drawing a comparison between \switchtobodyfont[14pt] and \tfc. I've run the sample, and I see that, as in other samples earlier in this thread, \switchtobodyfont causes the interlinespace to be adjusted accordingly, and \tfc doesn't. Is that intended to be an answer to 'how the "body font" differs from the current font'? And is the answer that the bodyfont is a conglomerate of more properties than just the font, including interlinespace? Thanks, Lars
On Wed, Sep 25, 2013 at 9:54 PM, Lars Huttar
And is the answer that the bodyfont is a conglomerate of more properties than just the font, including interlinespace?
You can read font-ini.mkvi : %D \macros %D {setupbodyfont,switchtobodyfont} %D %D The next two macros are user ones. With \type{\setupbodyfont} %D one can set the document bodyfont size, font family, style %D and/or options defined in files, for example: %D %D \starttyping %D \setupbodyfont[modern,12pt,roman] %D \stoptyping %D %D This command affects the document as a whole: text, headers %D and footers. The second macro however affects only the text: %D %D \starttyping %D \switchtobodyfont[10pt] %D \stoptyping %D %D So we've got: %D %D \showsetup{setupbodyfont} %D \showsetup{switchtobodyfont} %D %D Both macros look alike. The second one also has to take %D all kind of keywords into account. If you follow switchtobodyfont you can see unexpanded\def\font_basics_switchtobodyfont#specification% {\edef\m_font_step{\bodyfontvariable{#specification}}% \ifx\m_font_step\empty \font_helpers_set_font\zerocount{#specification}% \else \font_helpers_switch_bodyfont_step % so we have a fast [small] switch \fi \the\everybodyfont \the\everyswitchtobodyfont} \unexpanded\def\switchtobodyfont[#specification]% could become an ifx {\doifsomething{#specification}{\font_basics_switchtobodyfont{#specification}}} The token register \everybodyfont and \everyswitchtobodyfont take care for spaces: (still in font-ini.mkvi) %D {everybodyfont,Everybodyfont,everyglobalbodyfont} %D %D Every change in bodyfont size has conseqences for the baseline %D distance and skips between paragraphs. These are initialized %D in other modules. Here we only provide the hooks that %D garantees their handling. %D At the system level one can initialize thing like: %D %D \starttyping %D \appendtoks \setupspacing \to \everybodyfont %D \stoptyping In core-def.mkiv \appendtoks \synchronizelocallinespecs \to \everyswitchtobodyfont while spac-ver.mkiv \unexpanded\def\synchronizelocallinespecs {\bodyfontlineheight \normallineheight \bodyfontstrutheight\strutheight \bodyfontstrutdepth \strutdepth} -- luigi
Am 25.09.2013 um 21:54 schrieb Lars Huttar
On 9/24/2013 5:25 PM, Aditya Mahajan wrote:
On Tue, 24 Sep 2013, Lars Huttar wrote:
environment), and the second category only affects the "font" (and I'm still not clear on how the "body font" differs from the current font).
(Sorry for the terse replies...)
{\switchtobodyfont[14pt] Text $math$ \sans{Sans} \endgraf}
{\tfc Text $math$ \sans{Sans} \endgraf}
Aditya
I don't know how this answers the above question. Can anybody explain?
Clearly you're drawing a comparison between \switchtobodyfont[14pt] and \tfc. I've run the sample, and I see that, as in other samples earlier in this thread, \switchtobodyfont causes the interlinespace to be adjusted accordingly, and \tfc doesn't.
Is that intended to be an answer to 'how the "body font" differs from the current font'? And is the answer that the bodyfont is a conglomerate of more properties than just the font, including interlinespace?
You can’t expect from \tfa etc. to change the interlinespace because these commands can be used in your paragraphs to change the size of certain words only and in this case you don’t want a forced change of the interlinespace. To adapt the interlinespace when you now use \tfa etc. you have to add \setupinterlinespace to your code (arguments aren’t needed) to tell context to recalculate it. <example> \setuppapersize[A3] \starttext % Standard text size \begingroup \input ward \endgroup \blank % Bigger font size with standard linespacing \begingroup \tfd \the\bodyfontsize \input ward \endgroup \blank % Bigger font size with adapted linespacing \begingroup \tfd \setupinterlinespace \input ward \endgroup \blank % Larger bodyfont \begingroup \switchtobodyfont[25pt] \input ward \endgroup \stoptext </example> Wolfgang
Wolfgang, thanks for your response. On 9/25/2013 5:02 PM, Wolfgang Schuster wrote:
You can’t expect from \tfa etc. to change the interlinespace because these commands can be used in your paragraphs to change the size of certain words only and in this case you don’t want a forced change of the interlinespace.
Well... \switchtobodyfont[20pt] can also be used in paragraphs to change the size of just a few words. But the above suggests that \switchtobodyfont shouldn't be used for that purpose, and commands like \tfc should?
To adapt the interlinespace when you now use \tfa etc. you have to add \setupinterlinespace to your code (arguments aren’t needed) to tell context to recalculate it.
Thank you. What I'm trying to learn now is *why* that's true. Or more precisely, where is the boundary between the font-changing commands that automatically adjust interlinespace, and those commands that don't? and what is the conceptual model that motivates the boundary, and helps users remember and predict where the boundary lies? What I think I'm hearing is that \switchtobodyfont is intended for changes of longer duration, say, at least a paragraph. Whereas \tfa and so on are intended for brief changes, to set off a phrase, for example. As an example of "where's the boundary", experimentation shows that \setsmallbodyfont is in the same category as \switchtobodyfont: it automatically affects the interlinespace. Nevertheless I can't find anywhere in the manual or on the wiki that tells me that \setsmallbodyfont differs from \tx in this way (let alone *why* it differs). Maybe I should expect that any command that has "bodyfont" in its name is intended for long-term changes, and other commands aren't? Sorry if I'm being slow on the uptake. Documentation like http://wiki.contextgarden.net/Command/switchtobodyfont just doesn't seem to explain this difference in intention. Thanks again. I do hope to use this experience to contribute clarifications to the manual. I've already done that some on the wiki (hoping that if I get it wrong, someone will correct my mistakes!) Lars
Am 25.09.2013 um 23:45 schrieb Lars Huttar
Wolfgang, thanks for your response.
On 9/25/2013 5:02 PM, Wolfgang Schuster wrote:
You can’t expect from \tfa etc. to change the interlinespace because these commands can be used in your paragraphs to change the size of certain words only and in this case you don’t want a forced change of the interlinespace.
Well... \switchtobodyfont[20pt] can also be used in paragraphs to change the size of just a few words. But the above suggests that \switchtobodyfont shouldn't be used for that purpose, and commands like \tfc should?
You can use \switchtobodyfont to change the size for certain parts of a text but it’s best to keep this to a minimum because \tfa etc. are a lot faster. The reason why you don’t need \setupinterlinespace when you use \switchtobodyfont is that \setupinterlinespace is already called by \switchtobodyfont. Another thing which shouldn’t be forgotten is that \switchtobodyfont controls and changes the sizes for \tfa etc. Wolfgang
On 9/26/2013 3:47 PM, Wolfgang Schuster wrote:
Am 25.09.2013 um 23:45 schrieb Lars Huttar
: Wolfgang, thanks for your response.
You can’t expect from \tfa etc. to change the interlinespace because these commands can be used in your paragraphs to change the size of certain words only and in this case you don’t want a forced change of the interlinespace. Well... \switchtobodyfont[20pt] can also be used in paragraphs to change
On 9/25/2013 5:02 PM, Wolfgang Schuster wrote: the size of just a few words. But the above suggests that \switchtobodyfont shouldn't be used for that purpose, and commands like \tfc should? You can use \switchtobodyfont to change the size for certain parts of a text but it’s best to keep this to a minimum because \tfa etc. are a lot faster.
The reason why you don’t need \setupinterlinespace when you use \switchtobodyfont is that \setupinterlinespace is already called by \switchtobodyfont.
OK, good to know.
Another thing which shouldn’t be forgotten is that \switchtobodyfont controls and changes the sizes for \tfa etc.
Can you elaborate on that? A few days ago, Luigi wrote,
\tfc augment the fontsize of a factor of 1.728 It's relative to the default font size not to the current fontsize
So when he says "relative to the default font size", does that mean the same thing as "relative to the current body font size"? I think so. The following example shows that the function of \tfc is relative to the size set by \switchtobodyfont: {\tfc tfc \tfc tfc} {\switchtobodyfont[20pt] 20pt \tfc tfc} {\switchtobodyfont[6pt] 6pt \tfc tfc} Here the text after \tfc appears in three different sizes, proportional to (and larger than) the \switchtobodyfont setting in effect. However, the first line shows us that \tfc is *not* affected by previous effects of \tfc. So as Luigi said, there is a distinction between the current font size (which is affected by \tfc), and the "default font size" -- or maybe it should be described as "the current body font size" -- which is not affected by \tfc. Is that correct? So does \tfc mean "set the current font size to be three steps up from the current body font size"? Thanks. I'm contributing clarifications into the manual as I come to understand how things are designed to work. Lars
On 9/26/2013 3:47 PM, Wolfgang Schuster wrote:
You can use \switchtobodyfont to change the size for certain parts of a text but it’s best to keep this to a minimum because \tfa etc. are a lot faster.
The reason why you don’t need \setupinterlinespace when you use \switchtobodyfont is that \setupinterlinespace is already called by \switchtobodyfont.
Another thing which shouldn’t be forgotten is that \switchtobodyfont controls and changes the sizes for \tfa etc.
Wolfgang
To summarize this, and what I've learned from others on this list over the last week or two, I've updated the wiki page http://wiki.contextgarden.net/Font_Switching It's a pretty substantial change, so I hope someone knowledgeable will look at it and make sure it's right. I'm trying to find ways to express the fact that, as I understand it, there are two distinct concepts of "current font" in effect at any given time: 1) the bodyfont, which is set by \setupbodyfont or \switchtobodyfont 2) the "effective" font (is there a more standard term for this?) which is changed by \tfa, \ss, etc. \tfa etc. change the effective font based on what the bodyfont is. Anything that changes the bodyfont, such as \switchtobodyfont, also affects the linespacing. Just changing the effective font does not affect the linespacing. Changing the bodyfont changes the effective font. Does that give an accurate picture? Thanks, Lars
participants (4)
-
Aditya Mahajan
-
Lars Huttar
-
luigi scarso
-
Wolfgang Schuster