reutenauer / polyglossia

An alternative to Babel for XeLaTeX and LuaLaTeX
http://www.ctan.org/pkg/polyglossia
MIT License
185 stars 52 forks source link

wrong handeling of \normalfont #603

Closed Udi-Fogiel closed 9 months ago

Udi-Fogiel commented 10 months ago

I don't really understand the purpose of \resetfontlatin, but it tampers with \normalfont. For example, see how the section head in the following code has the wrong font:

\documentclass{article}
\usepackage{xcolor}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{french}
\newfontfamily\frenchfont{Latin Modern Roman}[Color=red]
% \def\resetfontlatin{}
\begin{document}
     \selectlanguage{french}
     Test \textenglish{Test} Test
     \section{Test}
\end{document}

If I uncomment the line \def\resetfontlatin{} everything looks ok... Is there a need for this \resetfontlatin?

jspitz commented 10 months ago

Should be fixed. \resetfontlatin is needed particularly when switching between different scripts. What was missing here, in the case of inline switch, is a following setback of the language's potential extra settings.

Udi-Fogiel commented 10 months ago

Still does not work if the other language is non-Latin:

% !TeX TS-program = xelatex
\documentclass{article}
\usepackage{xcolor}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont{David CLM}[Color=red, Script=Hebrew]
% \def\resetfontlatin{}
\begin{document}
     \selectlanguage{hebrew}
     Test \textenglish{Test} Test
     \section{Test}
\end{document}

\resetfontlatin is needed particularly when switching between different scripts.

Isn't switching the fonts should be enough? or just adding the correct Script with \addfontfeature?

jspitz commented 10 months ago

Still does not work if the other language is non-Latin:

Thanks, should be fixed now as well.

Isn't switching the fonts should be enough? or just adding the correct Script with \addfontfeature?

No. I can't go into details now, but it is needed in many cases IIRC.

jspitz commented 10 months ago

Thanks, should be fixed now as well.

At e8734536a0dbefdb for that matter

Udi-Fogiel commented 10 months ago

Thanks, should be fixed now as well.

Thanks For the quick fix.

Isn't switching the fonts should be enough? or just adding the correct Script with \addfontfeature?

No. I can't go into details now, but it is needed in many cases IIRC.

Ok, I'll try to investigate a little more, but maybe I shouldn't fix something that isn't broken...

jspitz commented 10 months ago

maybe I shouldn't fix something that isn't broken...

That would be my advise as well. The whole language/script switching business is really sensitive area.

Udi-Fogiel commented 9 months ago

@jspitz Is there any chance to load the new version to ctan soon? I encountered several users who had confusing error messages about missing glyphs in their fonts, because they wrote in hebrew and the font was Latin Modern as a consequence of this bug.

I don't want to tell to many people to add a temporary patch to their documents, but this is not really urgent, so don't feel obliged if you don't currently have the time.

jspitz commented 9 months ago

I'm quite busy with RL currently, but I see if I can prepare a release in due time.

jspitz commented 9 months ago

I have just submitted polyglossia 1.65 to CTAN.