Handle TODOs
This commit is contained in:
parent
43d435ab90
commit
7c162a0cf0
@ -12,7 +12,7 @@ lua.get_functions_table()[restore_func] = function()
|
|||||||
end
|
end
|
||||||
end
|
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 put_next = token.put_next
|
||||||
local runtoks = tex.runtoks
|
local runtoks = tex.runtoks
|
||||||
local function put_restore_toks()
|
local function put_restore_toks()
|
||||||
|
@ -263,12 +263,6 @@ local function endboxrotation(p, list, x, y)
|
|||||||
elseif orientation == 3 then
|
elseif orientation == 3 then
|
||||||
y = y + hoff
|
y = y + hoff
|
||||||
write_matrix(0, -1, 1, 0, x-y, x+y, p)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -409,7 +403,10 @@ function nodehandler.rule(p, n, x, y, outer)
|
|||||||
end
|
end
|
||||||
end
|
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
|
for n in traverse(getreplace(n)) do
|
||||||
local next = getnext(n)
|
local next = getnext(n)
|
||||||
local w = next and rangedimensions(list, n, next) or rangedimensions(list, 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
|
elseif cmd[1] == "right" then
|
||||||
x = x + cmd[2]
|
x = x + cmd[2]
|
||||||
elseif cmd[1] == "down" then
|
elseif cmd[1] == "down" then
|
||||||
y = y - cmd[2] -- TODO: Review sign
|
y = y - cmd[2]
|
||||||
elseif cmd[1] == "push" then
|
elseif cmd[1] == "push" then
|
||||||
stack[#stack + 1] = {x, y}
|
stack[#stack + 1] = {x, y}
|
||||||
elseif cmd[1] == "pop" then
|
elseif cmd[1] == "pop" then
|
||||||
@ -574,7 +571,7 @@ vf = {
|
|||||||
direct.free(n)
|
direct.free(n)
|
||||||
end,
|
end,
|
||||||
down = function(dy)
|
down = function(dy)
|
||||||
vf_state[5] = vf_state[5] - dy -- TODO: Review sign
|
vf_state[5] = vf_state[5] - dy
|
||||||
end,
|
end,
|
||||||
fontid = function(fid)
|
fontid = function(fid)
|
||||||
vf_state[3] = fid
|
vf_state[3] = fid
|
||||||
|
@ -501,8 +501,7 @@ function myfunc(buf, i0, fontid, usedcids, encoding, trust_widths)
|
|||||||
parse_fdselect(buf, i0+top.FDSelect, CharStrings)
|
parse_fdselect(buf, i0+top.FDSelect, CharStrings)
|
||||||
end
|
end
|
||||||
local glyphs = {}
|
local glyphs = {}
|
||||||
-- if false and usedcids then -- Subsetting FIXME: Disabled, because other tables have to be fixed up first
|
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
|
||||||
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
|
|
||||||
local usedfonts = {}
|
local usedfonts = {}
|
||||||
for i=1,#usedcids do
|
for i=1,#usedcids do
|
||||||
local cid = usedcids[i][1]
|
local cid = usedcids[i][1]
|
||||||
@ -524,14 +523,13 @@ function myfunc(buf, i0, fontid, usedcids, encoding, trust_widths)
|
|||||||
for i=1,#glyphs do
|
for i=1,#glyphs do
|
||||||
glyphs[i].cidfont = usedfonts[glyphs[i].cidfont]
|
glyphs[i].cidfont = usedfonts[glyphs[i].cidfont]
|
||||||
end
|
end
|
||||||
-- TODO: CIDFont / Privates subsetting... DONE(?)
|
-- Subrs subsetting... Instead of deleting unused SubRS, we only make them empty.
|
||||||
-- TODO: Subrs subsetting... Instead of deleting unused SubRs, we only make them empty.
|
-- This avoids problems with renumberings which would have to be consitant across
|
||||||
-- This avoids problems with renumberings whiuch would have to be consitant across
|
-- Fonts in some odd way, because they might be used by globalsubrs.
|
||||||
-- Fonts in some odd way, because they might be used by globalsubrs.
|
|
||||||
for i=1,#glyphs do
|
for i=1,#glyphs do
|
||||||
local g = glyphs[i]
|
local g = glyphs[i]
|
||||||
local private = top.Privates[g.cidfont or 1]
|
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]
|
local width = parsed[1][2]
|
||||||
if width then
|
if width then
|
||||||
width = width + (private.nominalWidthX or 0)
|
width = width + (private.nominalWidthX or 0)
|
||||||
|
@ -73,14 +73,6 @@ return function(filename, fontid, reencode)
|
|||||||
local buf = file()
|
local buf = file()
|
||||||
local magic, tables = sfnt.parse(buf, 1, fontid)
|
local magic, tables = sfnt.parse(buf, 1, fontid)
|
||||||
if magic ~= "\0\1\0\0" then error[[Invalid TTF font]] end
|
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)
|
return function(fontdir, usedcids)
|
||||||
if reencode and string.unpack(">I4", buf, tables.post[1]) == 0x00020000 then
|
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))
|
usedcids = readpostnames(buf, tables.post[1] + 32, usedcids, require'luametalatex-font-enc'(reencode))
|
||||||
|
@ -238,8 +238,7 @@ local function buildfont0(pdf, fontdir, usedcids)
|
|||||||
local enc
|
local enc
|
||||||
if fontdir.encodingbytes == 1 then
|
if fontdir.encodingbytes == 1 then
|
||||||
enc = cidmap1byte(pdf)
|
enc = cidmap1byte(pdf)
|
||||||
elseif false then -- FIXME: This should only be used for encodingbyzes == -3 (variable, max 3)
|
elseif fontdir.encodingbytes == -3 then -- (variable, max 3)
|
||||||
fontdir.encodingbytes = -3 -- FIXME
|
|
||||||
enc = cidmap3byte(pdf)
|
enc = cidmap3byte(pdf)
|
||||||
else
|
else
|
||||||
enc = "/Identity-H"
|
enc = "/Identity-H"
|
||||||
|
@ -224,9 +224,7 @@ local intents = {[0]=
|
|||||||
}
|
}
|
||||||
local function srgb_lookup(pfile, intent)
|
local function srgb_lookup(pfile, intent)
|
||||||
if not srgb_colorspace then
|
if not srgb_colorspace then
|
||||||
local file <close> = readfile('data', 'sRGB.icc')
|
local objnum = pfile:stream(nil, '/N 3', 'sRGB.icc', true)
|
||||||
local profile = file()
|
|
||||||
local objnum = pfile:stream(nil, '/N 3', profile) -- FIXME: file stream
|
|
||||||
srgb_colorspace = string.format('[/ICCBased %i 0 R]', objnum)
|
srgb_colorspace = string.format('[/ICCBased %i 0 R]', objnum)
|
||||||
end
|
end
|
||||||
return objnum, intents[intent] or ''
|
return objnum, intents[intent] or ''
|
||||||
|
@ -17,7 +17,7 @@ local function written(pdf, num)
|
|||||||
if not num or num == assigned then return end
|
if not num or num == assigned then return end
|
||||||
return num ~= delayed
|
return num ~= delayed
|
||||||
end
|
end
|
||||||
-- raw: Pass on preencoded stream. Currently ignored.
|
-- raw: Pass on preencoded stream.
|
||||||
local function stream(pdf, num, dict, content, isfile, raw)
|
local function stream(pdf, num, dict, content, isfile, raw)
|
||||||
if not num then num = pdf:getobj() end
|
if not num then num = pdf:getobj() end
|
||||||
if pdf[num] ~= assigned then
|
if pdf[num] ~= assigned then
|
||||||
|
Loading…
Reference in New Issue
Block a user