Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with default bx series: Name and font substitution #360

Open
4 tasks done
RuixiZhang42 opened this issue Mar 15, 2019 · 5 comments
Open
4 tasks done

Problem with default bx series: Name and font substitution #360

RuixiZhang42 opened this issue Mar 15, 2019 · 5 comments

Comments

@RuixiZhang42
Copy link

RuixiZhang42 commented Mar 15, 2019

Description

The mtpro2 math package (and also the newtxmath math package, etc.) assumes that text font has a b series. Most traditional text font packages either provide the b series or make sure that font substitutions from b to bx and vice versa happen. This is not the case with fontspec.

Check/indicate

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{fontspec}
\setmainfont{texgyretermes}[
  Extension=.otf,
  UprightFont=*-regular,
  ItalicFont=*-italic,
  BoldFont=*-bold,
  BoldItalicFont=*-bolditalic,
]
\usepackage[lite]{mtpro2}
%%% or
%\usepackage{newtxmath}
\begin{document}
\verb|      \mathnormal|: $012abc$\par
\verb|          \mathit|: $\mathit{012abc}$\par
\verb|          \mathbf|: $\mathbf{012abc}$\par
\verb|\boldmath+\mathit|: \boldmath$\mathit{012abc}$
\end{document}

a

Further details

One of the default font series set by fontspec is bx.

  • AFAIK, bx is supposed to be “bold extended”, so the naming here is arguably wrong.
  • Should fontspec make sure that font substitution between b and bx happen?
@RuixiZhang42
Copy link
Author

Take t1ntxtlf.fd from the newtx collection for example, we find the following declarations:

\DeclareFontFamily{T1}{ntxtlf}{\ntx@spacing}
\DeclareFontShape{T1}{ntxtlf}{b}{sc}{<-> \ntx@scaled ntx-Bold-tlf-sc\ntx@lsfx-t1}{}
\DeclareFontShape{T1}{ntxtlf}{b}{n}{<-> \ntx@scaled ntx-Bold-tlf-t1}{}
...
\DeclareFontShape{T1}{ntxtlf}{bx}{sc}{<->ssub * ntxtlf/b/sc}{}
\DeclareFontShape{T1}{ntxtlf}{bx}{n}{<->ssub * ntxtlf/b/n}{}
...

i.e., newtxtext naturally only has bold. For compatibility reason, e.g., in case other packages do, say, \SetSymbolFont{operators}{bold}{\encodingdefault}{\rmdefault}{bx}{n}, then it will fall back from the non-existing bold extended to bold.

@RuixiZhang42
Copy link
Author

A different point of view, as mentioned in your comment here, is to move the following code block:

  \DeclareSymbolFont{operators}\g_fontspec_encoding_tl\g_@@_mathrm_tl\mddefault\updefault
  \SetSymbolFont{operators}{normal}\g_fontspec_encoding_tl\g_@@_mathrm_tl\mddefault\updefault
  ...

to follow

  \bool_if:NT \g_@@_math_bool
   {
    \@@_info:n {setup-math}
    \fontspec_setup_maths:
   }
  % Add block here:

Thus, the \mathXX declarations are always executed regardless of the no-math option.

BTW, in the true branch of \tl_if_empty:NTF \g_@@_bfmathrm_tl, I think it is still necessary to set up

    \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g_@@_mathrm_tl\bfdefault\updefault % This line may be redundant
    \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g_@@_mathrm_tl\bfdefault\updefault

and in the false branch, the \mddefault choice is… debatable…

@RuixiZhang42 RuixiZhang42 changed the title Problem with default bx series: Name and substitution Problem with default bx series: Name and font substitution Mar 15, 2019
@RuixiZhang42
Copy link
Author

It appears that only a few number of fonts (e.g., Computer Modern) provides the bx series.

  • mtpro2 assumes that series b exists.
  • newtxmath assumes that either b or sb exists. Its text package counterpart substitutes every bx series with b (in the .fd file).
  • lmodern also substitutes every occurrence of bx with b.

An excerpt from the documentation:
https://github.com/wspr/fontspec/blob/c1fdf6d52c75017656c4d99ca5b4711353da125d/fontspec-doc-fontsel.tex#L486-L487

@RuixiZhang42
Copy link
Author

@wspr Just noticed a large scale of bx -> b changes in the test files in 74c6917 and 1b3596c and 19fa825. Are these changes coming from the LaTeX2e kernel? I cannot find the code change in fontspec

@wspr
Copy link
Collaborator

wspr commented Feb 15, 2020

@RuixiZhang42 — yes, that's right, the new default in LaTeX2e will be b. Sorry for my silence on this issue... I will be adding bx↔︎b substitution some time soon...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants