Characters words and fonts/Small caps and other styles

From Wiki
< Characters words and fonts
Revision as of 22:10, 18 January 2025 by Garulfoo (talk | contribs) (→‎Common OpenType style switches)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

To use or not to use \sc

Certain older commands such as \sc should no longer be used for fonts that provide the desired OpenType features. This is because \sc does not work across all weights which provide for smallcaps.

In practice, this means that \sc should be used only for Latin Modern or other legacy fonts that have not been updated to OpenType. See Small caps across styles (bold, italics, etc.)

Common OpenType style switches

Now that OpenType fonts and the associated features are ubiquitous, ConTeXt provides a few commonly used switches that will work across all weights and sizes of the selected typeface (= bodyfont). ConTeXt provides the following out of the box:

\setsmallcaps
\setoldstyle
\setfractions

\style[style=smallcaps]
\style[style=oldstyle]
\style[style=fractions]

Here is an example of usage:

  • \startTEXpage[offset=1em]
    
    \startlines
    abcd  {\setsmallcaps abcd}
    12345 {\setoldstyle 12345}
    1/2   {\setfractions 1/2}
    
    abcd  {\style[style=smallcaps] abcd}
    12345 {\style[style=oldstyle] 12345}
    1/2   {\style[style=fractions] 1/2}
    \stoplines
    
    \stopTEXpage
    

You can also define your own feature sets with \definefontfeature.

See also Characters words and fonts/Fonts features - OpenType features - Ligatures.