ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* faking smallcaps font with font features and fallbacks
@ 2018-10-03 10:33 mf
  2018-10-03 13:29 ` Hans Hagen
  0 siblings, 1 reply; 17+ messages in thread
From: mf @ 2018-10-03 10:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-10-04 14:38 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-03 10:33 faking smallcaps font with font features and fallbacks mf
2018-10-03 13:29 ` Hans Hagen
2018-10-03 14:02   ` Hans Hagen
2018-10-03 14:20     ` mf
2018-10-03 14:31       ` Hans Hagen
2018-10-03 15:16         ` mf
2018-10-03 16:59           ` Hans Hagen
2018-10-04 11:44     ` Taco Hoekwater
2018-10-04 12:11       ` Hans Hagen
2018-10-04 13:19         ` Taco Hoekwater
2018-10-04 13:46           ` Hans Hagen
2018-10-04 14:26             ` Taco Hoekwater
2018-10-04 13:35         ` mf
2018-10-04 13:45           ` Hans Hagen
2018-10-04 14:10             ` mf
2018-10-04 14:38               ` Hans Hagen
2018-10-04 13:47           ` luigi scarso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).