diff --git a/luametalatex-local.lua b/luametalatex-local.lua index 30b9c9b..531996e 100644 --- a/luametalatex-local.lua +++ b/luametalatex-local.lua @@ -12,7 +12,7 @@ lua.get_functions_table()[restore_func] = function() end end end -local restore_toks = {token.new(2, token.command_id'after_something') , token.new(restore_func, token.command_id'lua_call')} -- \atendofgroup FIXME: Detect mode automatically once token.primitive is fixed +local restore_toks = {token.primitive_tokens.atendofgroup , token.new(restore_func, token.command_id'lua_call')} local put_next = token.put_next local runtoks = tex.runtoks local function put_restore_toks() diff --git a/luametalatex-nodewriter.lua b/luametalatex-nodewriter.lua index 7719c32..78c627b 100644 --- a/luametalatex-nodewriter.lua +++ b/luametalatex-nodewriter.lua @@ -263,12 +263,6 @@ local function endboxrotation(p, list, x, y) elseif orientation == 3 then y = y + hoff write_matrix(0, -1, 1, 0, x-y, x+y, p) - elseif orientation == 4 then - error[[TODO]] -- FIXME - write_matrix(1, 0, 0, 1, 0, 0, p) - elseif orientation == 5 then - error[[TODO]] -- FIXME - write_matrix(1, 0, 0, 1, 0, 0, p) end end @@ -409,7 +403,10 @@ function nodehandler.rule(p, n, x, y, outer) end end end -function nodehandler.disc(p, n, x, y, list, ...) -- FIXME: I am not sure why this can happen, let's assume we can use .replace +-- If we encounter disc here, we can just use .replace. We could make TeX drop these using node.flatten_discretionaries, +-- but for now we just accept them. This approach might be a bit faster, but it leads to a few issue due to directions etc. +-- so it might change soon(ish) TODO: Review +function nodehandler.disc(p, n, x, y, list, ...) for n in traverse(getreplace(n)) do local next = getnext(n) local w = next and rangedimensions(list, n, next) or rangedimensions(list, n) @@ -532,7 +529,7 @@ local function do_commands(p, c, f, cid, fid, x, y, outer, x0, level, direction) elseif cmd[1] == "right" then x = x + cmd[2] elseif cmd[1] == "down" then - y = y - cmd[2] -- TODO: Review sign + y = y - cmd[2] elseif cmd[1] == "push" then stack[#stack + 1] = {x, y} elseif cmd[1] == "pop" then @@ -574,7 +571,7 @@ vf = { direct.free(n) end, down = function(dy) - vf_state[5] = vf_state[5] - dy -- TODO: Review sign + vf_state[5] = vf_state[5] - dy end, fontid = function(fid) vf_state[3] = fid diff --git a/luametalatex-pdf-font-cff.lua b/luametalatex-pdf-font-cff.lua index 3efa270..c45eb39 100644 --- a/luametalatex-pdf-font-cff.lua +++ b/luametalatex-pdf-font-cff.lua @@ -501,8 +501,7 @@ function myfunc(buf, i0, fontid, usedcids, encoding, trust_widths) parse_fdselect(buf, i0+top.FDSelect, CharStrings) end local glyphs = {} - -- if false and usedcids then -- Subsetting FIXME: Disabled, because other tables have to be fixed up first - if usedcids then -- Subsetting FIXME: Should be Disabled, because other tables have to be fixed up first -- Actually seems to work now, let's test it a bit more + if usedcids then -- Subsetting maybeFIXME: Should be Disabled, because other tables have to be fixed up first -- Actually seems to work now, let's test it a bit more local usedfonts = {} for i=1,#usedcids do local cid = usedcids[i][1] @@ -524,14 +523,13 @@ function myfunc(buf, i0, fontid, usedcids, encoding, trust_widths) for i=1,#glyphs do glyphs[i].cidfont = usedfonts[glyphs[i].cidfont] end - -- TODO: CIDFont / Privates subsetting... DONE(?) - -- TODO: Subrs subsetting... Instead of deleting unused SubRs, we only make them empty. - -- This avoids problems with renumberings whiuch would have to be consitant across - -- Fonts in some odd way, because they might be used by globalsubrs. + -- Subrs subsetting... Instead of deleting unused SubRS, we only make them empty. + -- This avoids problems with renumberings which would have to be consitant across + -- Fonts in some odd way, because they might be used by globalsubrs. for i=1,#glyphs do local g = glyphs[i] local private = top.Privates[g.cidfont or 1] - local parsed = parse_charstring(g.cs, top.GlobalSubrs, private.Subrs) -- TODO: Implement + local parsed = parse_charstring(g.cs, top.GlobalSubrs, private.Subrs) local width = parsed[1][2] if width then width = width + (private.nominalWidthX or 0) diff --git a/luametalatex-pdf-font-ttf.lua b/luametalatex-pdf-font-ttf.lua index 5a2e837..9db1031 100644 --- a/luametalatex-pdf-font-ttf.lua +++ b/luametalatex-pdf-font-ttf.lua @@ -73,14 +73,6 @@ return function(filename, fontid, reencode) local buf = file() local magic, tables = sfnt.parse(buf, 1, fontid) if magic ~= "\0\1\0\0" then error[[Invalid TTF font]] end - -- TODO: Parse post table and add reencoding support - -- if tables.post and string.unpack(">I4", buf, tables.post[1]) == 0x00020000 and reencode then - -- local encoding = require'parseEnc'(reencode) - -- if encoding then - -- local names = {} - -- local off = tables.post[1] + 4 - -- for i = 1,string.unpack(">I2", buf, tables.maxp[1] + 4) do - return function(fontdir, usedcids) if reencode and string.unpack(">I4", buf, tables.post[1]) == 0x00020000 then usedcids = readpostnames(buf, tables.post[1] + 32, usedcids, require'luametalatex-font-enc'(reencode)) diff --git a/luametalatex-pdf-font.lua b/luametalatex-pdf-font.lua index 03caa7d..ce0b238 100644 --- a/luametalatex-pdf-font.lua +++ b/luametalatex-pdf-font.lua @@ -238,8 +238,7 @@ local function buildfont0(pdf, fontdir, usedcids) local enc if fontdir.encodingbytes == 1 then enc = cidmap1byte(pdf) - elseif false then -- FIXME: This should only be used for encodingbyzes == -3 (variable, max 3) - fontdir.encodingbytes = -3 -- FIXME + elseif fontdir.encodingbytes == -3 then -- (variable, max 3) enc = cidmap3byte(pdf) else enc = "/Identity-H" diff --git a/luametalatex-pdf-image-png.lua b/luametalatex-pdf-image-png.lua index 809cb9c..005aa26 100644 --- a/luametalatex-pdf-image-png.lua +++ b/luametalatex-pdf-image-png.lua @@ -224,9 +224,7 @@ local intents = {[0]= } local function srgb_lookup(pfile, intent) if not srgb_colorspace then - local file = readfile('data', 'sRGB.icc') - local profile = file() - local objnum = pfile:stream(nil, '/N 3', profile) -- FIXME: file stream + local objnum = pfile:stream(nil, '/N 3', 'sRGB.icc', true) srgb_colorspace = string.format('[/ICCBased %i 0 R]', objnum) end return objnum, intents[intent] or '' diff --git a/luametalatex-pdf.lua b/luametalatex-pdf.lua index 89b731d..352bd70 100644 --- a/luametalatex-pdf.lua +++ b/luametalatex-pdf.lua @@ -17,7 +17,7 @@ local function written(pdf, num) if not num or num == assigned then return end return num ~= delayed end --- raw: Pass on preencoded stream. Currently ignored. +-- raw: Pass on preencoded stream. local function stream(pdf, num, dict, content, isfile, raw) if not num then num = pdf:getobj() end if pdf[num] ~= assigned then