summaryrefslogtreecommitdiff
path: root/otfl-font-dum.lua
diff options
context:
space:
mode:
authorElie Roux <elie.roux@telecom-bretagne.eu>2009-06-10 20:21:00 +0300
committerElie Roux <elie.roux@telecom-bretagne.eu>2009-06-10 20:21:00 +0300
commit1ef10e57241a65e8ce2aeefdd83874e8999b7b44 (patch)
tree713769db5cdf9115e2824aa09e8f65cd795667f7 /otfl-font-dum.lua
parent5821436af1c522206c3faf90e0813415445ea6c7 (diff)
downloadluaotfload-1ef10e57241a65e8ce2aeefdd83874e8999b7b44.tar.gz
syncing with latest ConTeXt version (more feautures, less bugs), thanks to Khaled Hosny
Diffstat (limited to 'otfl-font-dum.lua')
-rw-r--r--otfl-font-dum.lua30
1 files changed, 29 insertions, 1 deletions
diff --git a/otfl-font-dum.lua b/otfl-font-dum.lua
index 0dedc85..0d28128 100644
--- a/otfl-font-dum.lua
+++ b/otfl-font-dum.lua
@@ -72,14 +72,42 @@ function fonts.names.resolve(name,sub)
end
loaded = true
end
- if type(data) == "table" and data.version == 1.07 then
+ if type(data) == "table" and data.version == 1.08 then
local condensed = string.gsub(name,"[^%a%d]","")
local found = data.mapping and data.mapping[condensed]
if found then
local filename, is_sub = found[3], found[4]
+ if is_sub then is_sub = found[2] end
return filename, is_sub
else
return name, false -- fallback to filename
end
end
end
+
+-- For the moment we put this (adapted) pseudo feature here.
+
+table.insert(fonts.triggers,"itlc")
+
+local function itlc(tfmdata,value)
+ if value then
+ -- the magic 40 and it formula come from Dohyun Kim
+ local metadata = tfmdata.shared.otfdata.metadata
+ if metadata then
+ local italicangle = metadata.italicangle
+ if italicangle and italicangle ~= 0 then
+ local uwidth = (metadata.uwidth or 40)/2
+ for unicode, d in next, tfmdata.descriptions do
+ local it = d.boundingbox[3] - d.width + uwidth
+ if it ~= 0 then
+ d.italic = it
+ end
+ end
+ tfmdata.has_italic = true
+ end
+ end
+ end
+end
+
+fonts.initializers.base.otf.itlc = itlc
+fonts.initializers.node.otf.itlc = itlc