diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2016-06-12 18:14:33 +0200 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2016-06-12 18:14:33 +0200 |
commit | d8ba9c36eaf49c1f28b8e8f11c969b77ece32db4 (patch) | |
tree | d4cdef7062d4d75734c9a170afc861ae14858a32 /src/fontloader/misc | |
parent | 3bbb743eb16f83c118776a7689b4826911c41bb1 (diff) | |
download | luaotfload-d8ba9c36eaf49c1f28b8e8f11c969b77ece32db4.tar.gz |
[fontloader] sync with Context as of 2016-06-12
Diffstat (limited to 'src/fontloader/misc')
-rw-r--r-- | src/fontloader/misc/fontloader-font-con.lua | 51 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-dsp.lua | 144 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-map.lua | 4 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-one.lua | 6 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-osd.lua | 2 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-ota.lua | 2 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-otd.lua | 48 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-oti.lua | 4 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-otj.lua | 2 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-otl.lua | 28 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-otr.lua | 37 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-ots.lua | 15 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-oup.lua | 56 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-tfm.lua | 4 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-fonts-ext.lua | 2 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-fonts.lua | 2 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-math.tex | 12 |
17 files changed, 363 insertions, 56 deletions
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-- <p>We need to check for default features. For this we provide a helper function.</p> diff --git a/src/fontloader/misc/fontloader-font-dsp.lua b/src/fontloader/misc/fontloader-font-dsp.lua index 37ae166..9726c51 100644 --- a/src/fontloader/misc/fontloader-font-dsp.lua +++ b/src/fontloader/misc/fontloader-font-dsp.lua @@ -76,6 +76,7 @@ local readshort = streamreader.readinteger2 -- 16-bit signed integer local readfword = readshort local readstring = streamreader.readstring local readtag = streamreader.readtag +local readbytes = streamreader.readbytes local gsubhandlers = { } local gposhandlers = { } @@ -2191,7 +2192,7 @@ function readers.math(f,fontdata,specification) setposition(f,tableoffset) local version = readulong(f) if version ~= 0x00010000 then - report("table version %a of %a is not supported (yet), maybe font %s is bad",version,what,fontdata.filename) + report("table version %a of %a is not supported (yet), maybe font %s is bad",version,"math",fontdata.filename) return end local constants = readushort(f) @@ -2211,3 +2212,144 @@ function readers.math(f,fontdata,specification) end end end + +function readers.colr(f,fontdata,specification) + if specification.details then + local datatable = fontdata.tables.colr + if datatable then + local tableoffset = datatable.offset + setposition(f,tableoffset) + local version = readushort(f) + if version ~= 0 then + report("table version %a of %a is not supported (yet), maybe font %s is bad",version,"colr",fontdata.filename) + return + end + if not fontdata.tables.cpal then + report("color table %a in font %a has no mandate %a table","colr",fontdata.filename,"cpal") + fontdata.colorpalettes = { } + end + local glyphs = fontdata.glyphs + local nofglyphs = readushort(f) + local baseoffset = readulong(f) + local layeroffset = readulong(f) + local noflayers = readushort(f) + local layerrecords = { } + local maxclass = 0 + -- The special value 0xFFFF is foreground (but we index from 1). It + -- more looks like indices into a palette so 'class' is a better name + -- than 'palette'. + setposition(f,tableoffset + layeroffset) + for i=1,noflayers do + local slot = readushort(f) + local class = readushort(f) + if class < 0xFFFF then + class = class + 1 + if class > maxclass then + maxclass = class + end + end + layerrecords[i] = { + slot = slot, + class = class, + } + end + fontdata.maxcolorclass = maxclass + setposition(f,tableoffset + baseoffset) + for i=0,nofglyphs-1 do + local glyphindex = readushort(f) + local firstlayer = readushort(f) + local noflayers = readushort(f) + local t = { } + for i=1,noflayers do + t[i] = layerrecords[firstlayer+i] + end + glyphs[glyphindex].colors = t + end + end + end +end + +function readers.cpal(f,fontdata,specification) + if specification.details then + local datatable = fontdata.tables.cpal + if datatable then + local tableoffset = datatable.offset + setposition(f,tableoffset) + local version = readushort(f) + if version > 1 then + report("table version %a of %a is not supported (yet), maybe font %s is bad",version,"cpal",fontdata.filename) + return + end + local nofpaletteentries = readushort(f) + local nofpalettes = readushort(f) + local nofcolorrecords = readushort(f) + local firstcoloroffset = readulong(f) + local colorrecords = { } + local palettes = { } + for i=1,nofpalettes do + palettes[i] = readushort(f) + end + if version == 1 then + -- used for guis + local palettettypesoffset = readulong(f) + local palettelabelsoffset = readulong(f) + local paletteentryoffset = readulong(f) + end + setposition(f,tableoffset+firstcoloroffset) + for i=1,nofcolorrecords do + local b, g, r, a = readbytes(f,4) + colorrecords[i] = { + r, g, b, a ~= 255 and a or nil, + } + end + for i=1,nofpalettes do + local p = { } + local o = palettes[i] + for j=1,nofpaletteentries do + p[j] = colorrecords[o+j] + end + palettes[i] = p + end + fontdata.colorpalettes = palettes + end + end +end + +function readers.svg(f,fontdata,specification) + if specification.details then + local datatable = fontdata.tables.svg + if datatable then + local tableoffset = datatable.offset + setposition(f,tableoffset) + local version = readushort(f) + if version ~= 0 then + report("table version %a of %a is not supported (yet), maybe font %s is bad",version,"svg",fontdata.filename) + return + end + local glyphs = fontdata.glyphs + local indexoffset = tableoffset + readulong(f) + local reserved = readulong(f) + setposition(f,indexoffset) + local nofentries = readushort(f) + local entries = { } + for i=1,nofentries do + entries[i] = { + first = readushort(f), + last = readushort(f), + offset = indexoffset + readulong(f), + length = readulong(f), + } + end + for i=1,nofentries do + local entry = entries[i] + setposition(f,entry.offset) + entries[i] = { + first = entry.first, + last = entry.last, + data = readstring(f,entry.length) + } + end + fontdata.svgshapes = entries + end + end +end diff --git a/src/fontloader/misc/fontloader-font-map.lua b/src/fontloader/misc/fontloader-font-map.lua index db43495..6151b37 100644 --- a/src/fontloader/misc/fontloader-font-map.lua +++ b/src/fontloader/misc/fontloader-font-map.lua @@ -139,7 +139,7 @@ local f_double = formatters["%04X%04X"] -- end -- end -local function tounicode16(unicode,name) +local function tounicode16(unicode) if unicode < 0xD7FF or (unicode > 0xDFFF and unicode <= 0xFFFF) then return f_single(unicode) else @@ -148,7 +148,7 @@ local function tounicode16(unicode,name) end end -local function tounicode16sequence(unicodes,name) +local function tounicode16sequence(unicodes) local t = { } for l=1,#unicodes do local u = unicodes[l] diff --git a/src/fontloader/misc/fontloader-font-one.lua b/src/fontloader/misc/fontloader-font-one.lua index a9f78f4..a6f47e8 100644 --- a/src/fontloader/misc/fontloader-font-one.lua +++ b/src/fontloader/misc/fontloader-font-one.lua @@ -45,14 +45,14 @@ local definers = fonts.definers local readers = fonts.readers local constructors = fonts.constructors -local afm = constructors.newhandler("afm") -local pfb = constructors.newhandler("pfb") +local afm = constructors.handlers.afm +local pfb = constructors.handlers.pfb local otf = fonts.handlers.otf local otfreaders = otf.readers local otfenhancers = otf.enhancers -local afmfeatures = constructors.newfeatures("afm") +local afmfeatures = constructors.features.afm local registerafmfeature = afmfeatures.register afm.version = 1.512 -- incrementing this number one up will force a re-cache diff --git a/src/fontloader/misc/fontloader-font-osd.lua b/src/fontloader/misc/fontloader-font-osd.lua index d2bb210..a3dda67 100644 --- a/src/fontloader/misc/fontloader-font-osd.lua +++ b/src/fontloader/misc/fontloader-font-osd.lua @@ -82,7 +82,7 @@ local otf = fonts.handlers.otf local handlers = otf.handlers local methods = fonts.analyzers.methods -local otffeatures = fonts.constructors.newfeatures("otf") +local otffeatures = fonts.constructors.features.otf local registerotffeature = otffeatures.register local nuts = nodes.nuts diff --git a/src/fontloader/misc/fontloader-font-ota.lua b/src/fontloader/misc/fontloader-font-ota.lua index 42566eb..4ddb831 100644 --- a/src/fontloader/misc/fontloader-font-ota.lua +++ b/src/fontloader/misc/fontloader-font-ota.lua @@ -55,7 +55,7 @@ local fontdata = fonts.hashes.identifiers local categories = characters and characters.categories or { } -- sorry, only in context local chardata = characters and characters.data -local otffeatures = fonts.constructors.newfeatures("otf") +local otffeatures = fonts.constructors.features.otf local registerotffeature = otffeatures.register --[[ldx-- diff --git a/src/fontloader/misc/fontloader-font-otd.lua b/src/fontloader/misc/fontloader-font-otd.lua index fc5ba64..64cb1bc 100644 --- a/src/fontloader/misc/fontloader-font-otd.lua +++ b/src/fontloader/misc/fontloader-font-otd.lua @@ -132,6 +132,10 @@ local wildcard = "*" -- needs checking: some added features can pass twice +local P, C, Cc, lpegmatch = lpeg.P, lpeg.C, lpeg.Cc, lpeg.match + +local pattern = P("always") * (P(-1) * Cc(true) + P(":") * C((1-P(-1))^1)) + local function initialize(sequence,script,language,s_enabled,a_enabled,font,attr,dynamic,ra,autoscript,autolanguage) local features = sequence.features if features then @@ -148,21 +152,34 @@ local function initialize(sequence,script,language,s_enabled,a_enabled,font,attr e_e = s_enabled and s_enabled[kind] -- the value (font) end if e_e then - local scripts = features[kind] -- - local languages = scripts[script] or scripts[wildcard] - if not languages and autoscript then - langages = defaultscript(featuretype,autoscript,scripts) - end - if languages then - -- we need detailed control over default becase we want to trace - -- only first attribute match check, so we assume simple fina's - local valid = false - if languages[language] then - valid = e_e - elseif languages[wildcard] then - valid = e_e - elseif autolanguage and defaultlanguage(featuretype,autolanguage,languages) then - valid = e_e + local valid = type(e_e) == "string" and lpegmatch(pattern,e_e) + if valid then + -- we have hit always + local attribute = autofeatures[kind] or false + if trace_applied then + report_process( + "font %s, dynamic %a (%a), feature %a, script %a, language %a, lookup %a, value %a", + font,attr or 0,dynamic,kind,"*","*",sequence.name,valid) + end + ra[#ra+1] = { valid, attribute, sequence, kind } + else + -- we already checked for e_e + local scripts = features[kind] -- + local languages = scripts[script] or scripts[wildcard] + if not languages and autoscript then + langages = defaultscript(featuretype,autoscript,scripts) + end + if languages then + -- we need detailed control over default becase we want to trace + -- only first attribute match check, so we assume simple fina's + -- local valid = false + if languages[language] then + valid = e_e + elseif languages[wildcard] then + valid = e_e + elseif autolanguage and defaultlanguage(featuretype,autolanguage,languages) then + valid = e_e + end end if valid then local attribute = autofeatures[kind] or false @@ -241,6 +258,7 @@ function otf.dataset(tfmdata,font,attr) -- attr only when explicit (as in specia local autoscript = (s_enabled and s_enabled.autoscript ) or (a_enabled and a_enabled.autoscript ) local autolanguage = (s_enabled and s_enabled.autolanguage) or (a_enabled and a_enabled.autolanguage) for s=1,#sequences do + -- just return nil or ra step initialize(sequences[s],script,language,s_enabled,a_enabled,font,attr,dynamic,ra,autoscript,autolanguage) end end diff --git a/src/fontloader/misc/fontloader-font-oti.lua b/src/fontloader/misc/fontloader-font-oti.lua index bacd001..d74d2d5 100644 --- a/src/fontloader/misc/fontloader-font-oti.lua +++ b/src/fontloader/misc/fontloader-font-oti.lua @@ -11,8 +11,8 @@ local lower = string.lower local fonts = fonts local constructors = fonts.constructors -local otf = constructors.newhandler("otf") -local otffeatures = constructors.newfeatures("otf") +local otf = constructors.handlers.otf +local otffeatures = constructors.features.otf local registerotffeature = otffeatures.register local otftables = otf.tables or { } diff --git a/src/fontloader/misc/fontloader-font-otj.lua b/src/fontloader/misc/fontloader-font-otj.lua index 0db30c6..d1408fd 100644 --- a/src/fontloader/misc/fontloader-font-otj.lua +++ b/src/fontloader/misc/fontloader-font-otj.lua @@ -24,6 +24,8 @@ if not modules then modules = { } end modules ['font-otj'] = { -- The use_advance code is just a test and is meant for testing and manuals. There is no -- performance (or whatever) gain and using kerns is somewhat cleaner (at least for now). +-- Maybe: subtype fontkern when pure kerns. + if not nodes.properties then return end local next, rawget = next, rawget diff --git a/src/fontloader/misc/fontloader-font-otl.lua b/src/fontloader/misc/fontloader-font-otl.lua index 73e3df9..c7c278a 100644 --- a/src/fontloader/misc/fontloader-font-otl.lua +++ b/src/fontloader/misc/fontloader-font-otl.lua @@ -53,8 +53,12 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.021 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.022 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) +otf.svgcache = containers.define("fonts", "svg", otf.version, true) +otf.pdfcache = containers.define("fonts", "pdf", otf.version, true) + +otf.svgenabled = false local otfreaders = otf.readers @@ -63,7 +67,7 @@ local definers = fonts.definers local readers = fonts.readers local constructors = fonts.constructors -local otffeatures = constructors.newfeatures("otf") +local otffeatures = constructors.features.otf local registerotffeature = otffeatures.register local enhancers = allocate() @@ -270,6 +274,25 @@ function otf.load(filename,sub,featurefile) -- second argument (format) is gone -- -- if data then + -- + local resources = data.resources + local svgshapes = resources.svgshapes + if svgshapes then + resources.svgshapes = nil + if otf.svgenabled then + local timestamp = os.date() + -- work in progress ... a bit boring to do + containers.write(otf.svgcache,hash, { + svgshapes = svgshapes, + timestamp = timestamp, + }) + data.properties.svg = { + hash = hash, + timestamp = timestamp, + } + end + end + -- otfreaders.compact(data) otfreaders.rehash(data,"unicodes") otfreaders.addunicodetable(data) @@ -346,7 +369,6 @@ end local function copytotfm(data,cache_id) if data then local metadata = data.metadata - local resources = data.resources local properties = derivetable(data.properties) local descriptions = derivetable(data.descriptions) local goodies = derivetable(data.goodies) diff --git a/src/fontloader/misc/fontloader-font-otr.lua b/src/fontloader/misc/fontloader-font-otr.lua index 6595262..e09e87d 100644 --- a/src/fontloader/misc/fontloader-font-otr.lua +++ b/src/fontloader/misc/fontloader-font-otr.lua @@ -129,12 +129,11 @@ local function readlongdatetime(f) return 0x100000000 * d + 0x1000000 * e + 0x10000 * f + 0x100 * g + h end -local tableversion = 0.004 -local privateoffset = fonts.constructors and fonts.constructors.privateoffset or 0xF0000 -- 0x10FFFF +local tableversion = 0.004 +readers.tableversion = tableversion +local privateoffset = fonts.constructors and fonts.constructors.privateoffset or 0xF0000 -- 0x10FFFF +local reportedskipped = { } -readers.tableversion = tableversion - -local reportedskipped = { } local function reportskippedtable(tag) if not reportedskipped[tag] then @@ -1657,6 +1656,26 @@ function readers.glyf(f,fontdata,specification) -- part goes to cff module end end +-- Experimental (we need fonts). + +function readers.colr(f,fontdata,specification) + if specification.details then + reportskippedtable("colr") + end +end + +function readers.cpal(f,fontdata,specification) + if specification.details then + reportskippedtable("cpal") + end +end + +function readers.svg(f,fontdata,specification) + if specification.details then + reportskippedtable("svg") + end +end + -- Here we have a table that we really need for later processing although a more advanced gpos table -- can also be available. Todo: we need a 'fake' lookup for this (analogue to ff). @@ -1997,6 +2016,9 @@ local function readdata(f,offset,specification) readers["cmap"](f,fontdata,specification) readers["loca"](f,fontdata,specification) readers["glyf"](f,fontdata,specification) + readers["colr"](f,fontdata,specification) + readers["cpal"](f,fontdata,specification) + readers["svg" ](f,fontdata,specification) readers["kern"](f,fontdata,specification) readers["gdef"](f,fontdata,specification) readers["gsub"](f,fontdata,specification) @@ -2165,7 +2187,8 @@ function readers.loadfont(filename,n) goodies = { }, metadata = getinfo(fontdata,n), -- no platformnames here ! properties = { - hasitalics = fontdata.hasitalics or false, + hasitalics = fontdata.hasitalics or false, + maxcolorclass = fontdata.maxcolorclass, }, resources = { -- filename = fontdata.filename, @@ -2182,6 +2205,8 @@ function readers.loadfont(filename,n) version = getname(fontdata,"version"), cidinfo = fontdata.cidinfo, mathconstants = fontdata.mathconstants, + colorpalettes = fontdata.colorpalettes, + svgshapes = fontdata.svgshapes, }, } end diff --git a/src/fontloader/misc/fontloader-font-ots.lua b/src/fontloader/misc/fontloader-font-ots.lua index 669668e..51704bf 100644 --- a/src/fontloader/misc/fontloader-font-ots.lua +++ b/src/fontloader/misc/fontloader-font-ots.lua @@ -124,7 +124,7 @@ local trace_cursive = false registertracker("otf.cursive", function(v local trace_preparing = false registertracker("otf.preparing", function(v) trace_preparing = v end) local trace_bugs = false registertracker("otf.bugs", function(v) trace_bugs = v end) local trace_details = false registertracker("otf.details", function(v) trace_details = v end) -local trace_applied = false registertracker("otf.applied", function(v) trace_applied = v end) +----- trace_applied = false registertracker("otf.applied", function(v) trace_applied = v end) local trace_steps = false registertracker("otf.steps", function(v) trace_steps = v end) local trace_skips = false registertracker("otf.skips", function(v) trace_skips = v end) local trace_directions = false registertracker("otf.directions", function(v) trace_directions = v end) @@ -239,7 +239,7 @@ local cursonce = true local fonthashes = fonts.hashes local fontdata = fonthashes.identifiers -local otffeatures = fonts.constructors.newfeatures("otf") +local otffeatures = fonts.constructors.features.otf local registerotffeature = otffeatures.register local onetimemessage = fonts.loggers.onetimemessage or function() end @@ -3389,9 +3389,13 @@ local function featuresprocessor(head,font,attr) end - if attr == 0 then - attr = false -- some 10% faster when no dynamics but hardly measureable on real runs - end + -- some 10% faster when no dynamics but hardly measureable on real runs .. but: it only + -- works when we have no other dynamics as otherwise the zero run will be applied to the + -- whole stream for which we then need to pass another variable which we won't + + -- if attr == 0 then + -- attr = false + -- end head = tonut(head) @@ -3484,7 +3488,6 @@ local function featuresprocessor(head,font,attr) local start = head -- local ? rlmode = 0 -- to be checked ? if nofsteps == 1 then -- happens often - local step = steps[1] local lookupcache = step.coverage if not lookupcache then diff --git a/src/fontloader/misc/fontloader-font-oup.lua b/src/fontloader/misc/fontloader-font-oup.lua index bd47e71..e2d209a 100644 --- a/src/fontloader/misc/fontloader-font-oup.lua +++ b/src/fontloader/misc/fontloader-font-oup.lua @@ -707,6 +707,19 @@ local function unifyglyphs(fontdata,usenames) end end -- + local colorpalettes = resources.colorpalettes + if colorpalettes then + for index=1,#glyphs do + local colors = glyphs[index].colors + if colors then + for i=1,#colors do + local c = colors[i] + c.slot = indices[c.slot] + end + end + end + end + -- fontdata.private = private fontdata.glyphs = nil fontdata.names = names @@ -1159,6 +1172,7 @@ function readers.pack(data) local sequences = resources.sequences local sublookups = resources.sublookups local features = resources.features + local palettes = resources.colorpalettes local chardata = characters and characters.data local descriptions = data.descriptions or data.glyphs @@ -1191,6 +1205,14 @@ function readers.pack(data) end end end + -- if palettes then + -- local color = description.color + -- if color then + -- for i=1,#color do + -- color[i] = pack_normal(color[i]) + -- end + -- end + -- end end local function packthem(sequences) @@ -1315,6 +1337,16 @@ function readers.pack(data) end end + if palettes then + for i=1,#palettes do + local p = palettes[i] + for j=1,#p do + p[j] = pack_indexed(p[j]) + end + end + + end + if not success(1,pass) then return end @@ -1462,6 +1494,7 @@ function readers.unpack(data) local sequences = resources.sequences local sublookups = resources.sublookups local features = resources.features + local palettes = resources.colorpalettes local unpacked = { } setmetatable(unpacked,unpacked_mt) for unicode, description in next, descriptions do @@ -1488,6 +1521,17 @@ function readers.unpack(data) end end end + -- if palettes then + -- local color = description.color + -- if color then + -- for i=1,#color do + -- local tv = tables[color[i]] + -- if tv then + -- color[i] = tv + -- end + -- end + -- end + -- end end local function unpackthem(sequences) @@ -1717,6 +1761,18 @@ function readers.unpack(data) end end + if palettes then + for i=1,#palettes do + local p = palettes[i] + for j=1,#p do + local tv = tables[p[j]] + if tv then + p[j] = tv + end + end + end + end + data.tables = nil end end diff --git a/src/fontloader/misc/fontloader-font-tfm.lua b/src/fontloader/misc/fontloader-font-tfm.lua index f790064..ab6d795 100644 --- a/src/fontloader/misc/fontloader-font-tfm.lua +++ b/src/fontloader/misc/fontloader-font-tfm.lua @@ -23,12 +23,12 @@ local readers = fonts.readers local constructors = fonts.constructors local encodings = fonts.encodings -local tfm = constructors.newhandler("tfm") +local tfm = constructors.handlers.tfm tfm.version = 1.000 tfm.maxnestingdepth = 5 tfm.maxnestingsize = 65536*1024 -local tfmfeatures = constructors.newfeatures("tfm") +local tfmfeatures = constructors.features.tfm ----- registertfmfeature = tfmfeatures.register constructors.resolvevirtualtoo = false -- wil be set in font-ctx.lua diff --git a/src/fontloader/misc/fontloader-fonts-ext.lua b/src/fontloader/misc/fontloader-fonts-ext.lua index b60d045..9d8d307 100644 --- a/src/fontloader/misc/fontloader-fonts-ext.lua +++ b/src/fontloader/misc/fontloader-fonts-ext.lua @@ -12,7 +12,7 @@ if context then end local fonts = fonts -local otffeatures = fonts.constructors.newfeatures("otf") +local otffeatures = fonts.constructors.features.otf -- A few generic extensions. diff --git a/src/fontloader/misc/fontloader-fonts.lua b/src/fontloader/misc/fontloader-fonts.lua index c493844..83d52d9 100644 --- a/src/fontloader/misc/fontloader-fonts.lua +++ b/src/fontloader/misc/fontloader-fonts.lua @@ -186,6 +186,7 @@ if non_generic_context.luatex_fonts.skip_loading ~= true then loadmodule("l-file.lua") loadmodule("l-boolean.lua") loadmodule("l-math.lua") + loadmodule("l-unicode.lua") -- A few slightly higher level support modules: @@ -257,6 +258,7 @@ if non_generic_context.luatex_fonts.skip_loading ~= true then loadmodule('font-ota.lua') loadmodule('font-ots.lua') loadmodule('font-osd.lua') + loadmodule('font-ocl.lua') -- svg needs 0.97 (for fix in memstreams) -- type one code diff --git a/src/fontloader/misc/fontloader-math.tex b/src/fontloader/misc/fontloader-math.tex index 604b4a1..b249021 100644 --- a/src/fontloader/misc/fontloader-math.tex +++ b/src/fontloader/misc/fontloader-math.tex @@ -40,9 +40,9 @@ \font\tenbf = file:lmroman10-bold.otf:+liga;+kern;+tlig;+trep at 10pt \font\tenbi = file:lmroman10-bolditalic.otf:+liga;+kern;+tlig;+trep at 10pt % - \font\mathfonttextupright = file:latinmodern-math.otf:ssty=0;fixmath=yes at 10pt - \font\mathfontscriptupright = file:latinmodern-math.otf:ssty=1;fixmath=yes at 7pt - \font\mathfontscriptscriptupright = file:latinmodern-math.otf:ssty=2;fixmath=yes at 5pt + \font\mathfonttextupright = file:latinmodern-math.otf:script=math;ssty=0;mathsize=yes at 10pt + \font\mathfontscriptupright = file:latinmodern-math.otf:script=math;ssty=1;mathsize=yes at 7pt + \font\mathfontscriptscriptupright = file:latinmodern-math.otf:script=math;ssty=2;mathsize=yes at 5pt % \textfont 0 = \mathfonttextupright \scriptfont 0 = \mathfontscriptupright @@ -61,9 +61,9 @@ \font\tenbf = file:lucidabrightot-demi.otf:+liga;+kern;+tlig;+trep at 10pt \font\tenbi = file:lucidabrightot-demiitalic.otf:+liga;+kern;+tlig;+trep at 10pt % - \font\mathfonttextupright = file:lucidabrightmathot.otf:ssty=0;fixmath=yes at 10pt - \font\mathfontscriptupright = file:lucidabrightmathot.otf:ssty=1;fixmath=yes at 7pt - \font\mathfontscriptscriptupright = file:lucidabrightmathot.otf:ssty=2;fixmath=yes at 5pt + \font\mathfonttextupright = file:lucidabrightmathot.otf:script=math;ssty=0;mathsize=yes at 10pt + \font\mathfontscriptupright = file:lucidabrightmathot.otf:script=math;ssty=1;mathsize=yes at 7pt + \font\mathfontscriptscriptupright = file:lucidabrightmathot.otf:script=math;ssty=2;mathsize=yes at 5pt % \textfont 0 = \mathfonttextupright \scriptfont 0 = \mathfontscriptupright |