From 9d6e4ea26d8a2fc849fa586688bbb823a69a4b17 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Fri, 5 Nov 2010 18:00:11 +0200 Subject: Sync with context 2010.11.03 --- otfl-font-map.lua | 103 ------------------------------------------------------ otfl-font-otf.lua | 1 + otfl-font-tfm.lua | 27 ++++++++++---- otfl-luat-dum.lua | 4 +++ 4 files changed, 26 insertions(+), 109 deletions(-) diff --git a/otfl-font-map.lua b/otfl-font-map.lua index 569f3df..b206632 100644 --- a/otfl-font-map.lua +++ b/otfl-font-map.lua @@ -272,106 +272,3 @@ fonts.map.addtounicode = function(data,filename) report_otf("enhance: %s tounicode entries added (%s ligatures)",nl+ns, ns) end end - --- the following is sort of obsolete --- --- fonts.map.data = fonts.map.data or { } --- fonts.map.encodings = fonts.map.encodings or { } --- fonts.map.loaded = fonts.map.loaded or { } --- fonts.map.line = fonts.map.line or { } --- --- function fonts.map.line.pdftex(e) --- if e.name and e.fontfile then --- local fullname = e.fullname or "" --- if e.slant and e.slant ~= 0 then --- if e.encoding then --- pdf.mapline(format('= %s %s "%g SlantFont" <%s <%s',e.name,fullname,e.slant,e.encoding,e.fontfile))) --- else --- pdf.mapline(format('= %s %s "%g SlantFont" <%s',e.name,fullname,e.slant,e.fontfile))) --- end --- elseif e.extend and e.extend ~= 1 and e.extend ~= 0 then --- if e.encoding then --- pdf.mapline(format('= %s %s "%g ExtendFont" <%s <%s',e.name,fullname,e.extend,e.encoding,e.fontfile))) --- else --- pdf.mapline(format('= %s %s "%g ExtendFont" <%s',e.name,fullname,e.extend,e.fontfile))) --- end --- else --- if e.encoding then --- pdf.mapline(format('= %s %s <%s <%s',e.name,fullname,e.encoding,e.fontfile))) --- else --- pdf.mapline(format('= %s %s <%s',e.name,fullname,e.fontfile))) --- end --- end --- else --- return nil --- end --- end --- --- function fonts.map.flush(backend) -- will also erase the accumulated data --- local flushline = fonts.map.line[backend or "pdftex"] or fonts.map.line.pdftex --- for _, e in next, fonts.map.data do --- flushline(e) --- end --- fonts.map.data = { } --- end --- --- fonts.map.line.dvips = fonts.map.line.pdftex --- fonts.map.line.dvipdfmx = function() end --- --- function fonts.map.convert_entries(filename) --- if not fonts.map.loaded[filename] then --- fonts.map.data, fonts.map.encodings = fonts.map.load_file(filename,fonts.map.data, fonts.map.encodings) --- fonts.map.loaded[filename] = true --- end --- end --- --- function fonts.map.load_file(filename, entries, encodings) --- entries = entries or { } --- encodings = encodings or { } --- local f = io.open(filename) --- if f then --- local data = f:read("*a") --- if data then --- for line in gmatch(data,"(.-)[\n\t]") do --- if find(line,"^[%#%%%s]") then --- -- print(line) --- else --- local extend, slant, name, fullname, fontfile, encoding --- line = gsub(line,'"(.+)"', function(s) --- extend = find(s,'"([^"]+) ExtendFont"') --- slant = find(s,'"([^"]+) SlantFont"') --- return "" --- end) --- if not name then --- -- name fullname encoding fontfile --- name, fullname, encoding, fontfile = match(line,"^(%S+)%s+(%S*)[%s<]+(%S*)[%s<]+(%S*)%s*$") --- end --- if not name then --- -- name fullname (flag) fontfile encoding --- name, fullname, fontfile, encoding = match(line,"^(%S+)%s+(%S*)[%d%s<]+(%S*)[%s<]+(%S*)%s*$") --- end --- if not name then --- -- name fontfile --- name, fontfile = match(line,"^(%S+)%s+[%d%s<]+(%S*)%s*$") --- end --- if name then --- if encoding == "" then encoding = nil end --- entries[name] = { --- name = name, -- handy --- fullname = fullname, --- encoding = encoding, --- fontfile = fontfile, --- slant = tonumber(slant), --- extend = tonumber(extend) --- } --- encodings[name] = encoding --- elseif line ~= "" then --- -- print(line) --- end --- end --- end --- end --- f:close() --- end --- return entries, encodings --- end diff --git a/otfl-font-otf.lua b/otfl-font-otf.lua index 12a489f..25bccfa 100644 --- a/otfl-font-otf.lua +++ b/otfl-font-otf.lua @@ -43,6 +43,7 @@ local otf = fonts.otf local tfm = fonts.tfm local fontdata = fonts.ids +local chardata = characters and characters.data -- not used otf.features = otf.features or { } otf.features.list = otf.features.list or { } diff --git a/otfl-font-tfm.lua b/otfl-font-tfm.lua index 7a16b28..e8b2427 100644 --- a/otfl-font-tfm.lua +++ b/otfl-font-tfm.lua @@ -128,16 +128,31 @@ end to scale virtual characters.

--ldx]]-- +--~ function tfm.getvirtualid(tfmdata) +--~ -- since we don't know the id yet, we use 0 as signal +--~ local tf = tfmdata.fonts +--~ if not tf then +--~ tfmdata.type = "virtual" +--~ tfmdata.fonts = { { id = 0 } } +--~ return 1 +--~ else +--~ local ntf = #tf + 1 +--~ tf[ntf] = { id = 0 } +--~ return ntf +--~ end +--~ end + function tfm.getvirtualid(tfmdata) -- since we don't know the id yet, we use 0 as signal - if not tfmdata.fonts then + local tf = tfmdata.fonts + if not tf then + tf = { } tfmdata.type = "virtual" - tfmdata.fonts = { { id = 0 } } - return 1 - else - tfmdata.fonts[#tfmdata.fonts+1] = { id = 0 } - return #tfmdata.fonts + tfmdata.fonts = tf end + local ntf = #tf + 1 + tf[ntf] = { id = 0 } + return ntf end function tfm.checkvirtualid(tfmdata, id) diff --git a/otfl-luat-dum.lua b/otfl-luat-dum.lua index 675d2da..695306b 100644 --- a/otfl-luat-dum.lua +++ b/otfl-luat-dum.lua @@ -48,6 +48,10 @@ utilities = { }, } +characters = characters or { + data = { } +} + -- we need to cheat a bit here texconfig.kpse_init = true -- cgit v1.2.3