Aditya Mahajan:
Have you read the chapter on typography in the new manual http://context.aanhet.net/svn/contextman/context-reference/en/co-typography....
Yes. Several times. And I took notes. ------------------------------ Hans Hagen:
1. What the first two arguments do.
the mode=base|node determines if we use traditional tex mechanisms (base) or let mkiv do all work itself (node)
2. What keys and values are available for the third, and what they mean.
Thank you, but by "the first two arguments", I mean 1 and 2 of: \definefontfeature [1][2][3]. For example, in \definefontfeature[smallcaps][smallcaps][script=latn] I don't know what "[smallcaps][smallcaps]" is doing.
3. Once I have composed a \definefontfeature command, how do I use it in the text.
not in the text, only when defining fonts; although you can enable and disable features in the running text (dynamicly) .. from the source:
% \startbuffer % \definefontfeature[smallcaps][smallcaps][script=latn] % \definefontfeature[oldstyle] [oldstyle] [script=latn] % % \definedfont[name:cambria at 15pt] % % Hello there {\setff{smallcaps}capped 123 \setff{oldstyle}123!} \blank % Hello there {\addff{smallcaps}capped 123 \addff{oldstyle}123!} \blank % Hello there {\addff{smallcaps}capped \subff{smallcaps}normal} \blank % \stopbuffer % % \typebuffer \getbuffer
Naturally, I don't know what any of this code means (which is why I seek a human language explanation), but I'm guessing that in \definefontfeature[oldstyle] [oldstyle] [script=latn] the first "[oldstyle]" creates a command or variable called "oldstyle", the second "[oldstyle]" relates this to something else (another command or variable, maybe a font file) which is also called "oldstyle", and the key-value pair "[script=latn]"qualifies this, selecting the only the Latin part of the second "[oldstyle]". (And, by the way, my font has Greek and Cyrillic as well---why disable oldstyle in them?) I think that leaves me with a command or variable or something called "oldstyle", which I could include in the text. My first guess would have been that it's "\oldstyle", but, later in your code snippet, I see "\setff{smallcaps}" and "\addff{smallcaps}". There's no telling what the difference is. So, I'm left guessing that \definefontfeature[oldstyle] [oldstyle] [script=latn] creates a possible argument for \setff{} and \addff{}, whatever they are. They might be the commands for font switching in the text. Since the code snippet isn't a human explanation, however, I can't tell--- I can only make wild guesses.
4. For example, I gathered that I needed a [default] [default] [...onum=yes...] to get oldstyle numerals by default, but what if I want to use some lining numerals here and there? \definefontfeature [lining] [lining] [...onum=no...] {\lining 123} doesn't do it.
lnum=yes
I tried this, and \definefontfeature [lining] [lining] [lnum=yes] {\lining 123} still gives me "undefined control sequence" on \lining. I also tried {\switchtobodyfont [lining] 123}, which had no effect.
5. How I could use the superior and inferior shapes in my font---like for the footnotemarks, for example?
hm, with sups=yes,subs=yes i guess but better use \high{..} and \low{..} as often such font features are rather limited and depend on the font
I'll have to try that out (since I know which fonts have them), but: \definefontfeature [?] [?] [sups=yes,subs=yes] ? ------------------------------ Thomas A. Schmitz:
This is not to disparage Wolfgang's great simplefonts module, but I learnt setting up fonts the old-fashioned way (with typescripts), so I will give a few explanations about this approach. Most of what you want can be achieved easily. I have Garamond Premier myself, and this is how I set it up:
Thank you, this is very encouraging. I used to do this with otftotfm and .fd files, so it's not totally alien to me. I just need to grasp the syntax of the Context commands. I've been pouring over your example. There are a few points I still don't understand. ...
Next step: we set up the "normal" and smallcaps font:
\starttypescript [serif] [garamondprem] \definefontsynonym [Garamond-Roman] [name:garamondpremierpro] [features=myroman] \definefontsynonym [Garamond-Bold] [name:garamondpremierprobold] [features=myroman] \definefontsynonym [Garamond-Italic] [name:garamondpremierproitalic] [features=myroman] \definefontsynonym [Garamond-Bold-Italic] [name:garamondpremierprobolditalicc] [features=myroman] \definefontsynonym [Garamond-SmallCaps] [name:garamondpremierpro] [features=mysmcp] \stoptypescript
\starttypescript [serif] [garamondprem] \definefontsynonym [Serif] [Garamond-Roman] [features=myroman] \definefontsynonym [SerifItalic] [Garamond-Italic] [features=myroman] \definefontsynonym [SerifBold] [Garamond-Bold] [features=myroman] \definefontsynonym [SerifBoldItalic] [Garamond-Bold-Italic] [features=myroman] \definefontsynonym [SerifCaps] [Garamond-SmallCaps] [features=mysmcp] \stoptypescript
I don't understand the syntax of \starttypescript. It doesn't appear in the manual. It occurs twice in the "typography" document. In both cases the first argument appears to be the name of the typescript. In one example, there is only one argument, and in the other example, the second argument appears to be a list of encodings. Since everything is now utf-8, I guess that could be forgotten. So, in your example here, I take "serif" to be the name of both typsecripts, but I don't know what [garamondprem] is doing. It's never spelled out, but from looking at examples of \definefontsynonym [1][2] in the docs, I think it means something like "what we used to call 2 we can now call 1", i.e., telling the machine to replace instances of "1" with "2". If this is the case, your third arguments above just seem to apply your features to the fonts referred to, which makes sense. I don't see, though, why this has to be done twice, and with an extra layer of misdirection. E.g., instead of: \definefontsynonym [Garamond-Roman] [name:garamondpremierpro] [features=myroman] \definefontsynonym [Serif] [Garamond-Roman] [features=myroman] why not just: \definefontsynonym [Serif] [name:garamondpremierpro] [features=myroman]? I think the purpose of the above step is to connect identifiers like "Serif" to a qualified font file.
Finally, define your first typeface:
\starttypescript [GaramondPrem] \definetypeface [GaramondPrem] [rm] [serif] [garamondprem] [default] \stoptypescript
I think this is a typescript called GaramondPrem that contains a typeface called GaramondPrem. It seems a little redundant that they have the same name. I know that the typescripts are referred to by \usetypescript, but I don't know where typefaces are referred to, so maybe it's just a dummy argument. The "[rm]" seems to be what links this to the font switching command, and the "[garamondprem]" obviously refers to both the typescripts you defined above. I don't understand what the "[serif]" is doing. In the typography manual, Hans says, "The third and fourth arguments to \definetypeface are pointers to already declared font sets; these are defined elsewhere." I think by "font set" he must mean a typescript like garamondprem, but I don't know where the font set (typescript?) "serif" is or why two font sets need to be pointed to. The same typography document goes on to explain the fifth argument: "The fifth argument to \definetypeface specifies specific font size setups (if any), these will be covered in section ?? in the next chapter." This is getting scary, but I'm hoping putting "[optical]" there will solve everything.
Next step: defining a typeface with superior numbers for footnote references etc.:
\starttypescript [serif] [garamondpremupper] \definefontsynonym [GaramondPremUpper-Roman] [name:agaramondproregular] [features=mysup] \stoptypescript
\starttypescript [serif] [garamondpremupper] \definefontsynonym [Serif] [GaramondPremUpper-Roman] [features=mysup] \definefontsynonym [SerifItalic] [Serif] \definefontsynonym [SerifBold] [Serif] \definefontsynonym [SerifBoldItalic] [Serif] \definefontsynonym [SerifCaps] [Serif] \stoptypescript
I think I follow you, up to the line: \definefontsynonym [SerifItalic] [Serif]. These last lines seem to say that if you're in bold or italic, that you should still use regular superior figures, but the font has its own bold and italic superiors. I think that's true of all the weight/shape/design size variations in the set.
\starttypescript [GaramondPremUpper] \definetypeface [GaramondPremUpper] [rm] [serif] [garamondpremupper] [default] \stoptypescript
I'm confused about how [GaramondPremUpper] and [garamondpremupper] seem to be getting associated with [rm] and [serif] after they were already associated with [GaramondPrem] and [garamondprem]. I don't see how, when I now use \rm, the machine is going to know whether I mean garamondpremupper or garamondprem. The rest of the file seems straightforward.
OK so far?
Thank you---that brought me a lot closer to understanding! after saving your example and running luatools --generate, I put the last lines in my test document and tried running Context on it in the usual way. I get the error: !undefined control sequence <recently read> \usetypescript l.12 \usetypescript [GaramondPrem]
5. How I could use the superior and inferior shapes in my font---like for the footnotemarks, for example?
You have defined a font instance with superiors. To use it, set up your footnotes accordingly:
\setupfootnotes[textstyle=normal, textcommand={\switchtobodyfont[GaramondPremUpper]}, numbercommand={\switchtobodyfont[GaramondPremUpper]}]
7. Maybe \definefontfeature is how I should turn on hz?
With the fontfeature, we have defined to use protrusion=pure,expansion=quality . To enable it, put this in the preamble of your document:
\enableprotruding \enableadjusting
I'll try these when I get things working. Thanks again. ------------------------------ Wolfgang Schuster:
\setupalign[hanging,hz]
Or maybe I'll try that. ------------------------------ Andreas Harder:
5. How I could use the superior and inferior shapes in my font---like for the footnotemarks, for example?
\definefontfeature [sups] [default] [sups=yes]
\setupnote [footnote] [command=, % -> numbercommand textstyle=, % -> textcommand numbercommand=\setff{sups}, % use superscript-figures textcommand=\setff{sups}]
So you don't have to define GaramondPremUpper.
Thank you. With this, the marks in the text look good, the ones at the bottom (with the footnotes) look absurdly small. I suspect this might be because they have been optically scaled down, not switched to the smaller design size, so they seem to evaporate. They might look better if they remain the same size as in the text, I'm not sure. ------------------------------ Wolfgang Schuster: http://wiki.contextgarden.net/Optical_Size Ahhh, the rest of my weekend. Thank you. -- m
Am 13.03.10 17:09, schrieb Michael Saunders:
2. What keys and values are available for the third, and what they mean.
Thank you, but by "the first two arguments", I mean 1 and 2 of: \definefontfeature [1][2][3]. For example, in \definefontfeature[smallcaps][smallcaps][script=latn] I don't know what "[smallcaps][smallcaps]" is doing.
Let's start with the normal version \definefontfeature[default][liga=yes,kern=yes,tlig=yes,trep=yes] creates a list with the name 'default' (predefined by context and used by default for all fonts if not specified otherwise) with the opentype features liga (ligature), kern (kerning) and the pseudo tex features tlig (-- -> –, --- -> —) and trep (' -> ’). This feature is now applied to font in a typescript (ConTeXt system map font files to commands, e.g. when you write \bf in your document your get Times New Roman Bold). In the extended version with three arguments you copy the list from the second argument to the new list which name is given in the first argument and you can add new opentype features to the list, e.g. \definefontfeature[mine][default][onum=yes] creates the new list mine which inherits all features from default and adds onum to the list, when the name in the first and second arguments are equal you extend a already created list with additional features. Wolfgang
On Mar 13, 2010, at 5:09 PM, Michael Saunders wrote:
I don't understand the syntax of \starttypescript. It doesn't appear in the manual. It occurs twice in the "typography" document. In both cases the first argument appears to be the name of the typescript. In one example, there is only one argument, and in the other example, the second argument appears to be a list of encodings. Since everything is now utf-8, I guess that could be forgotten. So, in your example here, I take "serif" to be the name of both typsecripts, but I don't know what [garamondprem] is doing.
We're talking about mkiv here, so we don't need to worry about encodings (which is a confusing topic - utf8 is not a font encoding, but an input encoding; these two are not identical). A typescript file can contain a series of typeface definitions, e.g., one for serif, one for sans, one for mono, one for math, etc. hence the syntax \starttypescript [<typeface>] [<identifier>]
It's never spelled out, but from looking at examples of \definefontsynonym [1][2] in the docs, I think it means something like "what we used to call 2 we can now call 1", i.e., telling the machine to replace instances of "1" with "2". If this is the case, your third arguments above just seem to apply your features to the fonts referred to, which makes sense. I don't see, though, why this has to be done twice, and with an extra layer of misdirection. E.g., instead of: \definefontsynonym [Garamond-Roman] [name:garamondpremierpro] [features=myroman] \definefontsynonym [Serif] [Garamond-Roman] [features=myroman] why not just: \definefontsynonym [Serif] [name:garamondpremierpro] [features=myroman]?
I think the purpose of the above step is to connect identifiers like "Serif" to a qualified font file.
You could indeed write typescripts without the extra layer of abstraction. It just may make it easier if you want to mix different fonts etc.
Finally, define your first typeface:
\starttypescript [GaramondPrem] \definetypeface [GaramondPrem] [rm] [serif] [garamondprem] [default] \stoptypescript
I think this is a typescript called GaramondPrem that contains a typeface called GaramondPrem. It seems a little redundant that they have the same name.
You can use two different names, if you prefer.
I know that the typescripts are referred to by \usetypescript, but I don't know where typefaces are referred to, so maybe it's just a dummy argument.
In the \usebodyfont or \switchtobodyfont commands.
The "[rm]" seems to be what links this to the font switching command, and the "[garamondprem]" obviously refers to both the typescripts you defined above. I don't understand what the "[serif]" is doing. In the typography manual, Hans says, "The third and fourth arguments to \definetypeface are pointers to already declared font sets; these are defined elsewhere." I think by "font set" he must mean a typescript like garamondprem, but I don't know where the font set (typescript?) "serif"
As I said: there's at least serif, sans, mono, math
is or why two font sets need to be pointed to.
???
The same typography document goes on to explain the fifth argument: "The fifth argument to \definetypeface specifies specific font size setups (if any), these will be covered in section ?? in the next chapter." This is getting scary, but I'm hoping putting "[optical]" there will solve everything.
I don't follow.
Next step: defining a typeface with superior numbers for footnote references etc.:
\starttypescript [serif] [garamondpremupper] \definefontsynonym [GaramondPremUpper-Roman] [name:agaramondproregular] [features=mysup] \stoptypescript
\starttypescript [serif] [garamondpremupper] \definefontsynonym [Serif] [GaramondPremUpper-Roman] [features=mysup] \definefontsynonym [SerifItalic] [Serif] \definefontsynonym [SerifBold] [Serif] \definefontsynonym [SerifBoldItalic] [Serif] \definefontsynonym [SerifCaps] [Serif] \stoptypescript
I think I follow you, up to the line: \definefontsynonym [SerifItalic] [Serif]. These last lines seem to say that if you're in bold or italic, that you should still use regular superior figures, but the font has its own bold and italic superiors. I think that's true of all the weight/shape/design size variations in the set.
It depends what you want to achieve. I map everything onto Serif because I do not want the superior numbers to be bold or italic, even in an italic environment. Of course, you can define something for all these variants.
\starttypescript [GaramondPremUpper] \definetypeface [GaramondPremUpper] [rm] [serif] [garamondpremupper] [default] \stoptypescript
I'm confused about how [GaramondPremUpper] and [garamondpremupper] seem to be getting associated with [rm] and [serif] after they were already associated with [GaramondPrem] and [garamondprem]. I don't see how, when I now use \rm, the machine is going to know whether I mean garamondpremupper or garamondprem. The rest of the file seems straightforward.
In ConTeXt, you are always within a certain bodyfont (the one defined with the \definetypeface command). A switch like \it or \rm will thus take the italic/roman from this bodyfont. Meaning: when you say \setubodyfont[GaramondPrem], it will use "normal" Garamond Premier, if you use \switchtobodyfont[GaramondPremUpper], it will use the superior numbers variant.
OK so far?
Thank you---that brought me a lot closer to understanding! after saving your example and running luatools --generate, I put the last lines in my test document and tried running Context on it in the usual way. I get the error: !undefined control sequence <recently read> \usetypescript l.12 \usetypescript [GaramondPrem]
Then we will need your example - this is not normal behavior. Thomas
participants (3)
-
Michael Saunders
-
Thomas A. Schmitz
-
Wolfgang Schuster