You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.
Below is a comment by U. F. from the lualatex list:
Yes. It has obviously to do with the fact that the fonts exist in
more than one size. lualatex reloads the fonts after a newpage and
then sometimes gets the wrong size (I could reproduce it with 10pt
and 12pt class options but not with 11pt).
I suspect a fontspec bug as one can trigger the wrong font size by
using \textsl. (fontspec handles slanted and italic in a specific
way):
There may be more than one bug involved in this issue. After some debugging effort, I found this chain of events:
A suitable slanted font is not found by lualatex, and an italic font is substituted.
Some LaTeX macro calls \do@subst@correction, which seems to specify the font without some size information, that is
no at <x>pt
no scaled <factor>
and definitely no size information in the font name, in my case just LatinModernRoman/I
lualatex (maybe TeX in general, didn't check) assigns a default size of "scaled at 100% font design size"
lualatex calls the define_font callback, and true to the description in the luatex reference manual, font size is encoded as
positive integers for a fixed size (in units of 1/65536 pt) [not in this case]
negative integers for scaled fonts (-1000 * scale factor)
A size of "scaled at 100% font design size" is thus encoded as the integer -1000
luaotfload does not handle scaled fonts in the define_font callback correctly, instead searching for a font of size -1000pt / 65536 = -0.0152587890pt. As a result, it always chooses the smallest size of the font.
There are at least two problems that I can see:
The define_font callback in luaotfload is not prepared to handle scaled fonts, the sizes of which are encoded as negative values.
The information given to this callback is not sufficient to select a font. The only information I got was
name: LatinModernRoman/I
size: -1000
I'm not sure where this problem comes from, latex font seletion (the \do@subst@correction macro), fontspec, or luatex. What's more, I have no idea how luaotfload should handle scaled fonts when the font name resolves to more than one font.
As a workaround, I found that in my case, and the two code examples above, specifying the slanted font explicitly, by
\setmainfont[SlantedFont={Latin Modern Roman Slanted}]{Latin Modern Roman}
works, because it avoids font substitution (step 1). The problems with font substitution, however, remain.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The
\textit
command sometimes changes font size when using Latin Modern Roman or Latin Modern Sans.Below is a comment by U. F. from the
lualatex
list:The text was updated successfully, but these errors were encountered: