From 274ca61bf7ea43543c5aea53873f22c8b598b4a9 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 20 May 2016 08:06:55 +0200 Subject: [fontloader] sync with Context as of 2016-05-22 --- src/fontloader/misc/fontloader-font-con.lua | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/fontloader/misc/fontloader-font-con.lua') diff --git a/src/fontloader/misc/fontloader-font-con.lua b/src/fontloader/misc/fontloader-font-con.lua index b118535..45ecdd6 100644 --- a/src/fontloader/misc/fontloader-font-con.lua +++ b/src/fontloader/misc/fontloader-font-con.lua @@ -10,7 +10,6 @@ if not modules then modules = { } end modules ['font-con'] = { local next, tostring, rawget = next, tostring, rawget local format, match, lower, gsub = string.format, string.match, string.lower, string.gsub -local utfbyte = utf.byte local sort, insert, concat, sortedkeys, serialize, fastcopy = table.sort, table.insert, table.concat, table.sortedkeys, table.serialize, table.fastcopy local derivetable = table.derive @@ -1286,7 +1285,6 @@ function constructors.initializefeatures(what,tfmdata,features,trace,report) local properties = tfmdata.properties or { } -- brrr local whathandler = handlers[what] local whatfeatures = whathandler.features - local whatinitializers = whatfeatures.initializers local whatmodechecker = whatfeatures.modechecker -- properties.mode can be enforces (for instance in font-otd) local mode = properties.mode or (whatmodechecker and whatmodechecker(tfmdata,features,features.mode)) or features.mode or "base" -- cgit v1.2.3 From a8cae347b3c8a3154c36444e5d38705b59e5e57e Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 10 Jun 2016 07:43:41 +0200 Subject: [fontloader] sync with Context as of 2016-05-31 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This corresponds to commit a274872832cd on the mirror repo. The changes since then were numerous but seem to introduce a couple new files we didn’t ask for =) Later. --- src/fontloader/misc/fontloader-font-con.lua | 37 +++++++++++++++++------------ 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'src/fontloader/misc/fontloader-font-con.lua') diff --git a/src/fontloader/misc/fontloader-font-con.lua b/src/fontloader/misc/fontloader-font-con.lua index 45ecdd6..367f807 100644 --- a/src/fontloader/misc/fontloader-font-con.lua +++ b/src/fontloader/misc/fontloader-font-con.lua @@ -337,6 +337,20 @@ function constructors.enhanceparameters(parameters) } end +local function mathkerns(v,vdelta) + local k = { } + for i=1,#v do + local entry = v[i] + local height = entry.height + local kern = entry.kern + k[i] = { + height = height and vdelta*height or 0, + kern = kern and vdelta*kern or 0, + } + end + return k +end + function constructors.scale(tfmdata,specification) local target = { } -- the new table -- @@ -748,22 +762,15 @@ function constructors.scale(tfmdata,specification) chr.top_accent = vdelta*va end if stackmath then - local mk = character.mathkerns -- not in math ? + local mk = character.mathkerns if mk then - local kerns = { } - local v = mk.top_right if v then local k = { } for i=1,#v do local vi = v[i] - k[i] = { height = vdelta*vi.height, kern = vdelta*vi.kern } - end kerns.top_right = k end - local v = mk.top_left if v then local k = { } for i=1,#v do local vi = v[i] - k[i] = { height = vdelta*vi.height, kern = vdelta*vi.kern } - end kerns.top_left = k end - local v = mk.bottom_left if v then local k = { } for i=1,#v do local vi = v[i] - k[i] = { height = vdelta*vi.height, kern = vdelta*vi.kern } - end kerns.bottom_left = k end - local v = mk.bottom_right if v then local k = { } for i=1,#v do local vi = v[i] - k[i] = { height = vdelta*vi.height, kern = vdelta*vi.kern } - end kerns.bottom_right = k end - chr.mathkern = kerns -- singular -> should be patched in luatex ! + local tr, tl, br, bl = mk.topright, mk.topleft, mk.bottomright, mk.bottomleft + chr.mathkern = { -- singular -> should be patched in luatex ! + top_right = tr and mathkerns(tr,vdelta) or nil, + top_left = tl and mathkerns(tl,vdelta) or nil, + bottom_right = br and mathkerns(br,vdelta) or nil, + bottom_left = bl and mathkerns(bl,vdelta) or nil, + } end end if hasitalics then -- cgit v1.2.3 From d8ba9c36eaf49c1f28b8e8f11c969b77ece32db4 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 12 Jun 2016 18:14:33 +0200 Subject: [fontloader] sync with Context as of 2016-06-12 --- src/fontloader/misc/fontloader-font-con.lua | 51 +++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 7 deletions(-) (limited to 'src/fontloader/misc/fontloader-font-con.lua') diff --git a/src/fontloader/misc/fontloader-font-con.lua b/src/fontloader/misc/fontloader-font-con.lua index 367f807..1a0daff 100644 --- a/src/fontloader/misc/fontloader-font-con.lua +++ b/src/fontloader/misc/fontloader-font-con.lua @@ -1049,6 +1049,29 @@ function constructors.hashfeatures(specification) -- will be overloaded return "unknown" end +-- hashmethods.normal = function(list) +-- local s = { } +-- local n = 0 +-- for k, v in next, list do +-- if not k then +-- -- no need to add to hash +-- elseif k == "number" or k == "features" then +-- -- no need to add to hash (maybe we need a skip list) +-- else +-- n = n + 1 +-- s[n] = k +-- end +-- end +-- if n > 0 then +-- sort(s) +-- for i=1,n do +-- local k = s[i] +-- s[i] = k .. '=' .. tostring(list[k]) +-- end +-- return concat(s,"+") +-- end +-- end + hashmethods.normal = function(list) local s = { } local n = 0 @@ -1059,15 +1082,11 @@ hashmethods.normal = function(list) -- no need to add to hash (maybe we need a skip list) else n = n + 1 - s[n] = k + s[n] = k .. '=' .. tostring(v) end end if n > 0 then sort(s) - for i=1,n do - local k = s[i] - s[i] = k .. '=' .. tostring(list[k]) - end return concat(s,"+") end end @@ -1236,7 +1255,11 @@ function constructors.getfeatureaction(what,where,mode,name) end end -function constructors.newhandler(what) -- could be a metatable newindex +local newhandler = { } +constructors.handlers = newhandler -- downward compatible +constructors.newhandler = newhandler + +local function setnewhandler(what) -- could be a metatable newindex local handler = handlers[what] if not handler then handler = { } @@ -1245,7 +1268,16 @@ function constructors.newhandler(what) -- could be a metatable newindex return handler end -function constructors.newfeatures(what) -- could be a metatable newindex +setmetatable(newhandler, { + __call = function(t,k) local v = t[k] return v end, + __index = function(t,k) local v = setnewhandler(k) t[k] = v return v end, +}) + +local newfeatures = { } +constructors.newfeatures = newfeatures -- downward compatible +constructors.features = newfeatures + +local function setnewfeatures(what) local handler = handlers[what] local features = handler.features if not features then @@ -1265,6 +1297,11 @@ function constructors.newfeatures(what) -- could be a metatable newindex return features end +setmetatable(newfeatures, { + __call = function(t,k) local v = t[k] return v end, + __index = function(t,k) local v = setnewfeatures(k) t[k] = v return v end, +}) + --[[ldx--

We need to check for default features. For this we provide a helper function.

-- cgit v1.2.3