diff options
author | Karl Berry <karl@freefriends.org> | 2016-08-23 16:29:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-08-23 16:29:25 +0000 |
commit | d73710f127ca9ba9ae3e6cea23dd8a616c053bea (patch) | |
tree | acad6282f475135aed80dfdfb9571cd32b79cae1 /Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua | |
parent | 178ceb34d5f5bc6475d274fbd62153af26f01f30 (diff) |
gregoriotex (22aug16)
git-svn-id: svn://tug.org/texlive/trunk@41913 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua index 0685eae1d78..6f15499f3ac 100644 --- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua +++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua @@ -1,6 +1,6 @@ --GregorioTeX Lua file. -- ---Copyright (C) 2008-2015 The Gregorio Project (see CONTRIBUTORS.md) +--Copyright (C) 2008-2016 The Gregorio Project (see CONTRIBUTORS.md) -- --This file is part of Gregorio. -- @@ -24,16 +24,16 @@ local hpack, traverse, traverse_id, has_attribute, count, remove, insert_after, gregoriotex = gregoriotex or {} local gregoriotex = gregoriotex -local internalversion = '4.1.4' -- GREGORIO_VERSION (comment used by VersionManager.py) +local internalversion = '4.1.5' -- GREGORIO_VERSION (comment used by VersionManager.py) local err, warn, info, log = luatexbase.provides_module({ name = "gregoriotex", - version = '4.1.4', -- GREGORIO_VERSION + version = '4.1.5', -- GREGORIO_VERSION greinternalversion = internalversion, - date = "2016/05/29", -- GREGORIO_DATE_LTX + date = "2016/08/18", -- GREGORIO_DATE_LTX description = "GregorioTeX module.", author = "The Gregorio Project (see CONTRIBUTORS.md)", - copyright = "2008-2015 - The Gregorio Project", + copyright = "2008-2016 - The Gregorio Project", license = "GPLv3+", }) @@ -307,6 +307,13 @@ local function dump_nodes(head) log('--end dump--') end +-- helper function for center_translation() +local function get_first_node_by_id(id, head) + for n in traverse_id(id, head) do + return n + end +end + local function center_translation(startnode, endnode, ratio, sign, order) -- total width between beginning the two centering points local total_width = node.dimensions(ratio, sign, order, startnode, endnode) @@ -321,12 +328,23 @@ local function center_translation(startnode, endnode, ratio, sign, order) -- \kern 0pt -- } -- + -- While normally we could use startnode.head.next.head.next.head + -- to reach the translation (glyph node), packages such as LuaTeX-ja + -- may have, for example, prepended a whatsit node to each list + -- to store e.g. text direction, moving our translation glyph node to + -- startnode.head.next.next.head.next.next.head.next instead. + -- + -- To avoid unpleasant surprises, let's search for each desired node + -- by its type: + local vlistnode = get_first_node_by_id(vlist, startnode.head) + local hlistnode = get_first_node_by_id(hlist, vlistnode.head) + local glyphnode = get_first_node_by_id(glyph, hlistnode.head) -- hence translation width is: - local trans_width = node.dimensions(startnode.head.next.head.next.head) + local trans_width = node.dimensions(glyphnode) -- now we must transform the kern 0pt into kern Xpt and kern -Xpt where X is: local X = (total_width - trans_width) / 2 - startnode.head.kern = X - startnode.head.next.next.kern = -X + vlistnode.prev.kern = X + vlistnode.next.kern = -X end local debug_types_activated = {['linesglues'] = false} @@ -965,6 +983,7 @@ end local function scale_space(factor) local skip = tex.getskip('gre@skip@temp@four') skip.width = skip.width * factor + tex.setskip('gre@skip@temp@four',skip) -- should skip.stretch and skip.shink also be scaled? end |