Commits

Philipp Gesang committed b149efc

move Context layer to separate file

  • Participants
  • Parent commits 50df26b

Comments (0)

Files changed (2)

File letterspace-callback.lua

-if not modules then modules = { } end modules ['typo-krn'] = {
+if not modules then modules = { } end modules ["typo-krn"] = {
     version   = 1.001,
     comment   = "companion to typo-krn.mkiv",
     author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
     copyright = "PRAGMA ADE / ConTeXt Development Team",
-    license   = "see context related readme files"
+    license   = "GPL v.2.0"
 }
 
+require"letterspace-support"
+
 local next, type, tonumber = next, type, tonumber
 
 local nodes, node, fonts = nodes, node, fonts
 local insert_node_after  = node.insert_after
 local end_of_math        = node.end_of_math
 
------ unsetvalue         = -0x7FFFFFFF --- <= attr-ini
-local unsetvalue         = (luatexbase.luatexversion < 37) and -1
-                        or -2147483647 --- <= attr.lua
+local unsetvalue         = luatexbase.get_unset_value()
 
 local nodepool           = nodes.pool
 local tasks              = nodes.tasks
 local vlist_code         = nodecodes.vlist
 local math_code          = nodecodes.math
 
-local bothways = function (t) return table.swapped (t, t) end
-
-local kerncodes          = bothways({ -- <= node-ini
-    [0] = "fontkern",
-    [1] = "userkern",
-    [2] = "accentkern",
-})
+local kerncodes          = nodes.kerncodes
 local kerning_code       = kerncodes.kerning
 local userkern_code      = kerncodes.userkern
 
-local skipcodes          = bothways({ -- <= node-ini
-    [  0] = "userskip",
-    [  1] = "lineskip",
-    [  2] = "baselineskip",
-    [  3] = "parskip",
-    [  4] = "abovedisplayskip",
-    [  5] = "belowdisplayskip",
-    [  6] = "abovedisplayshortskip",
-    [  7] = "belowdisplayshortskip",
-    [  8] = "leftskip",
-    [  9] = "rightskip",
-    [ 10] = "topskip",
-    [ 11] = "splittopskip",
-    [ 12] = "tabskip",
-    [ 13] = "spaceskip",
-    [ 14] = "xspaceskip",
-    [ 15] = "parfillskip",
-    [ 16] = "thinmuskip",
-    [ 17] = "medmuskip",
-    [ 18] = "thickmuskip",
-    [100] = "leaders",
-    [101] = "cleaders",
-    [102] = "xleaders",
-    [103] = "gleaders",
-})
+local skipcodes          = nodes.skipcodes
 local userskip_code      = skipcodes.userskip
 local spaceskip_code     = skipcodes.spaceskip
 local xspaceskip_code    = skipcodes.xspaceskip
 local a_kerns            = luatexbase.new_attribute"kern"
 local a_fontkern         = luatexbase.new_attribute"fontkern"
 
-kerns.attribute          = kerns.attribute --- deleatur?
-
 local texattribute       = tex.attribute
 
 -- one must use liga=no and mode=base and kern=yes

File letterspace-support.lua

+local bothways = function (t) return table.swapped (t, t) end
+
+nodes.kerncodes = bothways({
+    [0] = "fontkern",
+    [1] = "userkern",
+    [2] = "accentkern",
+})
+
+nodes.skipcodes = bothways({
+    [  0] = "userskip",
+    [  1] = "lineskip",
+    [  2] = "baselineskip",
+    [  3] = "parskip",
+    [  4] = "abovedisplayskip",
+    [  5] = "belowdisplayskip",
+    [  6] = "abovedisplayshortskip",
+    [  7] = "belowdisplayshortskip",
+    [  8] = "leftskip",
+    [  9] = "rightskip",
+    [ 10] = "topskip",
+    [ 11] = "splittopskip",
+    [ 12] = "tabskip",
+    [ 13] = "spaceskip",
+    [ 14] = "xspaceskip",
+    [ 15] = "parfillskip",
+    [ 16] = "thinmuskip",
+    [ 17] = "medmuskip",
+    [ 18] = "thickmuskip",
+    [100] = "leaders",
+    [101] = "cleaders",
+    [102] = "xleaders",
+    [103] = "gleaders",
+})
+