You have to use font Goodies to use design sizes. Font Goodies are Lua scripts which return a table with extra information about the font and are loaded at runtime. More about Goodies can be found in chapter 5.4 “Goodies” in Fonts out of ConTeXt (PDF).
garamond-premier.lfg
return {
name = "garamond-premier",
version = "1.00",
comment = "Goodies that complement Garamond Premier Pro.",
author = "Adobe",
copyright = "ConTeXt development team",
designsizes = {
["GaramondPremier-Regular"] = {
[ "4pt"] = "file:GaramondPremrPro-Capt.otf",
[ "5pt"] = "file:GaramondPremrPro-Capt.otf",
[ "6pt"] = "file:GaramondPremrPro-Capt.otf",
[ "7pt"] = "file:GaramondPremrPro.otf",
[ "8pt"] = "file:GaramondPremrPro.otf",
[ "9pt"] = "file:GaramondPremrPro.otf",
["10pt"] = "file:GaramondPremrPro.otf",
["11pt"] = "file:GaramondPremrPro.otf",
["12pt"] = "file:GaramondPremrPro.otf",
["13pt"] = "file:GaramondPremrPro-Subh.otf",
["14pt"] = "file:GaramondPremrPro-Subh.otf",
["15pt"] = "file:GaramondPremrPro-Subh.otf",
["16pt"] = "file:GaramondPremrPro-Subh.otf",
["17pt"] = "file:GaramondPremrPro-Subh.otf",
["18pt"] = "file:GaramondPremrPro-Subh.otf",
["19pt"] = "file:GaramondPremrPro-Subh.otf",
["20pt"] = "file:GaramondPremrPro-Disp.otf",
["21pt"] = "file:GaramondPremrPro-Disp.otf",
["22pt"] = "file:GaramondPremrPro-Disp.otf",
default = "file:GaramondPremrPro.otf",
},
["GaramondPremier-Italic"] = {
[ "4pt"] = "file:GaramondPremrPro-ItCapt.otf",
[ "5pt"] = "file:GaramondPremrPro-ItCapt.otf",
[ "6pt"] = "file:GaramondPremrPro-ItCapt.otf",
[ "7pt"] = "file:GaramondPremrPro-It.otf",
[ "8pt"] = "file:GaramondPremrPro-It.otf",
[ "9pt"] = "file:GaramondPremrPro-It.otf",
["10pt"] = "file:GaramondPremrPro-It.otf",
["11pt"] = "file:GaramondPremrPro-It.otf",
["12pt"] = "file:GaramondPremrPro-It.otf",
["13pt"] = "file:GaramondPremrPro-ItSubh.otf",
["14pt"] = "file:GaramondPremrPro-ItSubh.otf",
["15pt"] = "file:GaramondPremrPro-ItSubh.otf",
["16pt"] = "file:GaramondPremrPro-ItSubh.otf",
["17pt"] = "file:GaramondPremrPro-ItSubh.otf",
["18pt"] = "file:GaramondPremrPro-ItSubh.otf",
["19pt"] = "file:GaramondPremrPro-ItSubh.otf",
["20pt"] = "file:GaramondPremrPro-ItDisp.otf",
["21pt"] = "file:GaramondPremrPro-ItDisp.otf",
["22pt"] = "file:GaramondPremrPro-ItDisp.otf",
default = "file:GaramondPremrPro-It.otf",
},
["GaramondPremier-Bold"] = {
[ "4pt"] = "file:GaramondPremrPro-BdCapt.otf",
[ "5pt"] = "file:GaramondPremrPro-BdCapt.otf",
[ "6pt"] = "file:GaramondPremrPro-BdCapt.otf",
[ "7pt"] = "file:GaramondPremrPro-Bd.otf",
[ "8pt"] = "file:GaramondPremrPro-Bd.otf",
[ "9pt"] = "file:GaramondPremrPro-Bd.otf",
["10pt"] = "file:GaramondPremrPro-Bd.otf",
["11pt"] = "file:GaramondPremrPro-Bd.otf",
["12pt"] = "file:GaramondPremrPro-Bd.otf",
["13pt"] = "file:GaramondPremrPro-BdSubh.otf",
["14pt"] = "file:GaramondPremrPro-BdSubh.otf",
["15pt"] = "file:GaramondPremrPro-BdSubh.otf",
["16pt"] = "file:GaramondPremrPro-BdSubh.otf",
["17pt"] = "file:GaramondPremrPro-BdSubh.otf",
["18pt"] = "file:GaramondPremrPro-BdSubh.otf",
["19pt"] = "file:GaramondPremrPro-BdSubh.otf",
["20pt"] = "file:GaramondPremrPro-BdDisp.otf",
["21pt"] = "file:GaramondPremrPro-BdDisp.otf",
["22pt"] = "file:GaramondPremrPro-BdDisp.otf",
default = "file:GaramondPremrPro-Bd.otf",
},
["GaramondPremier-BoldItalic"] = {
[ "4pt"] = "file:GaramondPremrPro-BdItCapt.otf",
[ "5pt"] = "file:GaramondPremrPro-BdItCapt.otf",
[ "6pt"] = "file:GaramondPremrPro-BdItCapt.otf",
[ "7pt"] = "file:GaramondPremrPro-BdIt.otf",
[ "8pt"] = "file:GaramondPremrPro-BdIt.otf",
[ "9pt"] = "file:GaramondPremrPro-BdIt.otf",
["10pt"] = "file:GaramondPremrPro-BdIt.otf",
["11pt"] = "file:GaramondPremrPro-BdIt.otf",
["12pt"] = "file:GaramondPremrPro-BdIt.otf",
["13pt"] = "file:GaramondPremrPro-BdItSubh.otf",
["14pt"] = "file:GaramondPremrPro-BdItSubh.otf",
["15pt"] = "file:GaramondPremrPro-BdItSubh.otf",
["16pt"] = "file:GaramondPremrPro-BdItSubh.otf",
["17pt"] = "file:GaramondPremrPro-BdItSubh.otf",
["18pt"] = "file:GaramondPremrPro-BdItSubh.otf",
["19pt"] = "file:GaramondPremrPro-BdItSubh.otf",
["20pt"] = "file:GaramondPremrPro-BdItDisp.otf",
["21pt"] = "file:GaramondPremrPro-BdItDisp.otf",
["22pt"] = "file:GaramondPremrPro-BdItDisp.otf",
default = "file:GaramondPremrPro-BdIt.otf",
},
["GaramondPremier-Medium"] = {
[ "4pt"] = "file:GaramondPremrPro-MedCapt.otf",
[ "5pt"] = "file:GaramondPremrPro-MedCapt.otf",
[ "6pt"] = "file:GaramondPremrPro-MedCapt.otf",
[ "7pt"] = "file:GaramondPremrPro-Med.otf",
[ "8pt"] = "file:GaramondPremrPro-Med.otf",
[ "9pt"] = "file:GaramondPremrPro-Med.otf",
["10pt"] = "file:GaramondPremrPro-Med.otf",
["11pt"] = "file:GaramondPremrPro-Med.otf",
["12pt"] = "file:GaramondPremrPro-Med.otf",
["13pt"] = "file:GaramondPremrPro-MedSubh.otf",
["14pt"] = "file:GaramondPremrPro-MedSubh.otf",
["15pt"] = "file:GaramondPremrPro-MedSubh.otf",
["16pt"] = "file:GaramondPremrPro-MedSubh.otf",
["17pt"] = "file:GaramondPremrPro-MedSubh.otf",
["18pt"] = "file:GaramondPremrPro-MedSubh.otf",
["19pt"] = "file:GaramondPremrPro-MedSubh.otf",
["20pt"] = "file:GaramondPremrPro-MedDisp.otf",
["21pt"] = "file:GaramondPremrPro-MedDisp.otf",
["22pt"] = "file:GaramondPremrPro-MedDisp.otf",
default = "file:GaramondPremrPro-Med.otf",
},
["GaramondPremier-MediumItalic"] = {
[ "4pt"] = "file:GaramondPremrPro-MedItCapt.otf",
[ "5pt"] = "file:GaramondPremrPro-MedItCapt.otf",
[ "6pt"] = "file:GaramondPremrPro-MedItCapt.otf",
[ "7pt"] = "file:GaramondPremrPro-MedIt.otf",
[ "8pt"] = "file:GaramondPremrPro-MedIt.otf",
[ "9pt"] = "file:GaramondPremrPro-MedIt.otf",
["10pt"] = "file:GaramondPremrPro-MedIt.otf",
["11pt"] = "file:GaramondPremrPro-MedIt.otf",
["12pt"] = "file:GaramondPremrPro-MedIt.otf",
["13pt"] = "file:GaramondPremrPro-MedItSubh.otf",
["14pt"] = "file:GaramondPremrPro-MedItSubh.otf",
["15pt"] = "file:GaramondPremrPro-MedItSubh.otf",
["16pt"] = "file:GaramondPremrPro-MedItSubh.otf",
["17pt"] = "file:GaramondPremrPro-MedItSubh.otf",
["18pt"] = "file:GaramondPremrPro-MedItSubh.otf",
["19pt"] = "file:GaramondPremrPro-MedItSubh.otf",
["20pt"] = "file:GaramondPremrPro-MedItDisp.otf",
["21pt"] = "file:GaramondPremrPro-MedItDisp.otf",
["22pt"] = "file:GaramondPremrPro-MedItDisp.otf",
default = "file:GaramondPremrPro-MedIt.otf",
},
["GaramondPremier-Semibold"] = {
[ "4pt"] = "file:GaramondPremrPro-SmbdCapt.otf",
[ "5pt"] = "file:GaramondPremrPro-SmbdCapt.otf",
[ "6pt"] = "file:GaramondPremrPro-SmbdCapt.otf",
[ "7pt"] = "file:GaramondPremrPro-Smbd.otf",
[ "8pt"] = "file:GaramondPremrPro-Smbd.otf",
[ "9pt"] = "file:GaramondPremrPro-Smbd.otf",
["10pt"] = "file:GaramondPremrPro-Smbd.otf",
["11pt"] = "file:GaramondPremrPro-Smbd.otf",
["12pt"] = "file:GaramondPremrPro-Smbd.otf",
["13pt"] = "file:GaramondPremrPro-SmbdSubh.otf",
["14pt"] = "file:GaramondPremrPro-SmbdSubh.otf",
["15pt"] = "file:GaramondPremrPro-SmbdSubh.otf",
["16pt"] = "file:GaramondPremrPro-SmbdSubh.otf",
["17pt"] = "file:GaramondPremrPro-SmbdSubh.otf",
["18pt"] = "file:GaramondPremrPro-SmbdSubh.otf",
["19pt"] = "file:GaramondPremrPro-SmbdSubh.otf",
["20pt"] = "file:GaramondPremrPro-SmbdDisp.otf",
["21pt"] = "file:GaramondPremrPro-SmbdDisp.otf",
["22pt"] = "file:GaramondPremrPro-SmbdDisp.otf",
default = "file:GaramondPremrPro-Smbd.otf",
},
["GaramondPremier-SemiboldItalic"] = {
[ "4pt"] = "file:GaramondPremrPro-SmbdItCapt.otf",
[ "5pt"] = "file:GaramondPremrPro-SmbdItCapt.otf",
[ "6pt"] = "file:GaramondPremrPro-SmbdItCapt.otf",
[ "7pt"] = "file:GaramondPremrPro-SmbdIt.otf",
[ "8pt"] = "file:GaramondPremrPro-SmbdIt.otf",
[ "9pt"] = "file:GaramondPremrPro-SmbdIt.otf",
["10pt"] = "file:GaramondPremrPro-SmbdIt.otf",
["11pt"] = "file:GaramondPremrPro-SmbdIt.otf",
["12pt"] = "file:GaramondPremrPro-SmbdIt.otf",
["13pt"] = "file:GaramondPremrPro-SmbdItSubh.otf",
["14pt"] = "file:GaramondPremrPro-SmbdItSubh.otf",
["15pt"] = "file:GaramondPremrPro-SmbdItSubh.otf",
["16pt"] = "file:GaramondPremrPro-SmbdItSubh.otf",
["17pt"] = "file:GaramondPremrPro-SmbdItSubh.otf",
["18pt"] = "file:GaramondPremrPro-SmbdItSubh.otf",
["19pt"] = "file:GaramondPremrPro-SmbdItSubh.otf",
["20pt"] = "file:GaramondPremrPro-SmbdItDisp.otf",
["21pt"] = "file:GaramondPremrPro-SmbdItDisp.otf",
["22pt"] = "file:GaramondPremrPro-SmbdItDisp.otf",
default = "file:GaramondPremrPro-SmbdIt.otf",
},
},
}
type-imp-garamond-premier.mkiv
\starttypescriptcollection[garamond-premier]
\starttypescript [serif] [garamond-premier] [all]
\loadfontgoodies[garamond-premier]
\definefontsynonym [Serif] [GaramondPremier-Regular] [features=default,goodies=garamond-premier]
\definefontsynonym [SerifItalic] [GaramondPremier-Italic] [features=default,goodies=garamond-premier]
\definefontsynonym [SerifSlanted] [SerifItalic]
\definefontsynonym [SerifBold] [GaramondPremier-Bold] [features=default,goodies=garamond-premier]
\definefontsynonym [SerifBoldItalic] [GaramondPremier-BoldItalic] [features=default,goodies=garamond-premier]
\definefontsynonym [SerifBoldSlanted] [SerifBoldItalic]
\definefontsynonym [SerifMedium] [GaramondPremier-Medium] [features=default,goodies=garamond-premier]
\definefontsynonym [SerifMediumItalic] [GaramondPremier-MediumItalic] [features=default,goodies=garamond-premier]
\definefontsynonym [SerifMediumSlanted] [SerifMediumItalic]
\definefontsynonym [SerifSemibold] [GaramondPremier-Semibold] [features=default,goodies=garamond-premier]
\definefontsynonym [SerifSemiboldItalic] [GaramondPremier-SemiboldItalic] [features=default,goodies=garamond-premier]
\definefontsynonym [SerifSemiboldSlanted] [SerifSemiboldItalic]
\definefontsynonym [SerifCaps] [Serif] [features=smallcaps]
\stoptypescript
\starttypescript [garamond-premier]
\definetypeface [\typescriptone] [rm] [serif] [\typescriptone] [default] [designsize=auto]
\definetypeface [\typescriptone] [ss] [sans] [dejavu] [default] [rscale=0.8]
\definetypeface [\typescriptone] [tt] [mono] [dejavu] [default] [rscale=0.8]
\definetypeface [\typescriptone] [mm] [math] [dejavu] [default] [rscale=0.8]
\stoptypescript
\stoptypescriptcollection
You probably want to use a sans-serif, mono, and math font other than DejaVu. I just added them here for completeness. You should not leave any of these out because if you attempt to use them and they are not defined, strange things happen.
Font alternative can only have two letters, because ConTeXt will use anything after it as the size specifier, as the b
in \tfb
.
Then you can use this in your document via
\loadtypescriptfile[garamond-premier]
\definefontalternative[mf]
\definefontalternative[mi]
\definefontalternative[ms]
\definefontalternative[sf]
\definefontalternative[si]
\definefontalternative[ss]
\definebodyfont [default] [rm]
[tf=Serif sa 1,
bf=SerifBold sa 1,
it=SerifItalic sa 1,
sl=SerifSlanted sa 1,
bi=SerifBoldItalic sa 1,
bs=SerifBoldSlanted sa 1,
sc=SerifCaps sa 1,
%
mf=SerifMedium sa 1,
mi=SerifMediumItalic sa 1,
ms=SerifMediumSlanted sa 1,
%
sf=SerifSemibold sa 1,
si=SerifSemiboldItalic sa 1,
ss=SerifSemiboldSlanted sa 1]
\stoptypescript
\setupbodyfont[garamond-premier]
\setuppapersize [A4,landscape]
\starttext
\dorecurse{22}{
\switchtobodyfont[\recurselevel pt]
\recurselevel\
Regular
\italic{Italic}
\bold{Bold}
\bolditalic{Bold italic}
{\mf Medium}
{\mi Medium italic}
{\sf Semibold}
{\si Semibold italic}
\par
}
\stoptext

As you can see, this does not look really continuous. This is because I have guessed the values at which the different design sizes should be used. In production, one should carefully fine tune these to achieve a more continuous behaviour.
The output of pdffonts
confirms that all fonts are embedded.
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
EKDZXO+GaramondPremrPro-Capt CID Type 0C Identity-H yes yes yes 4 0
HXIZMD+GaramondPremrPro-ItCapt CID Type 0C Identity-H yes yes yes 5 0
YCEHGM+GaramondPremrPro-BdCapt CID Type 0C Identity-H yes yes yes 6 0
LXMWZN+GaramondPremrPro-BdItCapt CID Type 0C Identity-H yes yes yes 7 0
YSTBXJ+GaramondPremrPro-MedCapt CID Type 0C Identity-H yes yes yes 8 0
UZWASV+GaramondPremrPro-MedItCapt CID Type 0C Identity-H yes yes yes 9 0
BCZEUK+GaramondPremrPro-SmbdCapt CID Type 0C Identity-H yes yes yes 10 0
ULHHSI+GaramondPremrPro-SmbdItCapt CID Type 0C Identity-H yes yes yes 11 0
KYSIQC+GaramondPremrPro CID Type 0C Identity-H yes yes yes 12 0
ZQKUVZ+GaramondPremrPro-It CID Type 0C Identity-H yes yes yes 13 0
NEOZVY+GaramondPremrPro-Bd CID Type 0C Identity-H yes yes yes 14 0
JHIVFR+GaramondPremrPro-BdIt CID Type 0C Identity-H yes yes yes 15 0
EMFOVD+GaramondPremrPro-Subh CID Type 0C Identity-H yes yes yes 16 0
DAPJGX+GaramondPremrPro-ItSubh CID Type 0C Identity-H yes yes yes 17 0
NBZBXV+GaramondPremrPro-BdSubh CID Type 0C Identity-H yes yes yes 18 0
EEPVVZ+GaramondPremrPro-BdItSubh CID Type 0C Identity-H yes yes yes 19 0
DCVBES+GaramondPremrPro-MedSubh CID Type 0C Identity-H yes yes yes 20 0
KRRICW+GaramondPremrPro-MedItSubh CID Type 0C Identity-H yes yes yes 21 0
GNNEBG+GaramondPremrPro-SmbdSubh CID Type 0C Identity-H yes yes yes 22 0
NOXUKA+GaramondPremrPro-SmbdItSubh CID Type 0C Identity-H yes yes yes 23 0
OJMMRC+GaramondPremrPro-Disp CID Type 0C Identity-H yes yes yes 24 0
CHNDOC+GaramondPremrPro-ItDisp CID Type 0C Identity-H yes yes yes 25 0
MPPVHL+GaramondPremrPro-BdDisp CID Type 0C Identity-H yes yes yes 26 0
MMQBOJ+GaramondPremrPro-BdItDisp CID Type 0C Identity-H yes yes yes 27 0
AFGIHW+GaramondPremrPro-MedDisp CID Type 0C Identity-H yes yes yes 28 0
VYQMOL+GaramondPremrPro-MedItDisp CID Type 0C Identity-H yes yes yes 29 0
ZZMXKE+GaramondPremrPro-SmbdDisp CID Type 0C Identity-H yes yes yes 30 0
LUNAOE+GaramondPremrPro-SmbdItDisp CID Type 0C Identity-H yes yes yes 31 0
System-wide installation
For a system-wide installation you can put the files into appropriate locations in the ConTeXt tree. I just use the local tree within the ConTeXt installation. I show all the commands together with the output they produce on my machine. These might of course differ from yours.
First we get the path of the local tree and then we go there.
$ mtxrun --resolve-path '$TEXMFLOCAL'
/opt/context/tex/texmf-local
$ cd /opt/context/tex/texmf-local
Now we make a directory for the typescript files.
$ mkdir -p tex/context/fonts/mkiv/
In this new directory, create the two files garamond-premier.lfg
and type-imp-garamond-premier.mkiv
with the contents from above.
Now we make a directory for the OpenType font files. I follow the convention of the directory name scheme <foundry>/<fontname>
.
$ mkdir -p fonts/opentype/adobe/garamond-premier/
Place all the OpenType files in there.
Because we have added new files to the tree, we have to rebuild the filename database. This is done using
$ mtxrun --generate
This will take a moment and print a lot of messages to the terminal. Afterwards, you can check whether the new files are detected in the tree
$ mtxrun --find-file garamond-premier.lfg
/opt/context/tex/texmf-local/tex/context/fonts/mkiv/garamond-premier.lfg
$ mtxrun --find-file type-imp-garamond-premier.mkiv
/opt/context/tex/texmf-local/tex/context/fonts/mkiv/type-imp-garamond-premier.mkiv
$ mtxrun --find-file GaramondPremrPro.otf
/opt/context/tex/texmf-local/fonts/opentype/adobe/garamond-premier/GaramondPremrPro.otf
If that all works, you are ready to typeset your document. The typescript should automatically found by \setupbodyfont[garamond-premier]
(no \usetypescriptfile
or similar necessary).
file:
lookup rather thanname:
. Thename:
lookup is much slower and may fail if fonts don't declare their name correctly or there are two fonts which have the same name.