% !TEX TS-program = pdflatex
% !TEX encoding = UTF-8 Unicode
% arara: pdflatex: { synctex: true }
\pdfminorversion=7
\RequirePackage{svn-prov}
\ProvidesFileSVN{$Id: nfssext-cfr.tex 6143 2017-03-28 22:45:37Z cfrees $}[\revinfo{}]
\documentclass[pagesize=auto, fontsize=10pt, DIV=11]{scrartcl}

\usepackage{cfr-lm}
\usepackage{textcomp,longtable,array,booktabs}
\usepackage{microtype}

\newcommand*{\mail}[1]{\texttt{#1}}
\newcommand*{\pkg}[1]{\mbox{\textsf{#1}}}
\newcommand*{\cs}[1]{\texttt{\textbackslash #1}}

\addtokomafont{title}{\rmfamily}

\title{The \pkg{nfssext-cfr} package}
\author{Clea F. Rees\thanks{\mail{ReesC21 <at> cardiff <dot> ac <dot> uk}}}
\date{2017/03/28}


\begin{document}

\maketitle

\begin{abstract}
  \noindent \pkg{nfssext-cfr} is an extension of Philipp Lehman's \pkg{nfssext}\@.
  \pkg{nfssext} provides commands which enables one to specify font features not covered by the New Font Selection Scheme of \LaTeXe\@.
  \pkg{nfssext-cfr} provides additional commands, further extending the facilities offered by NFSS.
\end{abstract}

\section*{Introduction}

\pkg{nfssext-cfr} is required by various font support packages I've written.
It is being released separately to avoid unnecessary duplication and confusion.
At least, I hope it will remove at least one source of unnecessary confusion.
I have no reason to think it will avoid any of the others.

The code is somewhat experimental.
It works for me.
So far.
If you discover problems, please let me know.
If you know how to fix them, even better.

\section*{Caveats, Warnings and Qualifications}

The actual effect of any macro depends on any changes made to the defaults for various font features, the current font and, of course, what is available.

For example, \cs{itdefault} is intended to be the name of italic shape and is used by the redefined \cs{itshape} supplied by this package.
By default, \cs{itdefault} is \texttt{it}.
However, if you change that to, say, \texttt{sl}, then \cs{itshape} will use \texttt{sl} instead.

Moreover, if the current shape is small-caps, \cs{itshape} will attempt to merge the default italic shape with the small-caps.
That is, it will try to select small-caps italic, if possible, before resorting to plain italic.

The macros operating on family names are almost entirely reliant on font names adhering strictly to the Karl Berry schema.
This includes the stipulation that multiple variants be listed in alphabetical order.
These macros cannot be used with fonts named in any other way.

Likewise, the macros for series and shapes are unlikely to have their expected effects if fonts are not packaged in ways which both adhere to the NFSS schema and, where relevant, to the specific way that schema is extended here.
In particular, note that italic small-caps is assumed to be coded as \texttt{si}.

If a macro's attempt to enable or disable a font feature fails, a warning will generally be written to the console, but the code tries hard not to trigger errors.
If an attempt triggers an error, that's a bug, so please let me know.
If an attempt triggers a warning, please note that there may be no bug at all and, if there is a bug, it is probably not in this package.

To be clear, there certainly are bugs.
It is just statistically unlikely that any given warning is caused by one.

{%
  \fontfamily{pzc}\fontshape{it}\fontseries{m}\selectfont\Large Caveat emptor \dots\par
}

\section*{Macros}

The following table includes macros supplied by the original \pkg{nfssext} and additions available with \pkg{nfssext-cfr}.

The third column lists the default letter codes for various font features.
As explained above, if the defaults are changed, the macros will try to do something different.

A \texttt{+} indicates that the macro will attempt to merge the addition into the current font's family name, series or shape.
For example, if the current font uses oldstyle figures, the \texttt{+2} indicates that \cs{pstyle} will attempt to select a font with figures which are both proportional and oldstyle.

A \textt{-} indicates that the macro will attempt to subtract from the current font's family name, series or shape.
For example, if the current font uses oldstyle figures, the \texttt{-2} indicates that \cs{tstyle} will attempt to select a font with figures which are both tabular and oldstyle.

A comma-separated list indicates consecutive additions and/or subtraction.

If no \texttt{+-} is used, the macro tries to select a font with the given feature without merging.
For example \cs{sistyle} tries to switch to \texttt{si} shape regardless of the current font shape.

A \texttt{--} indicates that the macro will try to clear all relevant letter codes from the current font's family name, series or shape.
For example, \cs{regwidth} tries to switch to a series with no letter codes indicating non-standard widths in its name.

Additions, subtractions and clearances operate on font family names, series or shapes, as appropriate.
In general, macros with \texttt{style} in their names operate on family names; those with \texttt{shape} operate on shape codes; and those with \textt{width} or \texttt{weight} operate on series codes.

The letter codes correspond to those specified by the NFSS specification, unless the specification does not include the relevant feature.
In the latter case, I tried to choose something sensible i.e.~something which made sense to me at the time.


\begin{longtable}{lll>{\ttfamily}ll}
  \toprule\endhead
  \bottomrule\endfoot
  \multicolumn{5}{l}{\sffamily Standard macros redefined:}\\
  \cmidrule(lr){1-5}
  & \cs{itshape}\\
  & \cs{scshape}\\
  & \cs{upshape}\\
  \cmidrule(lr){1-5}
  \multicolumn{5}{l}{\sffamily Families --- Styles:}\\
  \cmidrule(lr){1-5}
  & \cs{textti} & \cs{tistyle} & +d & titling/display\\
  & \cs{textlt} & \cs{ltstyle} & +l & light (when separate family)\\
  & \cs{textof} & \cs{ofstyle} & +l &  open-face (or outline or blank) style\\
  & \cs{textalt} & \cs{altstyle} & +a &  alternative style\\
  & \cs{textreg} & \cs{regstyle} & -- &  regular style\\
  & \cs{emboss} & \cs{embossstyle} & +e & \\
  & \cs{textorn} & \cs{ornamentalstyle} & +p & intended primarily for decorative initials etc.\\
  & \cs{ornament} & \\
  & \cs{textqt} & \cs{qtstyle} & +q & quotation style\\
  & \cs{textsh} & \cs{shstyle} & +h & shadowed style\\
  & \cs{texttm} & \cs{tmstyle} & -s,-v,+t & monowidth typewriter\\
  & \cs{texttv} & \cs{tvstyle} & -s,-t,+v & variable width typewriter\\
  & \cs{textswash} & \cs{swashstyle} & +w & an attempt to improve on \cs{textsw}\\
  \cmidrule(lr){1-5}
  \multicolumn{5}{l}{\sffamily Families --- Figures:}\\
  \cmidrule(lr){1-5}
  & \cs{textln} & \cs{lnstyle} & -- &  lining figures (cf.~macro below)\\
  & \cs{textos} & \cs{osstyle} & j &  oldstyle figures (cf.~macro below)\\
  & \cs{textin} & \cs{instyle} & 0 &  inferior figures\\
  & \cs{textsu} & \cs{sustyle} & 1 &  superior figures\\
  & \cs{textl} & \cs{lstyle} & -j &  lining figures (cf.~command above)\\
  & \cs{texto} & \cs{ostyle} & +j &  oldstyle figures (cf.~original \cs{osstyle} above)\\
  & \cs{textp} & \cs{pstyle} & +2 &  proportional figures\\
  & \cs{textt} & \cs{tstyle} & -2 &   tabular figures\\
  & \cs{textpl} & \cs{plstyle} & -j,+2 & proportional lining figures \\
  & \cs{textpo} & \cs{postyle} & +2j & proportional oldstyle figures \\
  & \cs{texttl} & \cs{tlstyle} & -j,-2 & tabular lining figures\\
  & \cs{textto} & \cs{tostyle} & +j,-2 & tabular oldstyle figures\\
  \cmidrule(lr){1-5}
  \multicolumn{5}{l}{\sffamily Shapes:}\\
  \cmidrule(lr){1-5}
  & \cs{scolshape} & & scol & \\
  & \cs{textol} & \cs{olshape} & ol & outline\\
  & \cs{textsi} & \cs{sishape} & si & italic small-caps\\
  & \cs{textu} & \cs{ushape} & u & \\
  & \cs{textscu} & \cs{scushape} & su & \\
  & \cs{textui} & \cs{uishape} & ui & upright italic\\
  & \cs{textri} & \cs{rishape} & ri & reverse italic\\
  & \cs{textdf} & \cs{dfshape} & n & default shape\\
  & \cs{textsw} & \cs{swshape} & it & swash shape (cf.~\cs{swstyle} above)\\
  & & \cs{swstyle} &  \\
  \cmidrule(lr){1-5}
  \multicolumn{5}{l}{\sffamily Series --- Widths:}\\
  \cmidrule(lr){1-5}
  & \cs{textnw} & \cs{nwwidth} & +c & \\
  & \cs{textcd} & \cs{cdwidth} & +c & \\
  & \cs{textec} & \cs{ecwidth} & +ec & \\
  & \cs{textuc} & \cs{ucwidth} & +uc & \\
  & \cs{textet} & \cs{etwidth} & +x & \\
  & \cs{textep} & \cs{epwidth} & +x & \\
  & \cs{textex} & \cs{exwidth} & +ex & \\
  & \cs{textux} & \cs{uxwidth} & +ux & \\
  & \cs{textrw} & \cs{regwidth} & -- & \\
  \cmidrule(lr){1-5}
  \multicolumn{5}{l}{\sffamily Series --- Weights:}\\
  \cmidrule(lr){1-5}
  & \cs{textmb} & \cs{mbweight} & +mb & \\
  & \cs{textdb} & \cs{dbweight} & +db & \\
  & \cs{textsb} & \cs{sbweight} & +sb & \\
  & \cs{texteb} & \cs{ebweight} & +eb & \\
  & \cs{textub} & \cs{ubweight} & +ub & \\
  & \cs{textlg} & \cs{lgweight} & +l & \\
  & \cs{textel} & \cs{elweight} & +el & \\
  & \cs{textul} & \cs{ulweight} & +ul & \\
\end{longtable}

\section*{History}

\subsection*{2017-03-28}
Attempt to modify \cs{tmstyle} and \cs{tvstyle} to work as advertised.
Extend documentation somewhat.

\subsection*{2010}
The 2010 update includes an attempt to improve the behaviour of \verb|\ofstyle|, and to add support for \pkg{microtype}.
I didn't publish this at the time because I wanted to test it first.
I have just discovered that I am still using a local copy.
Insofar as one person can test something, I figure that 5 years ought to be enough to pick up the most obvious problems.
However, your kilometres may, as always, vary.

There should be no changes for the end user except that in certain cases it is possible that line-breaks may be altered if \pkg{microtype} is in use due to the enhanced support included for variant font families.

\end{document}
