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

Translation centering with [/] fails to work when LuaTeX-ja is loaded #1180

Closed
anthonyfok opened this Issue Jul 8, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@anthonyfok
Contributor

anthonyfok commented Jul 8, 2016

Hi!

Sorry, it is me again with yet another LuaTeX-ja related issue, this time with centered translation with [/]. To test, I added a translation for one word in PopulusSion.gabc in the gregorio-test/tests/plain-tex/luatex-ja directory:

--- a/tests/tex-output/PopulusSion/PopulusSion.gabc
+++ b/tests/tex-output/PopulusSion/PopulusSion.gabc
@@ -17,7 +17,7 @@ style: modern;

 % The syntax in this part is called gabc. Please refer to http://home.gna.org/gregorio/gabc/#basis

-Pó(c3eh)pu(g)lus(h) Si(hi)on,(hgh.) *(;) ec(hihi)ce(e.) Dó(e.f!gwhhi)mi(h){n}us(h) vé(hi)ni(ig//ih)et(h.) (,) ad(iv./hig) sal(fe)ván(ghg)das(fg) gen(e_f_e_)tes(e.) :(:)
+Pó[People](c3eh)pu(g)lus[/](h) Si(hi)on,(hgh.) *(;) ec(hihi)ce(e.) Dó(e.f!gwhhi)mi(h){n}us(h) vé(hi)ni(ig//ih)et(h.) (,) ad(iv./hig) sal(fe)ván(ghg)das(fg) gen(e_f_e_)tes(e.) :(:)

 et(e) au(eh)dí(hhi)tam(i) fá(kjki)ci(i)et(i) Dó(ij)mi(ihi)nus(iv./hiHF) (,) gló(h!i'j)ri(ji!kvJI)am(ij) vo(j.i!jwk)cis(ji) su(i_j_i_)æ,(i.) (;) in(e) læ(e)tí(e!f'h)ti(h)a(hi!jVji)

luatex PopulusSion.tex runs fine until near the end:

(./PopulusSion-4_1_4.gtexerror: ...exlive/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua:325: attempt to index field 'head' (a nil value)
.
\GreEndScore ...re@localrightbox {}\fi \hfil \par 
                                                  \ifgre@keeprightbox \globa...

l.725 \GreEndScore
                 %
? 
) [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}])
Module gregoriotex Warning: Line heights or variable brace lengths may have cha
nged. Rerun to fix. on input line 0
</usr/share/texlive/texmf-dist/fonts/truety
pe/public/gregoriotex/greextra.ttf><../../../fonts/Alegreya-Regular.otf>{/usr/s
hare/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc}</usr/share/texlive/texmf-d
ist/fonts/truetype/public/gregoriotex/greciliae.ttf></usr/share/fonts/truetype/
fonts-japanese-mincho.ttf></usr/share/texlive/texmf-dist/fonts/type1/public/ams
fonts/cm/cmr10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/c
m/cmti10.pfb></usr/share/texlive/texmf-dist/fonts/type1/urw/ncntrsbk/uncr8a.pfb
>
Output written on PopulusSion.pdf (1 page, 137324 bytes).
Transcript written on PopulusSion.log.

So, a PDF file is generated, except that the translation is not centered. No big deal though, as I can generate the desired output (Salve Regina, simple tone, with Chinese translation underneath) without LuaTeX-ja, so no hurries. :-)

Tested with Gregorio 4.1.4 that is included in TeX Live 2016 update. I haven't tried it with the Gregorio 4.2 branch yet.

Many thanks!

Anthony

anthonyfok added a commit to anthonyfok/gregorio that referenced this issue Aug 8, 2016

Reach the translation glyph node by traverse_id()
LuaTeX-ja prepends custom whatsit nodes to store e.g. text direction,
breaking hard-coded paths like startnode.head.next.head.next.head
in the center_translation() function.

This patch uses node.travese_id() to find our desired nodes instead.

Fixes gregorio-project#1180
@anthonyfok

This comment has been minimized.

Contributor

anthonyfok commented Aug 8, 2016

I think I found the culprit and the solution.

LuaTeX-ja inserts custom whatsit nodes to the beginning of node lists, breaking pre-determined node paths like startnode.head.next.head.next.head, which gets moved to startnode.head.next.next.head.next.next.head.next with luatexja loaded.

The log file shows the kinds of whatsit nodes that LuaTeX-ja create:

Normally, without luatexja:

Lua module: gregoriotex 2016/05/29 4.1.4 GregorioTeX module.
Custom whatsit marker = 1

With luatexja loaded:

Custom whatsit inhibitglue = 1
Custom whatsit stack_marker = 2
Custom whatsit begin_par = 3
Custom whatsit direction = 4
...
Lua module: gregoriotex 2016/05/29 4.1.4 GregorioTeX module.
Custom whatsit marker = 5

I have posted a proposed solution is at Pull Request #1201: to use node.traverse_id() to find the nodes of interest. Please review the PR at your convenience, and please feel free to change it in whatever ways you prefer to conform to the existing coding style in Gregorio.

Thanks again!

Anthony

@anthonyfok anthonyfok referenced this issue Aug 22, 2016

Merged

Ctan #1210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment