jperon / lyluatex

Alternative à lilypond-book pour lualatex
MIT License
56 stars 11 forks source link

Fix compatibility with polyglossia #298

Closed jperon closed 1 year ago

jperon commented 1 year ago

Fix #297

tomaszgrabowskiop commented 1 year ago

It gives the most interesting result... No errors (great!). But it changes a font to some I don't use for sure... Look into attached fragments. First as it was with Minion and second what shows after a change you made.

8bc13bab4bc1db70258b581f107eb559-1.pdf 5593b8589b544f4bc131f2fa57c3c8d3-1.pdf

jperon commented 1 year ago

May you please add this to your MWE:

\directlua{tex.sprint(font.getfont(font.current()).fullname)}
tomaszgrabowskiop commented 1 year ago

It only has added text "Minion Pro-Regular" at the beginning of document but the font in lyrics is at it was.

jperon commented 1 year ago

What’s weird here is that it seems to mean lyluatex passes the good font name, but LilyPond doesn’t find it. Are the files of Minion Pro installed on your system (for example, in Debian / Ubuntu, in /usr/share/fonts/ or $HOME/.local/share/fonts/, or only in the folder of your document ?

tomaszgrabowskiop commented 1 year ago

We are talking about MacOSX 12 in my case. The font is installed for user. /Users/XXX/Library/Fonts/MinionPro-Regular.otf

Before the change you did in lyluatex.lua the font was visible for fontspec package. But it was necessary to invoke it before and besides polyglossia. Now in all cases lily pond sets the lyrics with font I don't use in tex document.

jperon commented 1 year ago

Could you please:

jperon commented 1 year ago

@tomaszgrabowskiop I’ve just pushed a commit (on this branch) that should IMO fix the problem. The error came from the difference between fullname (e. g. Minion Pro-Regular) and family name (e. g. Minion Pro). The font with which I work (libertine) returns the same value for both, so I hadn’t noted this difference!

tomaszgrabowskiop commented 1 year ago

It does the trick. Thank you!

tomaszgrabowskiop commented 1 year ago

Even when polyglossia is turned on and fontspec is not load separately.

tomaszgrabowskiop commented 1 year ago

But... ligatures (Rare) do not appear in the text of lyrics. I use both gregoriotex (and in lyrics are all old ligatures) and lilypond (no ligatures). Can it be fixed on your site or it is a different subject? I don't recall if there were present before problems with polyglossia...

jperon commented 1 year ago

I think this point is on LilyPond side: lyluatex only defines fonts thanks to make-pango-font-tree, LilyPond (and not LaTeX) formats the lyrics.

lfm83 commented 1 year ago

This commit (up to current master) breaks pass-fonts for me. If I use \setmainfont{EB Garamond} then in the created temporary .ly file, we get a font tree looking like: (make-pango-font-tree "EB Garamond Regular" [etc] the "Regular" part of which should not be there: LilyPond finds the EB Garamond only without the "Regular" specification.

jperon commented 1 year ago

@lfm83 OK, I see the problem. I’m going to fix it, but there will be a drawback: it will only work with EB Garamond without polyglossia, or at least only by loading polyglossia after using setmainfont. The reason is that polyglossia removes the rawdata table from the font table from luatex, thus making it impossible to properly get the family name of the current font.

jperon commented 1 year ago

@lfm83 Should be fixed in latest master.

lfm83 commented 1 year ago

@lfm83 Should be fixed in latest master.

Yes, I can confirm the bug is fixed for me. Thank you!