From 1ef10e57241a65e8ce2aeefdd83874e8999b7b44 Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Wed, 10 Jun 2009 20:21:00 +0300 Subject: syncing with latest ConTeXt version (more feautures, less bugs), thanks to Khaled Hosny --- otfl-font-dum.lua | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'otfl-font-dum.lua') 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 -- cgit v1.2.3