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-tfm.lua | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'otfl-font-tfm.lua') diff --git a/otfl-font-tfm.lua b/otfl-font-tfm.lua index ab8a4db..9210fee 100644 --- a/otfl-font-tfm.lua +++ b/otfl-font-tfm.lua @@ -101,10 +101,8 @@ function tfm.read_from_tfm(specification) end tfm.enhance(tfmdata,specification) end - else - if trace_defining then - logs.report("define font","loading tfm with name %s fails",specification.name) - end + elseif trace_defining then + logs.report("define font","loading tfm with name %s fails",specification.name) end return tfmdata end @@ -226,6 +224,10 @@ end local charactercache = { } +-- The scaler is only used for otf and afm and virtual fonts. If +-- a virtual font has italic correction make sur eto set the +-- has_italic flag. Some more flags will be added in the future. + function tfm.do_scale(tfmtable, scaledpoints) tfm.prepare_base_kerns(tfmtable) -- optimalization if scaledpoints < 0 then @@ -246,6 +248,7 @@ function tfm.do_scale(tfmtable, scaledpoints) local hasmath = tfmtable.math_parameters ~= nil or tfmtable.MathConstants ~= nil local nodemode = tfmtable.mode == "node" local hasquality = tfmtable.auto_expand or tfmtable.auto_protrude + local hasitalic = tfmtable.has_italic -- t.parameters = { } t.characters = { } @@ -372,9 +375,11 @@ function tfm.do_scale(tfmtable, scaledpoints) end end -- todo: hasitalic - local vi = description.italic or v.italic - if vi then - chr.italic = vi*delta + if hasitalic then + local vi = description.italic or v.italic + if vi and vi ~= 0 then + chr.italic = vi*delta + end end -- to be tested if hasmath then @@ -531,10 +536,14 @@ function tfm.do_scale(tfmtable, scaledpoints) if not tp[22] then tp[22] = 0 end -- mathaxisheight if t.MathConstants then t.MathConstants.AccentBaseHeight = nil end -- safeguard t.tounicode = 1 + t.cidinfo = tfmtable.cidinfo -- we have t.name=metricfile and t.fullname=RealName and t.filename=diskfilename -- when collapsing fonts, luatex looks as both t.name and t.fullname as ttc files -- can have multiple subfonts --~ collectgarbage("collect") +--~ t.fontname = t.fontname or t.fullname +--~ t.name = t.name or t.fontname +--~ print(t.fullname,table.serialize(characters[string.byte('W')].kerns)) return t, delta end -- cgit v1.2.3