![](https://secure.gravatar.com/avatar/46562c7d27388490d62e8d7a5bc960dd.jpg?s=120&d=mm&r=g)
On 10/3/2018 3:29 PM, Hans Hagen wrote:
On 10/3/2018 12:33 PM, mf wrote:
Hello list, i'm trying to add a smallcaps variant to the MyriadPro font, since it does not implement the smcp opentype feature.
My strategy:
- "transplant" the uppercase letters of the MyriadPro-Regular into the lowercase letters of the same font with a font fallback that scales down the glyphs ("FakeSansCaps" in the following source)
- since the scaled down glyphs get also thinner traits, embolden them with a font feature effect ("emboldened" in the following source) to make them consistent with the "real" uppercase letters
What is not working: i don't know how to map the uppercase letters to the lowercase range; i tried to specify an offset of -32 in
\definefontfallback[FakeSansCaps][SansEmboldened][0x61-0x7a][rscale=.8,force=yes,offset=-32]
but it does not work.
Here's the minimal (not) working example:
\starttypescriptcollection [myriadpro]
\definefontfeature[emboldened][effect={width=0.1,delta=0.4,factor=0.3}]
\starttypescript [sans] [myriadpro] \definefontsynonym [Sans] [file:MyriadPro-Regular.otf] [features=default] \definefontsynonym [SansItalic] [file:MyriadPro-It.otf] [features=default] \definefontsynonym [SansBold] [file:MyriadPro-Bold.otf] [features=default] \definefontsynonym [SansBoldItalic] [file:MyriadPro-BoldIt.otf] [features=default] \definefontsynonym [SansSlanted] [file:MyriadPro-It.otf] [features=default] \definefontsynonym [SansBoldSlanted] [file:MyriadPro-BoldIt.otf] [features=default]
\definefontsynonym [SansEmboldened] [Sans] [features=emboldened] \definefontfallback[FakeSansCaps] [SansEmboldened] [0x61-0x7a] [rscale=.8,force=yes] % offset?
\definefontsynonym [SansCaps] [file:MyriadPro-Regular.otf] [fallbacks=FakeSansCaps] \stoptypescript \starttypescript [myriadpro] \definetypeface [myriadpro] [ss] [sans] [myriadpro] [default] \stoptypescript
\stoptypescriptcollection
\usetypescript[myriadpro]
\setupbodyfont[myriadpro,ss]
\starttext % scaled up 4 times to appreciate the thickness compensation \scale[sx=4,sy=4]{\sc SoMe CaMeLcAsE TeXt.}\par \stoptext 'offset' offsets the original, i'll add 'target' so that you can do
\definefontfallback[FakeSansCaps] [SansEmboldened] [0x61-0x7a] [rscale=.8,force=yes,target=0x41] ok, even nicer:
\definefontfallback[FakeSansCaps] [SansEmboldened] [0x0000-0xFFFF] [rscale=.8,method=uppercase] which will remap all lowercase in the font so that you also get accented characters Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------