summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/node-fnt.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-04-11 10:29:07 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-04-11 10:29:07 +0200
commit57a61e4673116076f5bbff7600e6dad376af9173 (patch)
tree8261af49f1576dcfea0f152300d22e1a64ae907f /tex/context/base/mkiv/node-fnt.lua
parent274c32699e7826f7590248f91aa1bfbf5b07c8ee (diff)
downloadcontext-57a61e4673116076f5bbff7600e6dad376af9173.tar.gz
2016-04-10 23:57:00
Diffstat (limited to 'tex/context/base/mkiv/node-fnt.lua')
-rw-r--r--tex/context/base/mkiv/node-fnt.lua49
1 files changed, 37 insertions, 12 deletions
diff --git a/tex/context/base/mkiv/node-fnt.lua b/tex/context/base/mkiv/node-fnt.lua
index 76273cfd6..c726cdb4c 100644
--- a/tex/context/base/mkiv/node-fnt.lua
+++ b/tex/context/base/mkiv/node-fnt.lua
@@ -13,12 +13,13 @@ local concat, keys = table.concat, table.keys
local nodes, node, fonts = nodes, node, fonts
-local trace_characters = false trackers .register("nodes.characters", function(v) trace_characters = v end)
-local trace_fontrun = false trackers .register("nodes.fontrun", function(v) trace_fontrun = v end)
-local trace_variants = false trackers .register("nodes.variants", function(v) trace_variants = v end)
+local trace_characters = false trackers.register("nodes.characters", function(v) trace_characters = v end)
+local trace_fontrun = false trackers.register("nodes.fontrun", function(v) trace_fontrun = v end)
+local trace_variants = false trackers.register("nodes.variants", function(v) trace_variants = v end)
-local force_discrun = true directives.register("nodes.discrun", function(v) force_discrun = v end)
-local force_basepass = true directives.register("nodes.basepass", function(v) force_basepass = v end)
+local force_discrun = true directives.register("nodes.discrun", function(v) force_discrun = v end)
+local force_boundaryrun = true directives.register("nodes.boundaryrun", function(v) force_boundaryrun = v end)
+local force_basepass = true directives.register("nodes.basepass", function(v) force_basepass = v end)
local report_fonts = logs.reporter("fonts","processing")
@@ -58,11 +59,13 @@ local ischar = nuts.ischar -- checked
local traverse_id = nuts.traverse_id
local traverse_char = nuts.traverse_char
-local delete_node = nuts.delete
+local remove_node = nuts.remove
local protect_glyph = nuts.protect_glyph
local glyph_code = nodecodes.glyph
local disc_code = nodecodes.disc
+local boundary_code = nodecodes.boundary
+local word_boundary = nodes.boundarycodes.word
local setmetatableindex = table.setmetatableindex
@@ -185,6 +188,8 @@ function handlers.characters(head)
report_fonts("font %03i, dynamic %03i, glyph %C",font,attr,char)
elseif id == disc_code then
report_fonts("[disc] %s",nodes.listtoutf(n,true,false,n))
+ elseif id == boundary_code then
+ report_fonts("[boundary] %i:%i",getsubtype(n),getfield(n,"value"))
else
report_fonts("[%s]",nodecodes[id])
end
@@ -268,15 +273,34 @@ function handlers.characters(head)
end
end
+ if force_boundaryrun then
+
+ -- we can inject wordboundaries and then let the hyphenator do its work
+ -- but we need to get rid of those nodes in order to build ligatures
+ -- and kern (a rather context thing)
+
+ for b in traverse_id(boundary_code,nuthead) do
+ if getsubtype(b) == word_boundary then
+ if redundant then
+ redundant[#redundant+1] = b
+ else
+ redundant = { b }
+ end
+ end
+ end
+
+ end
+
if redundant then
+ local front = nuthead == redundant[1]
for i=1,#redundant do
- delete_node(nuthead,n)
+ nuthead = remove_node(nuthead,redundant[i],true)
+ end
+ if front then
+ head = tonode(nuthead)
end
end
- -- could be an optional pass : seldom needed, only for documentation as a discretionary
- -- with pre/post/replace will normally not occur on it's own
-
local e = 0
if force_discrun then
@@ -341,9 +365,10 @@ function handlers.characters(head)
report_fonts()
report_fonts("statics : %s",u > 0 and concat(keys(usedfonts)," ") or "none")
report_fonts("dynamics: %s",a > 0 and concat(keys(attrfonts)," ") or "none")
- report_fonts("built-in: %s",b > 0 and b or "none")
+ report_fonts("built-in: %s",b > 0 and b or "none")
+ report_fonts("removed : %s",redundant and #redundant > 0 and #redundant or "none")
if expanders then
- report_fonts("expanded: %s",e > 0 and e or "none")
+ report_fonts("expanded: %s",e > 0 and e or "none")
end
report_fonts()
end