Improve PK font support
This commit is contained in:
parent
2547bc80e3
commit
fe4f3355f3
@ -148,8 +148,10 @@ pdf_variable(count_code, token.scan_int, 'uniqueresname', 0, true) -- I add this
|
||||
pdf_variable(count_code, token.scan_int, 'pagebox', 2, true) -- TODO (1: media, 2: crop, 3: bleed, 4: trim, 5: art
|
||||
pdf_variable(count_code, token.scan_int, 'forcepagebox', 0, true) -- Considered obsolete even in pdfTeX
|
||||
pdf_variable(count_code, token.scan_int, 'imageresolution', 72, true) -- TODO Also 0 should be the same as 72 ?!?!?!?
|
||||
-- The following two relate to pk fonts which we don't support, so they are ignored on a different level
|
||||
pdf_variable(count_code, token.scan_int, 'pkresolution', 72)
|
||||
|
||||
pdf_variable(count_code, token.scan_int, 'pkresolution', 1200) -- Original default is 72, but that's crazy
|
||||
pdf_variable(count_code, token.scan_int, 'pkfixeddpi', 0) -- TODO: Implemented, but even when set to one, font sharing doesn't adapt yet.
|
||||
-- Changing that is complicated because it has to be known pretty early.
|
||||
pdf_toks('pkmode', '')
|
||||
|
||||
pdf_toks('pageattr', '')
|
||||
|
@ -192,12 +192,12 @@ local function parse_commands(buf, off, t)
|
||||
until cmd == 245
|
||||
return off
|
||||
end
|
||||
return function(name)
|
||||
local f = assert(io.open(kpse.find_file(name, 'pk', 600), 'rb')) -- TODO configurable dpi
|
||||
return function(filename)
|
||||
local f = assert(io.open(filename, 'rb'))
|
||||
local pk = f:read'a'
|
||||
f:close()
|
||||
local res = {}
|
||||
off = parse_commands(pk, off, res)
|
||||
local off = parse_commands(pk, 1, res)
|
||||
-- assert(off == #pk+1) -- TODO: Check that only fillup bytes follow
|
||||
return res
|
||||
end
|
||||
|
@ -38,7 +38,6 @@ package.searchers[2] = function(modname)
|
||||
end
|
||||
kpse.set_maketex("fmt", true, "compile")
|
||||
kpse.set_maketex("pk", true, "compile")
|
||||
kpse.init_prog("LUATEX", 600, "ljfour", nil)
|
||||
require'luametalatex-init-config'
|
||||
local callback_register = callback.register
|
||||
local build_bytecode
|
||||
|
@ -5,7 +5,6 @@ if initex then
|
||||
end
|
||||
|
||||
bit32 = require'luametalatex-bit32' -- Why? And why so early?
|
||||
-- kpse.init_prog("LUATEX", 400, "nexthi", nil) -- ?
|
||||
status.init_kpse = 1 -- Why?
|
||||
status.safer_option = 0 -- compat
|
||||
status.shell_escape = 0 -- compat -- This is currently a lie.
|
||||
|
@ -1,7 +1,19 @@
|
||||
local pk_global_resolution, pk_resolution_is_fixed
|
||||
local pdfvariable = pdf.variable
|
||||
|
||||
local read_pk = require'luametalatex-font-pk'
|
||||
local strip_floats = require'luametalatex-pdf-utils'.strip_floats
|
||||
return function(pdf, fontdir, usedcids)
|
||||
local pk = read_pk(fontdir.name)
|
||||
if not pk_global_resolution then
|
||||
pk_global_resolution = pdfvariable.pkresolution
|
||||
if not pk_global_resolution or pk_global_resolution == 0 then
|
||||
pk_global_resolution = kpse.var_value'pk_dpi' or 72
|
||||
end
|
||||
local mode = pdfvariable.pkmode
|
||||
pk_resolution_is_fixed = pdfvariable.pkfixeddpi ~= 0
|
||||
kpse.init_prog("LUATEX", pk_global_resolution, pkmode ~= '' and pkmode or nil, nil) -- ?
|
||||
end
|
||||
local pk = read_pk(kpse.find_file(fontdir.name, 'pk', pk_resolution_is_fixed and pk_global_resolution or (pk_global_resolution*fontdir.size/fontdir.designsize+.5)//1))
|
||||
local designsize = pk.designsize/1044654.326 -- 1044654.326=2^20*72/72.27 -- designsize in bp
|
||||
local hscale = 65536/pk.hppp / designsize -- 65291.158=2^16*72/72.27
|
||||
local vscale = 65536/pk.vppp / designsize -- 65291.158=2^16*72/72.27
|
||||
|
Loading…
Reference in New Issue
Block a user