fontspec icon indicating copy to clipboard operation
fontspec copied to clipboard

Logging of used options may be confusing: e.g. [Renderer=Harfbuzz,Renderer=Basic].

Open jfbu opened this issue 4 years ago • 3 comments

Description

Investigating some issue with polyglossia I am confused by log file: it says

Package fontspec Info: Font family 'STIXTwoText(1)' created for font
(fontspec)             'STIXTwoText' with options
(fontspec)             [Renderer=Harfbuzz,Renderer=Basic].

...

Package fontspec Info: Font family 'STIXTwoMath-Regular(0)' created for font
(fontspec)             'STIXTwoMath-Regular' with options
(fontspec)             [Renderer=Harfbuzz,Renderer=Basic,BoldItalicFont={},Itali
cFont={},SmallCapsFont={},Script=Math,FontAdjustment={\__um_luatex_copy_fontdime
ns:
(fontspec)             },Extension={.otf}].

and although it is quite certain it is Harfbuzz it is confusing. Can both at same time make sense (naive question, if answer is yes then my ticket is irrelevant).

Check/indicate

  • [ ] Relevant for XeTeX
  • [x] Relevant for LuaTeX
  • [ ] Issue tracker has been searched for similar issues?
  • [ ] Links to <tex.stackexchange.com> discussion if appropriate

Minimal example demonstrating the issue

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{english}

\usepackage{unicode-math}

\setmainfont{STIXTwoText}

\setmathfont{STIXTwoMath-Regular}[Extension=.otf]

\begin{document}

$\cos\alpha\leq\sin\gamma\approx\tan\pi$

$\sum \cos x \prod \sin y \lim\tan z$

\showoutput
\end{document}

Further details

jfbu avatar Feb 07 '21 14:02 jfbu

Imho the problem is with polyglossia. It is adding the harfbuzz option unconditionally to every font.

It would make much more sense to either use harfbuzz only with the scripts where it is the better choice (for latin scripts node mode is normally better for the hyphenation), or at least to restrict it to the text font families:

\documentclass{article}

\usepackage[luatexrenderer=none]{polyglossia}
\defaultfontfeatures[\rmfamily,\sffamily,\ttfamily]{Renderer=Harfbuzz} %better
%\defaultfontfeatures{Renderer=Harfbuzz} %your log

\setmainlanguage{english}

\usepackage{unicode-math}

\setmainfont{STIXTwoText}

\setmathfont{STIXTwoMath-Regular}[Extension=.otf]

\begin{document}

$\cos\alpha\leq\sin\gamma\approx\tan\pi$

$\sum \cos x \prod \sin y \lim\tan z$
\end{document}

u-fischer avatar Feb 07 '21 15:02 u-fischer

Imho the problem is with polyglossia. It is adding the harfbuzz option unconditionally to every font.

Yes, and with cmap (at version 1.0j or 1.0h and earlier with luatex85) this has effect that copying-pasting operator names (cos) from pdf (obtained via lualatex) gives unexpected result. I felt I was not competent enough to open ticket at polyglossia. I thank @zauguin who explained to me source of the problem in this unconditional usage of HarfBuzz by recent polyglossia.

jfbu avatar Feb 07 '21 15:02 jfbu

Yes, and with cmap (at version 1.0j or 1.0h and earlier with luatex85) this has effect that copying-pasting operator names (cos) from pdf (obtained via lualatex) gives unexpected result.

Sorry: cmap is not relevant here. I in fact spend quite some time a few hours ago about this but for some strange reason wrote the contrary of what I knew already. Well I will open a ticket at polyglossia if not already done.

jfbu avatar Feb 07 '21 16:02 jfbu