Skip to content

Commit

Permalink
documentation for the new features in ltnews31
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankMittelbach committed Dec 20, 2019
1 parent 5d0802c commit f36b92b
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 16 deletions.
8 changes: 5 additions & 3 deletions base/changes.txt
Expand Up @@ -13,16 +13,18 @@ are not part of the distribution.
* fontdef.dtx (subsection{Defaults}): Set
\shapedefault explicitly to "n" not \updefault
\bfdefault set to to "b" not "bx" (but bx for CM fonts)
\updefault set to to "up" not "n"
\updefault set to to "up" not "n".
Part of extending the series and shape handling, see ltnews31.

2019-12-17 Frank Mittelbach <Frank.Mittelbach@latex-project.org>

* ltfssini.dtx (section{Supporting nested emphasis}):
Support nested \emph sequences a generalization \eminnershape.
See ltnews31 for details.
* ltfssini.dtx (section{Custom series settings for main document families}):
Provide custom series settings a la mweights

* ltfssini.dtx (section{Custom series settings for main document families}):
Provide custom series settings a la mweights package.
See ltnews31 for details.

2019-12-17 Frank Mittelbach <Frank.Mittelbach@latex-project.org>

Expand Down
174 changes: 162 additions & 12 deletions base/doc/ltnews31.tex
Expand Up @@ -232,19 +232,144 @@ \section{Improved load-times for \pkg{expl3}}



\section{Extending the shape management with NFSS}

\emph{write}



\section{Extending the series management with NFSS}

\emph{write}

\section{Improvements to \LaTeX{}'s font selection mechanisms (NFSS)}


\subsection{Extending the shape management of NFSS}

Over time more and more fonts have become available for use with
\LaTeX{}. Many such font families offer additional shapes, e.g., small
caps italics (\texttt{scit}), small caps slanted (\texttt{scsl} or
swash letters (\texttt{sw}). By using \cs{fontshape} those shapes can
be explicitly selected and for the swash letter shapes there is also
\cs{swshape} and \cs{textsw} available.

In the original font selection implementation a request to new shape
always a canceled the current one. With the 2020 release of \LaTeX{}
this has changed and \cs{fontshape} can now be used to combine small
capitals with italics, slanted or swash letters, either by explicitly
asking for \texttt{scit}, etc., or by asking for italics when typesetting
already in small caps and so forth.

Using \cs{upshape} will still change italics or slanted back to an
upright shape but will not any longer alter the small caps setting. To
change small capitals back to upper/lower case you can now use
\cs{ulcshape} (or \cs{textulc}) which in turn will not change the font
with respect to italics, slanted or swash. Finally, if you want to
reset the shape back to normal you can use \cs{normalshape} which is a
shorthand for \cs{upshape}\cs{ulcshape}.

The way how shapes combine with each other is not hardwired but is
customizable and extensible if there is ever a need for it. The
mappings are defined through \cs{DeclareFontShapeChangeRule} and the
details for developers are documented in \texttt{source2e.pdf}.

The ideas for this interface extension has been pioneered in
\pkg{fontspec} by Will Roberson for Unicode engines and in
\pkg{fontaxes} by Andreas Bühmann and Michael Ummels for \pdfTeX{} and
used in many font support packages.



\subsection{Extending the series management of NFSS}

Many of the the newer font families also come provided with additional
weights (thin, semi-bold, ultra-bold, etc.\@) or several running lengths
such a condensed or extra-condensed. In some cases the number of
different series values is really impressive, for example, Noto Sans
offers 36 from ultra-light extra condensed to ultra-bold medium width.

Already in its original design NFSS supported 9 weight levels from
ultra-light (\texttt{ul}) to ultra-bold (\texttt{ub}) and also 9 width
levels from ultra-condensed (\texttt{uc}) to ultra-expanded
(\texttt{ux}) so more than enough even for a font family like Noto
Sans. Unfortunately, some font support packages nevertheless invented
their own names so in the last years you could find all kind of
non-standard series names like \texttt{k}, \texttt{i}, \texttt{j} and
others making it impossible to combine different fonts successfully
using the standard NFSS mechanisms.

Over the course of the last year a small number of individuals,
notably, Bob Tennent, Michael Sharpe and Marc Penninga worked hard to
bring this unsatisfying situation back under control and today we are
happy to report and the internal font support files for more than a
hundred font families are back to follow the standard NFSS conventions
so that combing them is now again rather nice and easy (of course,
there is still the task of choosing combinations that visually work
well together, but from a technical perspective they can now easily
matched).


In the original font selection implementation a request to series
always canceled the current one. This was reasonable because there
were nearly no fonts available that offered anything other than a
medium or a bold series. Now that this has changed and families such
as Noto Sans are available, combing weight and width into a single
attribute is no longer appropriate. With the 2020 release of \LaTeX{}
the series management therefore changed to allow for independently
setting the weight and the width attribute of the series.

For most users this change will be largely transparent as \LaTeX{}
offers only \cs{textbf} or \cs{bfseries} to select a bolder face (and
\cs{textmd} and \cs{mdseries} to return to a medium series) but no
high-level command for selecting a condensed face, etc. However, with
the NFSS low-level interface, it is now possible to ask for, say,
\verb=\fontseries{c}\selectfont= in a marginal note to get a condensed
face and that would still allow using \cs{textbf} inside. This then would
select a bold condensed face and not a rather odd-looking
bold-extended face in the middle of condensed type.

The expectation is that this is largely used by class and package
designers, but given that the low-level NFSS commands are usable on
the document level and not really difficult to apply, there are
probably also a number of users who will enjoy using the new
possibilities that bring \LaTeX{} back into the front league when it
comes to font usage.

The way how different series values combine with each other is not
hardwired but is again customizable and extensible. The mappings are
defined through \cs{DeclareFontSeriesChangeRule} and the details for
developers are documented in \texttt{source2e.pdf}.


%\[ * \quad * \quad * \]

\subsection{Font series defaults per document family}

With additional weights and widths available in many font families it
becomes more likely that somebody wants to match, say, a medium weight
serif family with a semi-light sans serif family or that with one
family one wants to use the bold-extend face when \cs{textbf} is used
while with another it should be bold (not extended) or semibold, etc.

In the past this kind of extension was made available with the
\pkg{mweights} package by Bob Tennent which has been used in many font
support packages.

With the 2020 release of \LaTeX{} this feature is now available out
of the box. In addition we also offer a document-level interface to adjust the
behavior high-level series commands \cs{textbf}, \cs{textmd} and their
declaration forms \cs{bfseries} and \cs{mdseries} so that they can
have different effects for the serif, sans serif and typewriter
families used in a document.

For example, specifying
\begin{verbatim}
\DeclareFontSeriesDefault[rm]{bf}{sb}
\DeclareFontSeriesDefault[tt]{md}{lc}
\end{verbatim}
in the document preamble would result in \cs{textbf} producing
semi-bold (\texttt{sb}) when typesetting in roman typeface and second
declaration means that typewriter is by default (medium series) using
a light-condensed face. The optional argument here can be either
\texttt{rm}, \texttt{sf} or \texttt{tt} to indicate one of the three
main font families in a document; if omitted you will change the
overall document default instead. In the first mandatory argument you
specify either \texttt{md} or \texttt{bf} and the second mandatory
argument then gives the desired series value in NFSS nomenclature.


\section{Emphasis handling generalized}
\subsection{Emphasis handling generalized}

With previous releases of \LaTeX{} nested \cs{emph} commands
automatically alternated between italics and upright. This mechanism
Expand All @@ -258,7 +383,7 @@ \section{Emphasis handling generalized}
\DeclareEmphSequence{\itshape,%
\upshape\scshape,\itshape}
\end{verbatim}
uses italics for the first, small capitals for the second, and italic
uses italics for the first, small capitals for the second, and italic
small capitals for the third level (provided you use a font that
supports these shapes). If there are a more nesting levels than
provided, \LaTeX{} uses the declarations stored in \cs{emreset} (by
Expand All @@ -279,6 +404,31 @@ \section{Emphasis handling generalized}



\subsection{Providing font family substitutions}

Given that \pdfTeX{} can only handle fonts with up to 256 glyphs a
single font encoding can only support a few languages. The \texttt{T1}
encoding, for example, does support many of the Latin based scripts,
but if you want to write in Greek or Russian you need to switch
encodings to \texttt{LGR} or \texttt{T2A}. Given that not every font
family offers glyphs in such encodings, you may end up with some
default family (e.g., Computer Modern) that doesn’t blend in well
chosen document font. For such cases NFSS now offers
\cs{DeclareFontFamilySubstitution}, for example:
\begin{verbatim}
\DeclareFontFamilySubstitution{LGR}
{Montserrat-LF}{IBMPlexSans-TLF}
\end{verbatim}
tells \LaTeX{} that if you are typesetting in the sans serif font
\texttt{Montserrat-LF} and the Greek encoding \texttt{LGR} is asked
for, then \LaTeX{} should use \texttt{IBMPlexSans-TLF} to fulfill the
encoding request.

The code is based on ideas from the \texttt{substitutefont}
package by Günter Milde, but implemented differently.



\section{Other changes to the \LaTeX{} kernel}

\emph{added \texttt{alias} size function}
Expand Down
2 changes: 1 addition & 1 deletion base/ltfssbas.dtx
Expand Up @@ -1320,7 +1320,7 @@

% \begin{macro}{\DeclareFontFamilySubstitution}
% The idea for this macro is stolen from the \texttt{substitutefont}
% package, with some modifications and a new name.
% package by Günter Milde, with some modifications and a new name.
%
% Its purpose is to provide characters in a special encoding tht
% are not available in the current font family to be taken from a
Expand Down

0 comments on commit f36b92b

Please sign in to comment.