This works
\definefontfeature[default] [default] [mode=node,script=latn] \definefontfeature[smallcaps][smallcaps][mode=node,script=latn]
\usemodule[simplefonts]
\setmainfont[garamondpremrpro]
Thank you once again. That _did_ work, after I got rid of an \os (I used it because I saw it in the manual). The command \definefontfeature intrigues me greatly. I wonder if it could solve all my problems. I'd love to understand it so that I don't end up coming in here and asking you to write all my font setups line by line. I Googled it and found only a few scattered examples here and there, mostly from this list. I wish I could find an explanation of it written down somewhere. For example, I would very much like to know: 1. What the first two arguments do. 2. What keys and values are available for the third, and what they mean. 3. Once I have composed a \definefontfeature command, how do I use it in the text. 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. 5. How I could use the superior and inferior shapes in my font---like for the footnotemarks, for example? 6. Could I use \definefontfeature to set up the different design sizes of my font (I'm trying to use some standard Adobe fonts like Garamond Premiere Pro, which have design sizes), as well as its other features? 7. Maybe \definefontfeature is how I should turn on hz? I'm sure these things must be possible, but I'm stumped about how to find them out. -- m
On Fri, 12 Mar 2010, Michael Saunders wrote:
This works
\definefontfeature[default] [default] [mode=node,script=latn] \definefontfeature[smallcaps][smallcaps][mode=node,script=latn]
\usemodule[simplefonts]
\setmainfont[garamondpremrpro]
Thank you once again. That _did_ work, after I got rid of an \os (I used it because I saw it in the manual).
The command \definefontfeature intrigues me greatly. I wonder if it could solve all my problems. I'd love to understand it so that I don't end up coming in here and asking you to write all my font setups line by line. I Googled it and found only a few scattered examples here and there, mostly from this list. I wish I could find an explanation of it written down somewhere. For example, I would very much like to know:
Have you read the chapter on typography in the new manual http://context.aanhet.net/svn/contextman/context-reference/en/co-typography.... Aditya
On 12-3-2010 20:11, Michael Saunders wrote:
The command \definefontfeature intrigues me greatly. I wonder if it could solve all my problems. I'd love to understand it so that I don't end up coming in here and asking you to write all my font setups line by line. I Googled it and found only a few scattered examples here and there, mostly from this list. I wish I could find an explanation of it written down somewhere. For example, I would very much like to know:
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.
the mode=base|node determines if we use traditional tex mechanisms (base) or let mkiv do all work itself (node) there are also extra features and these are described on the wiki, in articles and mk.pdf and hybrid.pdf and once they are stable they will be properly documented
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
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
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
6. Could I use \definefontfeature to set up the different design sizes of my font (I'm trying to use some standard Adobe fonts like Garamond Premiere Pro, which have design sizes), as well as its other features?
i never looked into that as i don't have those fonts
7. Maybe \definefontfeature is how I should turn on hz?
sure, once it's implemented (probably no big deal but as said, i don't have those fonts)
I'm sure these things must be possible, but I'm stumped about how to find them out.
Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hi Michael, 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: It looks like you're only using mkiv. So: call a file type-garamondprem.tex. Here's what we will do: first, we want to find out what features our font offers. On my system: otfinfo -f ~/texmf/fonts/opentype/adobe/garmprem/GaramondPremrPro.otf aalt Access All Alternates c2sc Small Capitals From Capitals calt Contextual Alternates case Case-Sensitive Forms cpsp Capital Spacing dlig Discretionary Ligatures dnom Denominators fina Terminal Forms frac Fractions hist Historical Forms kern Kerning liga Standard Ligatures lnum Lining Figures numr Numerators onum Oldstyle Figures ordn Ordinals ornm Ornaments pnum Proportional Figures salt Stylistic Alternates sinf Scientific Inferiors size Optical Size smcp Small Capitals ss01 Stylistic Set 1 ss02 Stylistic Set 2 ss03 Stylistic Set 3 sups Superscript tnum Tabular Figures zero Slashed Zero You can enable these features with the four-letter-code and "yes." So we define a set of such features for the different font instances we want to define. In my case, I want regular text with oldstyle figures, small caps with lining figures, and superior numerals. This goes into your typescript: \definefontfeature [myroman] [protrusion=pure,expansion=quality,script=latn,liga=yes,onum=yes,pnum=yes,kern=yes,tlig=yes,trep=yes] \definefontfeature [mysmcp] [mode=node,script=latn,language=dflt,liga=yes,lnum=yes,tnum=yes,kern=yes,tlig=yes,trep=yes,smcp=yes] \definefontfeature [mysup] [mode=node,script=latn,onum=no,pnum=yes,sups=yes] 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 Finally, define your first typeface: \starttypescript [GaramondPrem] \definetypeface [GaramondPrem] [rm] [serif] [garamondprem] [default] \stoptypescript 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 \starttypescript [GaramondPremUpper] \definetypeface [GaramondPremUpper] [rm] [serif] [garamondpremupper] [default] \stoptypescript Save this typescript somewhere where ConTeXt can find it and run luatools --generate. To use these in your documents, you need these lines \usetypescriptfile[type-garamondprem] \usetypescript[GaramondPremUpper] \usetypsecript[GaramondPrem] \setupbodyfont[GaramondPrem,11pt] OK so far? On Mar 12, 2010, at 8:11 PM, Michael Saunders wrote:
Thank you once again. That _did_ work, after I got rid of an \os (I used it because I saw it in the manual).
The command \definefontfeature intrigues me greatly. I wonder if it could solve all my problems. I'd love to understand it so that I don't end up coming in here and asking you to write all my font setups line by line. I Googled it and found only a few scattered examples here and there, mostly from this list. I wish I could find an explanation of it written down somewhere. For example, I would very much like to know:
1. What the first two arguments do. 2. What keys and values are available for the third, and what they mean.
See above: all the font features your font offers.
3. Once I have composed a \definefontfeature command, how do I use it in the text. 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.
You can write {\sc 123} (because your smallcap font has lining figures). \os is tied to math and creates problems when used with professional fonts that don't have an accompanying math font.
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]}]
6. Could I use \definefontfeature to set up the different design sizes of my font (I'm trying to use some standard Adobe fonts like Garamond Premiere Pro, which have design sizes), as well as its other features?
I haven't yet played with this, sorry.
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 HTH Thomas
Am 12.03.10 21:11, schrieb Thomas A. Schmitz:
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
\setupalign[hanging,hz] Wolfgang
Hi!
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]}]
Or: \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. Greetings Andreas
Am 12.03.10 21:11, schrieb Thomas A. Schmitz:
6. Could I use \definefontfeature to set up the different design sizes of my font (I'm trying to use some standard Adobe fonts like Garamond Premiere Pro, which have design sizes), as well as its other features?
I haven't yet played with this, sorry.
On 12-3-2010 21:38, Wolfgang Schuster wrote:
Am 12.03.10 21:11, schrieb Thomas A. Schmitz:
6. Could I use \definefontfeature to set up the different design sizes of my font (I'm trying to use some standard Adobe fonts like Garamond Premiere Pro, which have design sizes), as well as its other features? I haven't yet played with this, sorry. http://wiki.contextgarden.net/Optical_Size
ok, i was thinking of embedded optical sized (i.e. one font file that has several sizes) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Sat, Mar 13, 2010 at 06:35:30AM +0100, Wolfgang Schuster wrote:
ok, i was thinking of embedded optical sized (i.e. one font file that has several sizes) Is there anything besides different sizes in opentype math fonts and
Am 12.03.10 23:29, schrieb Hans Hagen: the ruby feature in cjk fonts?
OpenType fonts can set a size feature, setting the optical size of the font and the size range in which it is used, so different font files in the same family with different optical sizes can be set (like LM). http://www.microsoft.com/typography/otspec/features_pt.htm#size But I don't think there is support for a single font file with different optical sizes. Fontloader already expose the size info if present, we wrote some code for LaTeX that loads the best optical size automatically based on the requested font size, it isn't that hard. Regards, Khaled -- Khaled Hosny Arabic localiser and member of Arabeyes.org team Free font developer
On 13-3-2010 7:19, Khaled Hosny wrote:
On Sat, Mar 13, 2010 at 06:35:30AM +0100, Wolfgang Schuster wrote:
ok, i was thinking of embedded optical sized (i.e. one font file that has several sizes) Is there anything besides different sizes in opentype math fonts and
Am 12.03.10 23:29, schrieb Hans Hagen: the ruby feature in cjk fonts?
OpenType fonts can set a size feature, setting the optical size of the font and the size range in which it is used, so different font files in the same family with different optical sizes can be set (like LM). http://www.microsoft.com/typography/otspec/features_pt.htm#size But I don't think there is support for a single font file with different optical sizes.
ah
Fontloader already expose the size info if present, we wrote some code for LaTeX that loads the best optical size automatically based on the requested font size, it isn't that hard.
sure, it's no big deal to support it, but as said .. i don't have such fonts (and i don't want illegal copies on my machine) so i haven't looked into it; also, for the few cases that are there, typescripts can cover it (if it concerns different font files) .. if it crosses out paths wolfgang and i can add it to the mkiv heuristics handler Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Am 13.03.10 13:16, schrieb Hans Hagen:
Fontloader already expose the size info if present, we wrote some code for LaTeX that loads the best optical size automatically based on the requested font size, it isn't that hard. sure, it's no big deal to support it, but as said .. i don't have such fonts (and i don't want illegal copies on my machine) so i haven't looked into it; also, for the few cases that are there, typescripts can cover it (if it concerns different font files) .. if it crosses out paths wolfgang and i can add it to the mkiv heuristics handler ConTeXt already has the relevant information (designsize, minsize and maxsize in the font database) and i have a few test files which use them.
Wolfgang
On 13-3-2010 13:26, Wolfgang Schuster wrote:
Am 13.03.10 13:16, schrieb Hans Hagen:
Fontloader already expose the size info if present, we wrote some code for LaTeX that loads the best optical size automatically based on the requested font size, it isn't that hard. sure, it's no big deal to support it, but as said .. i don't have such fonts (and i don't want illegal copies on my machine) so i haven't looked into it; also, for the few cases that are there, typescripts can cover it (if it concerns different font files) .. if it crosses out paths wolfgang and i can add it to the mkiv heuristics handler ConTeXt already has the relevant information (designsize, minsize and maxsize in the font database) and i have a few test files which use them.
ok, so we take care of it already (sort of) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Am 13.03.2010 um 13:26 schrieb Wolfgang Schuster:
Am 13.03.10 13:16, schrieb Hans Hagen:
Fontloader already expose the size info if present, we wrote some code for LaTeX that loads the best optical size automatically based on the requested font size, it isn't that hard. sure, it's no big deal to support it, but as said .. i don't have such fonts (and i don't want illegal copies on my machine) so i haven't looked into it; also, for the few cases that are there, typescripts can cover it (if it concerns different font files) .. if it crosses out paths wolfgang and i can add it to the mkiv heuristics handler ConTeXt already has the relevant information (designsize, minsize and maxsize in the font database) and i have a few test files which use them.
Hello Wolfgang, would you provide an example of how to use this information? Thank you in advance Andreas
Am 13.03.10 14:27, schrieb Andreas Harder:
would you provide an example of how to use this information?
font-ini.mkiv %D some low level helpers %D %D \starttyping %D \def\TestLookup#1% %D {\dolookupfontbyspec{#1} %D pattern: #1, found: \dolookupnoffound %D \blank %D \dorecurse {\dolookupnoffound} {% %D \recurselevel:~\dolookupgetkeyofindex{fontname}{\recurselevel}\quad %D }% %D \blank} %D %D \TestLookup{familyname=helveticaneue} %D \TestLookup{familyname=helveticaneue,weight=bold} %D \TestLookup{familyname=helveticaneue,weight=bold,style=italic} %D \stoptyping You can ask ConTeXt to look for a font in it's database with the keys - familyname (e.g. TeX Gyre Pagella or Latin Modern Roman) - weight (normal, bold, light, medium etc.) - style (normal, italic) - variant (normal, smallcaps) - fontname (e.g. texgyrepagellaregular) - ... The information in the database are not always perfect (because fonts are a mess) but I'll try to improve this in the next time. Wolfgang
Am 13.03.2010 um 17:17 schrieb Wolfgang Schuster:
Am 13.03.10 14:27, schrieb Andreas Harder:
would you provide an example of how to use this information?
font-ini.mkiv
%D some low level helpers %D %D \starttyping %D \def\TestLookup#1% %D {\dolookupfontbyspec{#1} %D pattern: #1, found: \dolookupnoffound %D \blank %D \dorecurse {\dolookupnoffound} {% %D \recurselevel:~\dolookupgetkeyofindex{fontname}{\recurselevel}\quad %D }% %D \blank} %D %D \TestLookup{familyname=helveticaneue} %D \TestLookup{familyname=helveticaneue,weight=bold} %D \TestLookup{familyname=helveticaneue,weight=bold,style=italic} %D \stoptyping
You can ask ConTeXt to look for a font in it's database with the keys
- familyname (e.g. TeX Gyre Pagella or Latin Modern Roman) - weight (normal, bold, light, medium etc.) - style (normal, italic) - variant (normal, smallcaps) - fontname (e.g. texgyrepagellaregular) - …
Thank you Wolfgang! I've played with it, but with \TestLookup{familyname=minionpro,designsize=11pt} no fonts are found. By the way, is luaTeX able to use ttc-fonts? Andreas
Am 13.03.10 17:59, schrieb Andreas Harder:
I've played with it, but with \TestLookup{familyname=minionpro,designsize=11pt} no fonts are found.
Values are passed from to to Lua as string and the size is a number, what i do is to ask for the font only and loop where i check the size of the font. \dorecurse {\dolookupnoffound} {\dolookupgetkeyofindex{designsize}{\recurselevel}} % minsize, maxsize Fonts use a different system for the size a value of 100 stands for 10pt, 120 for 12pt etc. You should be also know that fonts are not perfect and in *many* cases fonts without optical size use '0' as value for the size.
By the way, is luaTeX able to use ttc-fonts?
Yes but a few fonts in snow leopard have problems. Wolfgang
participants (7)
-
Aditya Mahajan
-
Andreas Harder
-
Hans Hagen
-
Khaled Hosny
-
Michael Saunders
-
Thomas A. Schmitz
-
Wolfgang Schuster