summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/lpdf-lmt.lmt
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl/lpdf-lmt.lmt')
-rw-r--r--tex/context/base/mkxl/lpdf-lmt.lmt100
1 files changed, 51 insertions, 49 deletions
diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt
index ce938a5c2..590d69c58 100644
--- a/tex/context/base/mkxl/lpdf-lmt.lmt
+++ b/tex/context/base/mkxl/lpdf-lmt.lmt
@@ -434,23 +434,54 @@ do
-- luatex where we have more widths arrays and these reflect the cheated
-- widths (goes wrong elsewhere).
+-- local naturalwidths = setmetatableindex(function(t,font)
+-- local d = descriptions[font]
+-- local c = characters[font]
+-- local f = parameters[font].hfactor or parameters[font].factor
+-- local v = setmetatableindex(function(t,char)
+-- local w
+-- local e = d and d[char]
+-- if e then
+-- w = e.width
+-- if w then
+-- w = w * f
+-- end
+-- end
+-- if not w then
+-- e = c and c[char]
+-- if e then
+-- w = e.width or 0
+-- end
+-- end
+-- if not w then
+-- w = 0
+-- end
+-- t[char] = w
+-- return w
+-- end)
+-- t[font] = v
+-- return v
+-- end)
+
+ -- when changing this, check math: compact-001.tex (rule width)
+
local naturalwidths = setmetatableindex(function(t,font)
local d = descriptions[font]
local c = characters[font]
local f = parameters[font].hfactor or parameters[font].factor
local v = setmetatableindex(function(t,char)
local w
- local e = d and d[char]
+ local e = c and c[char]
if e then
- w = e.width
- if w then
- w = w * f
- end
+ w = e.width or 0
end
if not w then
- e = c and c[char]
+ e = d and d[char]
if e then
- w = e.width or 0
+ w = e.width
+ if w then
+ w = w * f
+ end
end
end
if not w then
@@ -463,42 +494,6 @@ do
return v
end)
- -- when changing this, check math: compact-001.tex (rule width)
-
--- this goes wrong with adapted widths in (virtual) fonts so we really
--- need the above ..
---
--- so, what was the failing test? if so, maybe adapt threshold (now 10pt)
-
--- local xnaturalwidths = setmetatableindex(function(t,font)
--- local d = descriptions[font]
--- local c = characters[font]
--- local f = parameters[font].hfactor or parameters[font].factor
--- local v = setmetatableindex(function(t,char)
--- local w
--- local e = c and c[char]
--- if e then
--- w = e.width or 0
--- end
--- if not w then
--- e = d and d[char]
--- if e then
--- w = e.width
--- if w then
--- w = w * f
--- end
--- end
--- end
--- if not w then
--- w = 0
--- end
--- t[char] = w
--- return w
--- end)
--- t[font] = v
--- return v
--- end)
-
local function setup_fontparameters(font,factor,f,e,sx,sy)
local slant = fontparameters.slantfactor or 0
local extend = fontparameters.extendfactor or 1
@@ -520,6 +515,7 @@ do
cur_f = f
cur_e = e
tj_delta = 0
+ cw = 0
f_x_scale = 1.0
f_y_scale = 1.0
fs = fontparameters.size * bpfactor
@@ -632,12 +628,12 @@ do
local move = calc_pdfpos(pos_h,pos_v)
- -- if trace_threshold then
- -- report(
- -- "font %i, char %C, factor %i, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p",
- -- font,char,factor,naturalwidth[char],move,need_tm,pos_h,tj_delta,threshold,cw
- -- )
- -- end
+if trace_threshold then
+ report(
+ "before: font %i, char %C, factor %i, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p",
+ font,char,factor,naturalwidth[char],move,need_tm,pos_h,tj_delta,threshold,cw
+ )
+end
if move or need_tm then
if not need_tm then
@@ -677,6 +673,12 @@ do
end
end
+if trace_threshold then
+ report(
+ "after : font %i, char %C, factor %i, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p",
+ font,char,factor,naturalwidth[char],move,need_tm,pos_h,tj_delta,threshold,cw
+ )
+end
if mode == "chararray" then
begin_charmode()
end