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

luaotfload and Math fonts: cvNN feature for superscripts not applied #266

Open
dflipo opened this issue Oct 26, 2023 · 12 comments
Open

luaotfload and Math fonts: cvNN feature for superscripts not applied #266

dflipo opened this issue Oct 26, 2023 · 12 comments
Assignees
Labels
fixed in dev already fixed

Comments

@dflipo
Copy link

dflipo commented Oct 26, 2023

This issue is similar to #227.

For the Math fonts I maintain, I use cvNN features to to toggle Greek variants in Maths, f.i. the cv06 feature makes \phi output mitvarphi (U+1D711) instead of mitphi (U+1D719) the default. It works fine for base characters, but I recently noticed a problem with the superscripts of these variants (bolder glyphs mitvarphi.st and mitvarphi.sst are available for the ssty feature): only one feature is applied by luaotfload, actually the last called by the font (not the first as I wrote previously).

I reported on SE (https://tex.stackexchange.com/questions/698768/) and after private exchanges with with Mikael Sundquist and Hans Hagen, they came up with a solution (thanks to both of them!) which works for me (see the appended "fontloader-2023-08-19.lua" file).

The following MWE: requires XCharter-Math v0.51 pushed to CTAN today. In this new version, feature ssty is applied last (it was applied before all cvNN features in previous versions). Screen captures of the compilation by current LuaLaTeX, XeLaTeX (correct output) and LuaLaTeX+patch (correct output) are appended.

`\documentclass{article}
\usepackage{unicode-math}
\usepackage{iftex}
\begin{document}
\setmathfont{XCharter-Math.otf}
\ifluatex LuaLaTeX: \fi
\ifxetex XeLaTeX: \fi

\vspace{.5\baselineskip}
(\phi^{\phi^{\phi}}, v^{v^{v}})

\setmathfont{XCharter-Math.otf}[CharacterVariant={6,11}]
(\phi^{\phi^{\phi}}, v^{v^{v}})
\end{document}`

Outputs (screen captures):
image

image

After adding file "fontloader-2023-08-19.lua" to the current directory, the output is correct:

image

fontloader-2023-08-19.lua.zip

@zauguin zauguin self-assigned this Oct 26, 2023
@zauguin
Copy link
Member

zauguin commented Oct 27, 2023

@dflipo When you talked to Has Hagen about this, did he mention if he plans to add this change to ConTeXt MKIV soon too?

@antonis-tsolomitis
Copy link

This bug seems to remain unresolved. The above fix with the extra fontloader file does NOT work with StylisticSets. NewComputerModern is to provide scriptstyle and scriptscriptstyle glyphs for the alternate calligraphic Latin capitals. Let me call those "mathscr". The default is "mathcal" and StylisticSet=1 replaces mathcal with mathscr. This works fine with xelatex. But with lua only the base of an exponent is changed to mathscr. So if you write \mathcal{A}^{\mathcal{A}} you get the base A in mathscr and the exponent A in mathcal.

@zauguin
Copy link
Member

zauguin commented Dec 28, 2023

This bug seems to remain unresolved. The above fix with the extra fontloader file does NOT work with StylisticSets

When trying the changed fontloader with NewComputerModern's ss01 it does work for me.

@niruvt
Copy link

niruvt commented Dec 28, 2023

When trying the changed fontloader with NewComputerModern's ss01 it does work for me.

Hello @zauguin,

How does one use the changed fontloader? Without using the fontloader, I provide a MWE:

\documentclass[border=1cm]{standalone}
\usepackage{fontspec}
\setmainfont[%
  Renderer          = {Harfbuzz},%
  StylisticSet      = {5},%
  CharacterVariant  = {5},%
  Extension         = {.otf}%
]{NewCM10-Book}

\begin{document}
x͜y\textsuperscript{x͜y}
\end{document}

image

My system is up-to-date. Can you reproduce this image with the fontloader?

@niruvt
Copy link

niruvt commented Dec 28, 2023

@zauguin, forgot to mention, for me, the following didn't work:

After adding file "fontloader-2023-08-19.lua" to the current directory, the output is correct:

In my log, I can see this, which means I am using the file, but the output is wrong:

luaotfload | init : Loading fontloader from absolute path "fontloader-2023-08-19.lua".

@niruvt
Copy link

niruvt commented Dec 28, 2023

Even with XeLaTeX, it fails:

image

@zauguin
Copy link
Member

zauguin commented Dec 28, 2023

@niruvt This is an different issue. The font you are using has different optical sizes for 10pt and 8pt and the 10pt version does not seem to handle the combining character correctly here.

@niruvt
Copy link

niruvt commented Dec 28, 2023

@zauguin Okay, my bad.

@zauguin
Copy link
Member

zauguin commented Dec 28, 2023

It's the same as the previous issue: The subscript is smaller and therefore uses a different font. If you only provide a updated NewCM10-Book and not an extended NewCM08-Book you will only affect the bigger one.

@niruvt
Copy link

niruvt commented Dec 28, 2023

@zauguin yes, I figured it out and hence deleted the comment, thanks for the attention!

@antonis-tsolomitis
Copy link

My system did not have the latest updates. After updating and after placing the above fontloader file in t he same directory NewCM produces correct output. So now the question is when will this be released? CTAN has a file with the same name but it is different than the one above.

@zauguin
Copy link
Member

zauguin commented Dec 29, 2023

So now the question is when will this be released?

This is now merged into the dev branch and will probably be part of the next release.

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

No branches or pull requests

4 participants