latex3 / latex2e

The LaTeX2e kernel
https://www.latex-project.org/
LaTeX Project Public License v1.3c
1.88k stars 261 forks source link

Consider supporting families with different boldness in a general way #275

Open FrankMittelbach opened 4 years ago

FrankMittelbach commented 4 years ago

Brief outline of the enhancement

At the moment LaTeX understands that the meta families rm/sf/tt can have different boldness, eg "bx" or "b" and correctly deals with this when mixing such families. However, it doesn't do that when combining arbitrary families.

Minimal example showing the current behaviour

\documentclass{article}

\DeclareFontFamily{OT1}{ptm}{}
\DeclareFontShape{OT1}{ptm}{m}{n}{<-> ptmr7t}{}
\DeclareFontShape{OT1}{ptm}{m}{sc}{<-> ptmrc7t}{}
\DeclareFontShape{OT1}{ptm}{m}{sl}{<-> ptmro7t}{}
\DeclareFontShape{OT1}{ptm}{m}{it}{<-> ptmri7t}{}
\DeclareFontShape{OT1}{ptm}{b}{n}{<-> ptmb7t}{}
\DeclareFontShape{OT1}{ptm}{b}{sc}{<-> ptmbc7t}{}
\DeclareFontShape{OT1}{ptm}{b}{sl}{<-> ptmbo7t}{}
\DeclareFontShape{OT1}{ptm}{b}{it}{ <-> ptmbi7t}{}

\def\test{0}      % ok
\def\test{1}      % ????
\def\test{2}      % ok - typical pdftex case

\ifcase \test\relax
  \renewcommand\rmdefault{ptm}
\or  % 1
\or  % 2
  \DeclareFontShape{OT1}{ptm}{bx}{n}{<->ssub * ptm/b/n}{}
\fi

\showoutput

\begin{document}

\sffamily     Text ``cmss/m/n''

\bfseries     Text ``cmss/bx/n''

\ifcase \test\relax
  \rmfamily
\else
  \fontfamily{ptm}\selectfont
\fi

Text ``ptm/bx/n'' changed to ``ptm/b/n''?

\bigskip \mdseries

Summary: \LaTeX\ understands about fonts with different ``boldness'' if they
are assigned to the metafamilies ``rm'' ``sf'' or ``tt''.

However, if you change to an arbitrary family then the current
``boldness'' remains (e.g., bx) and it depends on the family setup
having a substitution rule for ``bx'' to ``b'' (which nearly all fonts
for pdfTeX have) to work.

\end{document}
wspr commented 4 years ago

Is this assigned to me simply to implement the substitution in fontspec or to extend the features of NFSS? :)

FrankMittelbach commented 4 years ago

just because we are the two that have to think hardest about the best solution :-) and then implement it on both sides ... nothing I want to rush though.

RuixiZhang42 commented 4 years ago

Related post: https://tex.stackexchange.com/a/479540

Related fontspec issue: https://github.com/wspr/fontspec/issues/360

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity.