summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2015-04-13 00:11:28 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2015-04-13 00:11:28 +0200
commitd843b6cca2d31197c6d416293bce344c911fbbfb (patch)
treedf706772746ccce95f668d840028ab280307b477
parentf56b879cebfc6e9d1c67a8da6013777e7379c185 (diff)
downloadluaotfload-d843b6cca2d31197c6d416293bce344c911fbbfb.tar.gz
[fontloader] sync with Context as of 2015-04-13
-rw-r--r--src/fontloader/misc/fontloader-font-con.lua22
-rw-r--r--src/fontloader/misc/fontloader-font-otf.lua33
-rw-r--r--src/fontloader/misc/fontloader-l-lpeg.lua26
-rw-r--r--src/fontloader/runtime/fontloader-fontloader.lua52
4 files changed, 99 insertions, 34 deletions
diff --git a/src/fontloader/misc/fontloader-font-con.lua b/src/fontloader/misc/fontloader-font-con.lua
index bb96912..72fbb5c 100644
--- a/src/fontloader/misc/fontloader-font-con.lua
+++ b/src/fontloader/misc/fontloader-font-con.lua
@@ -507,6 +507,7 @@ function constructors.scale(tfmdata,specification)
local nonames = properties.noglyphnames
local haskerns = properties.haskerns or properties.mode == "base" -- we can have afm in node mode
local hasligatures = properties.hasligatures or properties.mode == "base" -- we can have afm in node mode
+ local realdimensions = properties.realdimensions
--
if changed and not next(changed) then
changed = false
@@ -618,6 +619,27 @@ function constructors.scale(tfmdata,specification)
local width = description.width
local height = description.height
local depth = description.depth
+ if realdimensions then
+ -- this is mostly for checking issues
+ if not height or height == 0 then
+ local bb = description.boundingbox
+ local ht = bb[4]
+ if ht ~= 0 then
+ height = ht
+ end
+ if not depth or depth == 0 then
+ local dp = -bb[2]
+ if dp ~= 0 then
+ depth = dp
+ end
+ end
+ elseif not depth or depth == 0 then
+ local dp = -description.boundingbox[2]
+ if dp ~= 0 then
+ depth = dp
+ end
+ end
+ end
if width then width = hdelta*width else width = scaledwidth end
if height then height = vdelta*height else height = scaledheight end
-- if depth then depth = vdelta*depth else depth = scaleddepth end
diff --git a/src/fontloader/misc/fontloader-font-otf.lua b/src/fontloader/misc/fontloader-font-otf.lua
index c7e83a4..85eebaa 100644
--- a/src/fontloader/misc/fontloader-font-otf.lua
+++ b/src/fontloader/misc/fontloader-font-otf.lua
@@ -107,6 +107,7 @@ registerdirective("fonts.otf.loader.pack", function(v) packdata =
registerdirective("fonts.otf.loader.syncspace", function(v) syncspace = v end)
registerdirective("fonts.otf.loader.forcenotdef", function(v) forcenotdef = v end)
registerdirective("fonts.otf.loader.overloadkerns", function(v) overloadkerns = v end)
+-----------------("fonts.otf.loader.alldimensions", function(v) alldimensions = v end)
function otf.fileformat(filename)
local leader = lower(io.loadchunk(filename,4))
@@ -637,17 +638,27 @@ actions["add dimensions"] = function(data,filename)
-- d.name = ".notdef"
-- end
if bb then
- local ht, dp = bb[4], -bb[2]
- if ht == 0 or ht < 0 then
- -- not set
- else
- d.height = ht
- end
- if dp == 0 or dp < 0 then
- -- not set
- else
- d.depth = dp
- end
+ local ht = bb[4]
+ local dp = -bb[2]
+ -- if alldimensions then
+ -- if ht ~= 0 then
+ -- d.height = ht
+ -- end
+ -- if dp ~= 0 then
+ -- d.depth = dp
+ -- end
+ -- else
+ if ht == 0 or ht < 0 then
+ -- not set
+ else
+ d.height = ht
+ end
+ if dp == 0 or dp < 0 then
+ -- not set
+ else
+ d.depth = dp
+ end
+ -- end
end
end
end
diff --git a/src/fontloader/misc/fontloader-l-lpeg.lua b/src/fontloader/misc/fontloader-l-lpeg.lua
index 9225b57..4aadadb 100644
--- a/src/fontloader/misc/fontloader-l-lpeg.lua
+++ b/src/fontloader/misc/fontloader-l-lpeg.lua
@@ -841,7 +841,7 @@ local function make(t)
local function making(t)
local p = p_false
local keys = sortedkeys(t)
- local okay = t[""]
+-- local okay = t[""]
for i=1,#keys do
local k = keys[i]
if k ~= "" then
@@ -850,13 +850,16 @@ local function make(t)
p = p + P(k) * p_true
elseif v == false then
-- can't happen
- elseif okay then
- p = p + P(k) * (making(v) + p_true)
+-- elseif okay then
+-- p = p + P(k) * (making(v) + p_true)
else
p = p + P(k) * making(v)
end
end
end
+ if t[""] then
+ p = p + p_true
+ end
return p
end
local p = p_false
@@ -869,8 +872,8 @@ local function make(t)
p = p + P(k) * p_true
elseif v == false then
-- can't happen
- elseif v[""] then
- p = p + P(k) * (making(v) + p_true)
+-- elseif v[""] then
+-- p = p + P(k) * (making(v) + p_true)
else
p = p + P(k) * making(v)
end
@@ -956,10 +959,11 @@ function lpeg.utfchartabletopattern(list) -- goes to util-lpg
return make(tree)
end
--- local t = { "a", "abc", "ac", "abe", "abxyz", "xy", "bef" }
+-- local t = { "a", "abc", "ac", "abe", "abxyz", "xy", "bef","aa" }
-- local p = lpeg.Cs((lpeg.utfchartabletopattern(t)/string.upper + 1)^1)
---
+
-- inspect(lpegmatch(p,"a"))
+-- inspect(lpegmatch(p,"aa"))
-- inspect(lpegmatch(p,"aaaa"))
-- inspect(lpegmatch(p,"ac"))
-- inspect(lpegmatch(p,"bc"))
@@ -974,6 +978,14 @@ end
-- inspect(lpegmatch(p,"abxyz"))
-- inspect(lpegmatch(p,"foobarbefcrap"))
+-- local t = { ["^"] = 1, ["^^"] = 2, ["^^^"] = 3, ["^^^^"] = 4 }
+-- local p = lpeg.Cs((lpeg.utfchartabletopattern(t)/t + 1)^1)
+-- inspect(lpegmatch(p," ^ ^^ ^^^ ^^^^ ^^^^^ ^^^^^^ ^^^^^^^ "))
+
+-- local t = { ["^^"] = 2, ["^^^"] = 3, ["^^^^"] = 4 }
+-- local p = lpeg.Cs((lpeg.utfchartabletopattern(t)/t + 1)^1)
+-- inspect(lpegmatch(p," ^ ^^ ^^^ ^^^^ ^^^^^ ^^^^^^ ^^^^^^^ "))
+
-- lpeg.utfchartabletopattern {
-- utfchar(0x00A0), -- nbsp
-- utfchar(0x2000), -- enquad
diff --git a/src/fontloader/runtime/fontloader-fontloader.lua b/src/fontloader/runtime/fontloader-fontloader.lua
index b47d49e..448846b 100644
--- a/src/fontloader/runtime/fontloader-fontloader.lua
+++ b/src/fontloader/runtime/fontloader-fontloader.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 03/28/15 22:37:53
+-- merge date : 04/12/15 15:41:22
do -- begin closure to overcome local limits and interference
@@ -666,7 +666,6 @@ local function make(t)
local function making(t)
local p=p_false
local keys=sortedkeys(t)
- local okay=t[""]
for i=1,#keys do
local k=keys[i]
if k~="" then
@@ -674,13 +673,14 @@ local function make(t)
if v==true then
p=p+P(k)*p_true
elseif v==false then
- elseif okay then
- p=p+P(k)*(making(v)+p_true)
else
p=p+P(k)*making(v)
end
end
end
+ if t[""] then
+ p=p+p_true
+ end
return p
end
local p=p_false
@@ -692,8 +692,6 @@ local function make(t)
if v==true then
p=p+P(k)*p_true
elseif v==false then
- elseif v[""] then
- p=p+P(k)*(making(v)+p_true)
else
p=p+P(k)*making(v)
end
@@ -4393,7 +4391,8 @@ function constructors.scale(tfmdata,specification)
local stackmath=not properties.nostackmath
local nonames=properties.noglyphnames
local haskerns=properties.haskerns or properties.mode=="base"
- local hasligatures=properties.hasligatures or properties.mode=="base"
+ local hasligatures=properties.hasligatures or properties.mode=="base"
+ local realdimensions=properties.realdimensions
if changed and not next(changed) then
changed=false
end
@@ -4474,6 +4473,26 @@ function constructors.scale(tfmdata,specification)
local width=description.width
local height=description.height
local depth=description.depth
+ if realdimensions then
+ if not height or height==0 then
+ local bb=description.boundingbox
+ local ht=bb[4]
+ if ht~=0 then
+ height=ht
+ end
+ if not depth or depth==0 then
+ local dp=-bb[2]
+ if dp~=0 then
+ depth=dp
+ end
+ end
+ elseif not depth or depth==0 then
+ local dp=-description.boundingbox[2]
+ if dp~=0 then
+ depth=dp
+ end
+ end
+ end
if width then width=hdelta*width else width=scaledwidth end
if height then height=vdelta*height else height=scaledheight end
if depth and depth~=0 then
@@ -7609,15 +7628,16 @@ actions["add dimensions"]=function(data,filename)
report_otf("mark %a with width %b found in %a",d.name or "<noname>",wd,basename)
end
if bb then
- local ht,dp=bb[4],-bb[2]
- if ht==0 or ht<0 then
- else
- d.height=ht
- end
- if dp==0 or dp<0 then
- else
- d.depth=dp
- end
+ local ht=bb[4]
+ local dp=-bb[2]
+ if ht==0 or ht<0 then
+ else
+ d.height=ht
+ end
+ if dp==0 or dp<0 then
+ else
+ d.depth=dp
+ end
end
end
end