summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-12-01 14:04:36 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2018-12-01 14:04:36 +0100
commit6953b7c4b4c40fab660992622a6fd140fa310b34 (patch)
tree76f842098f2c24cdf3b63f26651cb58c8827950d /tex
parent9bd28a3039a458b054459fe1ef80161b107b798f (diff)
downloadcontext-6953b7c4b4c40fab660992622a6fd140fa310b34.tar.gz
2018-12-01 13:28:00
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/anch-pgr.lua9
-rw-r--r--tex/context/base/mkiv/anch-pos.lua22
-rw-r--r--tex/context/base/mkiv/back-ini.lua14
-rw-r--r--tex/context/base/mkiv/back-pdp.lua21
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-con.lua5
-rw-r--r--tex/context/base/mkiv/font-tfm.lua450
-rw-r--r--tex/context/base/mkiv/grph-inc.lua9
-rw-r--r--tex/context/base/mkiv/lpdf-ano.lua18
-rw-r--r--tex/context/base/mkiv/lpdf-ini.lua44
-rw-r--r--tex/context/base/mkiv/lpdf-mis.lua4
-rw-r--r--tex/context/base/mkiv/lpdf-pda.xml7
-rw-r--r--tex/context/base/mkiv/lpdf-pdx.xml1
-rw-r--r--tex/context/base/mkiv/lpdf-pua.xml7
-rw-r--r--tex/context/base/mkiv/lpdf-xmp.lua45
-rw-r--r--tex/context/base/mkiv/node-syn.lua8
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26119 -> 26066 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin269735 -> 269690 bytes
-rw-r--r--tex/context/base/mkiv/strc-ref.lua7
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin857449 -> 857217 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60754 -> 60775 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua346
25 files changed, 518 insertions, 507 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index b82efa527..31171217c 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2018.11.29 19:46}
+\newcontextversion{2018.12.01 13:20}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index a7b296fe6..0465300d9 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.11.29 19:46}
+\edef\contextversion{2018.12.01 13:20}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/anch-pgr.lua b/tex/context/base/mkiv/anch-pgr.lua
index 4014c5222..5237eb11e 100644
--- a/tex/context/base/mkiv/anch-pgr.lua
+++ b/tex/context/base/mkiv/anch-pgr.lua
@@ -84,20 +84,13 @@ local processranges = nuts.processranges
local unsetvalue = attributes.unsetvalue
local jobpositions = job.positions
+local getpos = jobpositions.getpos
local data = { }
local realpage = 1
local recycle = 1000 -- only tables can overflow this
local enabled = false
--- can change:
-
-local getpos = function() getpos = backends.codeinjections.getpos return getpos() end
-
-updaters.register("backend.update",function()
- getpos = backends.codeinjections.getpos
-end)
-
-- Freeing the data is somewhat tricky as we can have backgrounds spanning
-- many pages but for an arbitrary background shape that is not so common.
diff --git a/tex/context/base/mkiv/anch-pos.lua b/tex/context/base/mkiv/anch-pos.lua
index b8a5f92c2..69203a490 100644
--- a/tex/context/base/mkiv/anch-pos.lua
+++ b/tex/context/base/mkiv/anch-pos.lua
@@ -333,15 +333,19 @@ local nofpages = nil
-- beware ... we're not sparse here as lua will reserve slots for the nilled
-local getpos = function() getpos = backends.codeinjections.getpos return getpos () end
-local gethpos = function() gethpos = backends.codeinjections.gethpos return gethpos() end
-local getvpos = function() getvpos = backends.codeinjections.getvpos return getvpos() end
-
-updaters.register("backend.update",function()
- getpos = backends.codeinjections.getpos
- gethpos = backends.codeinjections.gethpos
- getvpos = backends.codeinjections.getvpos
-end)
+local getpos, gethpos, getvpos
+
+function jobpositions.registerhandlers(t)
+ getpos = t and t.getpos or function() return 0, 0 end
+ gethpos = t and t.gethpos or function() return 0 end
+ getvpos = t and t.getvpos or function() return 0 end
+end
+
+function jobpositions.getpos () return getpos () end
+function jobpositions.gethpos() return gethpos() end
+function jobpositions.getvpos() return getvpos() end
+
+jobpositions.registerhandlers()
local function setall(name,p,x,y,w,h,d,extra)
tobesaved[name] = {
diff --git a/tex/context/base/mkiv/back-ini.lua b/tex/context/base/mkiv/back-ini.lua
index 059e1c8a8..27d1fa165 100644
--- a/tex/context/base/mkiv/back-ini.lua
+++ b/tex/context/base/mkiv/back-ini.lua
@@ -87,7 +87,13 @@ end
statistics.register("used backend", function()
local bc = backends.current
if bc ~= "unknown" then
- return format("%s (%s)",bc,backends[bc].comment or "no comment")
+ local lmtx = environment.lmtxmode and drivers and drivers.lmtxversion
+ local cmnt = backends[bc].comment or "no comment"
+ if lmtx then
+ return format("lmtx version %0.2f, %s (%s)",lmtx,bc,cmnt)
+ else
+ return format("%s (%s)",bc,cmnt)
+ end
else
return nil
end
@@ -104,12 +110,6 @@ tables.vfspecials = allocate {
stopslant = comment,
}
--- we'd better have this return something (defaults)
-
-function codeinjections.getpos () return 0, 0 end
-function codeinjections.gethpos() return 0 end
-function codeinjections.getvpos() return 0 end
-
-- can best be here
interfaces.implement {
diff --git a/tex/context/base/mkiv/back-pdp.lua b/tex/context/base/mkiv/back-pdp.lua
index 69f497b3f..4087fa354 100644
--- a/tex/context/base/mkiv/back-pdp.lua
+++ b/tex/context/base/mkiv/back-pdp.lua
@@ -13,17 +13,20 @@ local context = context
local lpdfreserveobject = lpdf.reserveobject
local lpdfcompresslevel = lpdf.compresslevel
-local lpdfgethpos = lpdf.gethpos
-local lpdfgetvpos = lpdf.getvpos
local lpdfobj = lpdf.obj
local lpdfpagereference = lpdf.pagereference
local lpdfxformname = lpdf.xformname
-local scanword = tokens.scanners.word
-local scankeyword = tokens.scanners.keyword
-local scanstring = tokens.scanners.string
-local scaninteger = tokens.scanners.integer
-local scandimension = tokens.scanners.dimension
+local jobpositions = job.positions
+local gethpos = jobpositions.gethpos
+local getvpos = jobpositions.getvpos
+
+local tokenscanners = tokens.scanners
+local scanword = tokenscanners.word
+local scankeyword = tokenscanners.keyword
+local scanstring = tokenscanners.string
+local scaninteger = tokenscanners.integer
+local scandimension = tokenscanners.dimension
local trace = false trackers.register("commands", function(v) trace = v end)
local report = logs.reporter("command")
@@ -68,11 +71,11 @@ local function savepos()
end
local function lastxpos()
- context(lpdfgethpos())
+ context(gethpos())
end
local function lastypos()
- context(lpdfgetvpos())
+ context(getvpos())
end
implement { name = "savepos", actions = savepos }
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 7d318e0b9..a46932506 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2018.11.29 19:46}
+\newcontextversion{2018.12.01 13:20}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 76fd66b65..f4c144514 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -42,7 +42,7 @@
%D has to match \type {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.11.29 19:46}
+\edef\contextversion{2018.12.01 13:20}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua
index 92911bd3f..81ea7c859 100644
--- a/tex/context/base/mkiv/font-con.lua
+++ b/tex/context/base/mkiv/font-con.lua
@@ -927,10 +927,9 @@ function constructors.scale(tfmdata,specification)
-- catch inconsistencies
--
local vfonts = target.fonts
--- if isvirtual then
-if isvirtual or target.type == "virtual" or properties.virtualized then
+ if isvirtual or target.type == "virtual" or properties.virtualized then
properties.virtualized = true
-target.type = "virtual"
+ target.type = "virtual"
if not vfonts or #vfonts == 0 then
target.fonts = { { id = 0 } }
end
diff --git a/tex/context/base/mkiv/font-tfm.lua b/tex/context/base/mkiv/font-tfm.lua
index e757a7b82..6e4f86980 100644
--- a/tex/context/base/mkiv/font-tfm.lua
+++ b/tex/context/base/mkiv/font-tfm.lua
@@ -118,258 +118,266 @@ local depth = { } -- table.setmetatableindex("number")
--
-- So "czechdqcheat=yes" is then a valid feature. And yes, it's a cheat.
-local loadtfmvf = tfm.readers and tfm.readers.loadtfmvf
+local read_from_tfm, check_tfm do
-directives.register("fonts.tfm.builtin",function(v)
- loadtfmvf = tfm.readers and tfm.readers.loadtfmvf
- if v and font.read_tfm then
- loadtfmvf = false
- end
-end)
-
-local function read_from_tfm(specification)
- local filename = specification.filename
- local size = specification.size
- depth[filename] = (depth[filename] or 0) + 1
- if trace_defining then
- report_defining("loading tfm file %a at size %s",filename,size)
- end
- local tfmdata
- if loadtfmvf then
- tfmdata = loadtfmvf(filename,size)
- else
- tfmdata = font.read_tfm(filename,size) -- not cached, fast enough
- end
- if tfmdata then
+ local tfmreaders = context and tfm.readers
+ local loadtfmvf = tfmreaders and tfmreaders.loadtfmvf
+ local loadtfm = font.read_tfm
+ local loadvf = font.read_vf
- local features = specification.features and specification.features.normal or { }
- local features = constructors.checkedfeatures("tfm",features)
- specification.features.normal = features
-
- -- If reencode returns a new table, we assume that we're doing something
- -- special. An 'auto' reencode picks up its vector from the pfb file.
+ directives.register("fonts.tfm.builtin",function(v)
+ loadtfmvf = tfmreaders and tfmreaders.loadtfmvf
+ if v and loadtfm then
+ loadtfmvf = false
+ end
+ end)
- local newtfmdata = (depth[filename] == 1) and tfm.reencode(tfmdata,specification)
- if newtfmdata then
- tfmdata = newtfmdata
+ read_from_tfm = function(specification)
+ local filename = specification.filename
+ local size = specification.size
+ depth[filename] = (depth[filename] or 0) + 1
+ if trace_defining then
+ report_defining("loading tfm file %a at size %s",filename,size)
end
+ local tfmdata -- not cached, fast enough
+ if loadtfmvf then
+ tfmdata = loadtfmvf(filename,size)
+ else
+ tfmdata = loadtfm(filename,size)
+ end
+ if tfmdata then
- local resources = tfmdata.resources or { }
- local properties = tfmdata.properties or { }
- local parameters = tfmdata.parameters or { }
- local shared = tfmdata.shared or { }
- --
- shared.features = features
- shared.resources = resources
- --
- properties.name = tfmdata.name -- todo: fallback
- properties.fontname = tfmdata.fontname -- todo: fallback
- properties.psname = tfmdata.psname -- todo: fallback
- properties.fullname = tfmdata.fullname -- todo: fallback
- properties.filename = specification.filename -- todo: fallback
- properties.format = tfmdata.format or fonts.formats.tfm -- better than nothing
- properties.usedbitmap = tfmdata.usedbitmap
- --
- tfmdata.properties = properties
- tfmdata.resources = resources
- tfmdata.parameters = parameters
- tfmdata.shared = shared
- --
- shared.rawdata = { resources = resources }
- shared.features = features
- --
- -- The next branch is only entered when we have a proper encoded file i.e.
- -- unicodes and such. It really nakes no sense to do feature juggling when
- -- we have no names and unicodes.
- --
- if newtfmdata then
- --
- -- Some opentype processing assumes these to be present:
- --
- if not resources.marks then
- resources.marks = { }
- end
- if not resources.sequences then
- resources.sequences = { }
- end
- if not resources.features then
- resources.features = {
- gsub = { },
- gpos = { },
- }
- end
- if not tfmdata.changed then
- tfmdata.changed = { }
- end
- if not tfmdata.descriptions then
- tfmdata.descriptions = tfmdata.characters
+ local features = specification.features and specification.features.normal or { }
+ local features = constructors.checkedfeatures("tfm",features)
+ specification.features.normal = features
+
+ -- If reencode returns a new table, we assume that we're doing something
+ -- special. An 'auto' reencode picks up its vector from the pfb file.
+
+ local newtfmdata = (depth[filename] == 1) and tfm.reencode(tfmdata,specification)
+ if newtfmdata then
+ tfmdata = newtfmdata
end
+
+ local resources = tfmdata.resources or { }
+ local properties = tfmdata.properties or { }
+ local parameters = tfmdata.parameters or { }
+ local shared = tfmdata.shared or { }
--
- -- It might be handy to have this:
- --
- otf.readers.addunicodetable(tfmdata)
- --
- -- We make a pseudo opentype font, e.g. kerns and ligatures etc:
- --
- tfmenhancers.apply(tfmdata,filename)
- --
- -- Now user stuff can kick in.
- --
- constructors.applymanipulators("tfm",tfmdata,features,trace_features,report_tfm)
- --
- -- As that can also mess with names and such, we are now ready for finalizing
- -- the unicode information. This is a different order that for instance type one
- -- (afm) files. First we try to deduce unicodes from already present information.
+ shared.features = features
+ shared.resources = resources
--
- otf.readers.unifymissing(tfmdata)
+ properties.name = tfmdata.name -- todo: fallback
+ properties.fontname = tfmdata.fontname -- todo: fallback
+ properties.psname = tfmdata.psname -- todo: fallback
+ properties.fullname = tfmdata.fullname -- todo: fallback
+ properties.filename = specification.filename -- todo: fallback
+ properties.format = tfmdata.format or fonts.formats.tfm -- better than nothing
+ properties.usedbitmap = tfmdata.usedbitmap
--
- -- Next we fill in the gaps, based on names from teh agl. Probably not much will
- -- happen here.
+ tfmdata.properties = properties
+ tfmdata.resources = resources
+ tfmdata.parameters = parameters
+ tfmdata.shared = shared
--
- fonts.mappings.addtounicode(tfmdata,filename)
+ shared.rawdata = { resources = resources }
+ shared.features = features
--
- -- The tounicode data is passed to the backend that constructs the vectors for us.
+ -- The next branch is only entered when we have a proper encoded file i.e.
+ -- unicodes and such. It really nakes no sense to do feature juggling when
+ -- we have no names and unicodes.
--
- tfmdata.tounicode = 1
- local tounicode = fonts.mappings.tounicode
- for unicode, v in next, tfmdata.characters do
- local u = v.unicode
- if u then
- v.tounicode = tounicode(u)
+ if newtfmdata then
+ --
+ -- Some opentype processing assumes these to be present:
+ --
+ if not resources.marks then
+ resources.marks = { }
+ end
+ if not resources.sequences then
+ resources.sequences = { }
+ end
+ if not resources.features then
+ resources.features = {
+ gsub = { },
+ gpos = { },
+ }
+ end
+ if not tfmdata.changed then
+ tfmdata.changed = { }
+ end
+ if not tfmdata.descriptions then
+ tfmdata.descriptions = tfmdata.characters
+ end
+ --
+ -- It might be handy to have this:
+ --
+ otf.readers.addunicodetable(tfmdata)
+ --
+ -- We make a pseudo opentype font, e.g. kerns and ligatures etc:
+ --
+ tfmenhancers.apply(tfmdata,filename)
+ --
+ -- Now user stuff can kick in.
+ --
+ constructors.applymanipulators("tfm",tfmdata,features,trace_features,report_tfm)
+ --
+ -- As that can also mess with names and such, we are now ready for finalizing
+ -- the unicode information. This is a different order that for instance type one
+ -- (afm) files. First we try to deduce unicodes from already present information.
+ --
+ otf.readers.unifymissing(tfmdata)
+ --
+ -- Next we fill in the gaps, based on names from teh agl. Probably not much will
+ -- happen here.
+ --
+ fonts.mappings.addtounicode(tfmdata,filename)
+ --
+ -- The tounicode data is passed to the backend that constructs the vectors for us.
+ --
+ tfmdata.tounicode = 1
+ local tounicode = fonts.mappings.tounicode
+ for unicode, v in next, tfmdata.characters do
+ local u = v.unicode
+ if u then
+ v.tounicode = tounicode(u)
+ end
+ end
+ --
+ -- However, when we use a bitmap font those vectors can't be constructed because
+ -- that information is not carried with those fonts (there is no name info, nor
+ -- proper index info, nor unicodes at that end). So, we provide it ourselves.
+ --
+ if tfmdata.usedbitmap then
+ tfm.addtounicode(tfmdata)
end
end
--
- -- However, when we use a bitmap font those vectors can't be constructed because
- -- that information is not carried with those fonts (there is no name info, nor
- -- proper index info, nor unicodes at that end). So, we provide it ourselves.
+ shared.processes = next(features) and tfm.setfeatures(tfmdata,features) or nil
--
- if tfmdata.usedbitmap then
- tfm.addtounicode(tfmdata)
+ if size < 0 then
+ size = idiv(65536 * -size,100)
end
- end
- --
- shared.processes = next(features) and tfm.setfeatures(tfmdata,features) or nil
- --
- if size < 0 then
- size = idiv(65536 * -size,100)
- end
- parameters.factor = 1 -- already scaled
- parameters.size = size
- parameters.slant = parameters.slant or parameters[1] or 0
- parameters.space = parameters.space or parameters[2] or 0
- parameters.space_stretch = parameters.space_stretch or parameters[3] or 0
- parameters.space_shrink = parameters.space_shrink or parameters[4] or 0
- parameters.x_height = parameters.x_height or parameters[5] or 0
- parameters.quad = parameters.quad or parameters[6] or 0
- parameters.extra_space = parameters.extra_space or parameters[7] or 0
- --
- constructors.enhanceparameters(parameters) -- official copies for us
- --
- properties.private = properties.private or tfmdata.private or privateoffset
- --
- if newtfmdata then
+ parameters.factor = 1 -- already scaled
+ parameters.units = 1000 -- just in case
+ parameters.size = size
+ parameters.slant = parameters.slant or parameters[1] or 0
+ parameters.space = parameters.space or parameters[2] or 0
+ parameters.space_stretch = parameters.space_stretch or parameters[3] or 0
+ parameters.space_shrink = parameters.space_shrink or parameters[4] or 0
+ parameters.x_height = parameters.x_height or parameters[5] or 0
+ parameters.quad = parameters.quad or parameters[6] or 0
+ parameters.extra_space = parameters.extra_space or parameters[7] or 0
+ --
+ constructors.enhanceparameters(parameters) -- official copies for us
--
- -- We do nothing as we assume flat tfm files. It would become real messy
- -- otherwise and I don't have something for testing on my system anyway.
+ properties.private = properties.private or tfmdata.private or privateoffset
--
- elseif loadtfmvf then
- -- already loaded
- local fonts = tfmdata.fonts
- if fonts then
- for i=1,#fonts do
- local font = fonts[i]
- local id = font.id
- if not id then
- local name = font.name
- local size = font.size
- if name and size then
- local data, id = constructors.readanddefine(name,size)
- if id then
- font.id = id
- font.name = nil
- font.size = nil
+ if newtfmdata then
+ --
+ -- We do nothing as we assume flat tfm files. It would become real messy
+ -- otherwise and I don't have something for testing on my system anyway.
+ --
+ elseif loadtfmvf then
+ -- already loaded
+ local fonts = tfmdata.fonts
+ if fonts then
+ for i=1,#fonts do
+ local font = fonts[i]
+ local id = font.id
+ if not id then
+ local name = font.name
+ local size = font.size
+ if name and size then
+ local data, id = constructors.readanddefine(name,size)
+ if id then
+ font.id = id
+ font.name = nil
+ font.size = nil
+ end
end
end
end
end
- end
- elseif constructors.resolvevirtualtoo then
- fonts.loggers.register(tfmdata,file.suffix(filename),specification) -- strange, why here
- local vfname = findbinfile(specification.name, 'ovf')
- if vfname and vfname ~= "" then
- local vfdata = font.read_vf(vfname,size) -- not cached, fast enough
- if vfdata then
- local chars = tfmdata.characters
- for k,v in next, vfdata.characters do
- chars[k].commands = v.commands
- end
- properties.virtualized = true
- tfmdata.fonts = vfdata.fonts
- tfmdata.type = "virtual" -- else nested calls with cummulative scaling
- local fontlist = vfdata.fonts
- local name = file.nameonly(filename)
- for i=1,#fontlist do
- local n = fontlist[i].name
- local s = fontlist[i].size
- local d = depth[filename]
- s = constructors.scaled(s,vfdata.designsize)
- if d > tfm.maxnestingdepth then
- report_defining("too deeply nested virtual font %a with size %a, max nesting depth %s",n,s,tfm.maxnestingdepth)
- fontlist[i] = { id = 0 }
- elseif (d > 1) and (s > tfm.maxnestingsize) then
- report_defining("virtual font %a exceeds size %s",n,s)
- fontlist[i] = { id = 0 }
- else
- local t, id = constructors.readanddefine(n,s)
- fontlist[i] = { id = id }
+ elseif constructors.resolvevirtualtoo then
+ fonts.loggers.register(tfmdata,file.suffix(filename),specification) -- strange, why here
+ local vfname = findbinfile(specification.name, 'ovf')
+ if vfname and vfname ~= "" then
+ local vfdata = loadvf(vfname,size)
+ if vfdata then
+ local chars = tfmdata.characters
+ for k,v in next, vfdata.characters do
+ chars[k].commands = v.commands
+ end
+ properties.virtualized = true
+ tfmdata.fonts = vfdata.fonts
+ tfmdata.type = "virtual" -- else nested calls with cummulative scaling
+ local fontlist = vfdata.fonts
+ local name = file.nameonly(filename)
+ for i=1,#fontlist do
+ local n = fontlist[i].name
+ local s = fontlist[i].size
+ local d = depth[filename]
+ s = constructors.scaled(s,vfdata.designsize)
+ if d > tfm.maxnestingdepth then
+ report_defining("too deeply nested virtual font %a with size %a, max nesting depth %s",n,s,tfm.maxnestingdepth)
+ fontlist[i] = { id = 0 }
+ elseif (d > 1) and (s > tfm.maxnestingsize) then
+ report_defining("virtual font %a exceeds size %s",n,s)
+ fontlist[i] = { id = 0 }
+ else
+ local t, id = constructors.readanddefine(n,s)
+ fontlist[i] = { id = id }
+ end
end
end
end
end
+ --
+ -- This is for old times sake (and context specific) so we comment it. It has
+ -- to do with encoding prefixes (a context naming that was later adopted by
+ -- the lm/gyre project)
+ --
+ -- if not features.encoding then
+ -- local encoding, filename = match(properties.filename,"^(.-)%-(.*)$")
+ -- if filename and encoding and encodings.known and encodings.known[encoding] then
+ -- features.encoding = encoding
+ -- end
+ -- end
+ --
+ -- Some afterthoughts:
+ --
+ properties.haskerns = true
+ properties.hasligatures = true
+ properties.hasitalics = true
+ resources.unicodes = { }
+ resources.lookuptags = { }
+ --
+ depth[filename] = depth[filename] - 1
+ --
+ return tfmdata
+ else
+ depth[filename] = depth[filename] - 1
end
- --
- -- This is for old times sake (and context specific) so we comment it. It has
- -- to do with encoding prefixes (a context naming that was later adopted by
- -- the lm/gyre project)
- --
- -- if not features.encoding then
- -- local encoding, filename = match(properties.filename,"^(.-)%-(.*)$")
- -- if filename and encoding and encodings.known and encodings.known[encoding] then
- -- features.encoding = encoding
- -- end
- -- end
- --
- -- Some afterthoughts:
- --
- properties.haskerns = true
- properties.hasligatures = true
- properties.hasitalics = true
- resources.unicodes = { }
- resources.lookuptags = { }
- --
- depth[filename] = depth[filename] - 1
- --
- return tfmdata
- else
- depth[filename] = depth[filename] - 1
end
-end
-local function check_tfm(specification,fullname) -- we could split up like afm/otf
- local foundname = findbinfile(fullname, 'tfm') or ""
- if foundname == "" then
- foundname = findbinfile(fullname, 'ofm') or "" -- not needed in context
- end
- if foundname == "" then
- foundname = fonts.names.getfilename(fullname,"tfm") or ""
- end
- if foundname ~= "" then
- specification.filename = foundname
- specification.format = "ofm"
- return read_from_tfm(specification)
- elseif trace_defining then
- report_defining("loading tfm with name %a fails",specification.name)
+ check_tfm = function(specification,fullname) -- we could split up like afm/otf
+ local foundname = findbinfile(fullname, 'tfm') or ""
+ if foundname == "" then
+ foundname = findbinfile(fullname, 'ofm') or "" -- not needed in context
+ end
+ if foundname == "" then
+ foundname = fonts.names.getfilename(fullname,"tfm") or ""
+ end
+ if foundname ~= "" then
+ specification.filename = foundname
+ specification.format = "ofm"
+ return read_from_tfm(specification)
+ elseif trace_defining then
+ report_defining("loading tfm with name %a fails",specification.name)
+ end
end
+
end
readers.check_tfm = check_tfm
diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua
index 3ae54adda..334a0b536 100644
--- a/tex/context/base/mkiv/grph-inc.lua
+++ b/tex/context/base/mkiv/grph-inc.lua
@@ -169,6 +169,15 @@ local img_copy = __img__.copy
local img_wrap = __img__.node
local img_embed = __img__.immediatewrite
+if img_new then
+ -- catch (actually we should be less picky in img)
+ local __img__new__ = img_new
+ img_new = function(t)
+ t.kind = nil
+ return __img__new__(t)
+ end
+end
+
updaters.register("backend.update",function()
local img = images.__img__
img_new = img.new
diff --git a/tex/context/base/mkiv/lpdf-ano.lua b/tex/context/base/mkiv/lpdf-ano.lua
index c69e9742a..9dc60e7a9 100644
--- a/tex/context/base/mkiv/lpdf-ano.lua
+++ b/tex/context/base/mkiv/lpdf-ano.lua
@@ -71,20 +71,10 @@ local new_latelua = nodepool.latelua
local texgetcount = tex.getcount
--- local codeinjections = backends.codeinjections
--- local getpos = codeinjections.getpos
--- local gethpos = codeinjections.gethpos
--- local getvpos = codeinjections.getvpos
-
-local getpos = lpdf.getpos
-local gethpos = lpdf.gethpos
-local getvpos = lpdf.getvpos
-
-updaters.register("backend.update",function()
- getpos = lpdf.getpos
- gethpos = lpdf.gethpos
- getvpos = lpdf.getvpos
-end)
+local jobpositions = job.positions
+local getpos = jobpositions.getpos
+local gethpos = jobpositions.gethpos
+local getvpos = jobpositions.getvpos
local pdfdictionary = lpdf.dictionary
local pdfarray = lpdf.array
diff --git a/tex/context/base/mkiv/lpdf-ini.lua b/tex/context/base/mkiv/lpdf-ini.lua
index 98c121778..769b54b6c 100644
--- a/tex/context/base/mkiv/lpdf-ini.lua
+++ b/tex/context/base/mkiv/lpdf-ini.lua
@@ -233,39 +233,23 @@ function lpdf.setsuppressoptionalinfo(n)
end
function lpdf.setomitcidset(v)
- return pdfsetomitcidset(v)
+ return setomitcidset(v)
end
-do
-
- local pdfgetpos = pdf.getpos
- local pdfgethpos = pdf.gethpos
- local pdfgetvpos = pdf.getvpos
- local pdfgetmatrix = pdf.getmatrix
- local pdfhasmatrix = pdf.hasmatrix
- local pdfprint = pdf.print
-
- function lpdf.getpos()
- return pdfgetpos()
- end
-
- function lpdf.gethpos()
- return pdfgethpos()
- end
+local jobpositions = job.positions
+local getpos = jobpositions.getpos
- function lpdf.getvpos()
- return pdfgetvpos()
- end
+jobpositions.registerhandlers {
+ getpos = pdf.getpos,
+ gethpos = pdf.gethpos,
+ getvpos = pdf.getvpos,
+}
- pdfbackend.codeinjections.getpos = lpdf.getpos
- pdfbackend.codeinjections.gethpos = lpdf.gethpos
- pdfbackend.codeinjections.getvpos = lpdf.getvpos
+do
- updaters.register("backend.update.lpdf",function()
- pdfgetpos = pdf.getpos
- pdfgethpos = pdf.gethpos
- pdfgetvpos = pdf.getvpos
- end)
+ local pdfgetmatrix = pdf.getmatrix
+ local pdfhasmatrix = pdf.hasmatrix
+ local pdfprint = pdf.print
-- todo
@@ -276,7 +260,7 @@ do
pdfbackend.codeinjections.print = lpdf.print
updaters.register("backend.update.lpdf",function()
- pdfprint = pdf.print
+ pdfprint = pdf.print
end)
-- todo
@@ -316,7 +300,7 @@ do
-- funny values for tx and ty
function lpdf.rectangle(width,height,depth,offset)
- local tx, ty = pdfgetpos()
+ local tx, ty = getpos()
if offset then
tx = tx - offset
ty = ty + offset
diff --git a/tex/context/base/mkiv/lpdf-mis.lua b/tex/context/base/mkiv/lpdf-mis.lua
index b9112457a..4fbbbb1d0 100644
--- a/tex/context/base/mkiv/lpdf-mis.lua
+++ b/tex/context/base/mkiv/lpdf-mis.lua
@@ -237,6 +237,10 @@ local function setupidentity()
addtoinfo("ID", pdfstring(id), id) -- needed for pdf/x
--
addtoinfo("ConTeXt.Version",version)
+ local lmtx = environment.lmtxmode and drivers and drivers.lmtxversion
+ if lmtx then
+ addtoinfo("ConTeXt.LMTX",formatters["%0.2f"](lmtx))
+ end
addtoinfo("ConTeXt.Time",os.date("%Y-%m-%d %H:%M"))
addtoinfo("ConTeXt.Jobname",jobname)
addtoinfo("ConTeXt.Url","www.pragma-ade.com")
diff --git a/tex/context/base/mkiv/lpdf-pda.xml b/tex/context/base/mkiv/lpdf-pda.xml
index 4bef927b0..2f07fed2d 100644
--- a/tex/context/base/mkiv/lpdf-pda.xml
+++ b/tex/context/base/mkiv/lpdf-pda.xml
@@ -30,6 +30,7 @@
<pdfx:ConTeXt.Url/>
<pdfx:ConTeXt.Support/>
<pdfx:ConTeXt.Version/>
+ <pdfx:ConTeXt.LMTX/>
<pdfx:TeX.Support/>
<pdfx:LuaTeX.Version/>
<pdfx:LuaTeX.Functionality/>
@@ -131,6 +132,12 @@
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:category>external</pdfaProperty:category>
+ <pdfaProperty:description>ConTeXt LMTX version</pdfaProperty:description>
+ <pdfaProperty:name>ConTeXt.LMTX</pdfaProperty:name>
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
+ </rdf:li>
+ <rdf:li rdf:parseType="Resource">
+ <pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>TeX support</pdfaProperty:description>
<pdfaProperty:name>TeX.Support</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
diff --git a/tex/context/base/mkiv/lpdf-pdx.xml b/tex/context/base/mkiv/lpdf-pdx.xml
index 889862c76..35726a5c0 100644
--- a/tex/context/base/mkiv/lpdf-pdx.xml
+++ b/tex/context/base/mkiv/lpdf-pdx.xml
@@ -29,6 +29,7 @@
<pdfx:ConTeXt.Url/>
<pdfx:ConTeXt.Support/>
<pdfx:ConTeXt.Version/>
+ <pdfx:ConTeXt.LMTX/>
<pdfx:TeX.Support/>
<pdfx:LuaTeX.Version/>
<pdfx:LuaTeX.Functionality/>
diff --git a/tex/context/base/mkiv/lpdf-pua.xml b/tex/context/base/mkiv/lpdf-pua.xml
index 24f05951d..f717762b6 100644
--- a/tex/context/base/mkiv/lpdf-pua.xml
+++ b/tex/context/base/mkiv/lpdf-pua.xml
@@ -29,6 +29,7 @@
<pdfx:ConTeXt.Url/>
<pdfx:ConTeXt.Support/>
<pdfx:ConTeXt.Version/>
+ <pdfx:ConTeXt.LMTX/>
<pdfx:TeX.Support/>
<pdfx:LuaTeX.Version/>
<pdfx:LuaTeX.Functionality/>
@@ -124,6 +125,12 @@
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:category>external</pdfaProperty:category>
+ <pdfaProperty:description>ConTeXt LMTX version</pdfaProperty:description>
+ <pdfaProperty:name>ConTeXt.LMTX</pdfaProperty:name>
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
+ </rdf:li>
+ <rdf:li rdf:parseType="Resource">
+ <pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>TeX support</pdfaProperty:description>
<pdfaProperty:name>TeX.Support</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
diff --git a/tex/context/base/mkiv/lpdf-xmp.lua b/tex/context/base/mkiv/lpdf-xmp.lua
index 43437962a..b9595062f 100644
--- a/tex/context/base/mkiv/lpdf-xmp.lua
+++ b/tex/context/base/mkiv/lpdf-xmp.lua
@@ -47,6 +47,7 @@ local mapping = {
["ConTeXt.Url"] = { "context", "rdf:Description/pdfx:ConTeXt.Url" },
["ConTeXt.Support"] = { "context", "rdf:Description/pdfx:ConTeXt.Support" },
["ConTeXt.Version"] = { "context", "rdf:Description/pdfx:ConTeXt.Version" },
+ ["ConTeXt.LMTX"] = { "context", "rdf:Description/pdfx:ConTeXt.LMTX" },
["TeX.Support"] = { "metadata","rdf:Description/pdfx:TeX.Support" },
["LuaTeX.Version"] = { "metadata","rdf:Description/pdfx:LuaTeX.Version" },
["LuaTeX.Functionality"] = { "metadata","rdf:Description/pdfx:LuaTeX.Functionality" },
@@ -111,50 +112,54 @@ function lpdf.id() -- overload of ini
return lpdfid(included.date)
end
-local pdfsettrailerid = lpdf.settrailerid -- this is the wrapped one
+local settrailerid = lpdf.settrailerid -- this is the wrapped one
-function lpdf.settrailerid(v)
- if v then
- local b = toboolean(v) or v == ""
+local trailerid = nil
+local dates = nil
+
+local function update()
+ if trailer_id then
+ local b = toboolean(trailer_id) or trailer_id == ""
if b then
- v = "This file is processed by ConTeXt and LuaTeX."
+ trailer_id = "This file is processed by ConTeXt and LuaTeX."
else
- v = tostring(v)
+ trailer_id = tostring(trailer_id)
end
- local h = md5HEX(v)
+ local h = md5HEX(trailer_id)
if b then
report_info("using frozen trailer id")
else
- report_info("using hashed trailer id %a (%a)",v,h)
+ report_info("using hashed trailer id %a (%a)",trailer_id,h)
end
- pdfsettrailerid(format("[<%s> <%s>]",h,h))
+ settrailerid(format("[<%s> <%s>]",h,h))
end
-end
-
-function lpdf.setdates(v)
- local t = type(v)
+ --
+ local t = type(dates)
if t == "number" or t == "string" then
- t = converters.totime(v)
+ t = converters.totime(dates)
if t then
included.date = true
included.id = "fake"
report_info("forced date/time information %a will be used",lpdf.settime(t))
- lpdf.settrailerid(false)
+ settrailerid(false)
return
end
end
- v = toboolean(v)
- included.date = v
- if v then
+ dates = toboolean(dates)
+ included.date = dates
+ if dates then
included.id = true
else
report_info("no date/time but fake id information will be added")
- lpdf.settrailerid(true)
+ settrailerid(true)
included.id = "fake"
- -- maybe: lpdf.settime(231631200) -- 1975-05-05 % first entry of knuth about tex mentioned in DT
end
end
+function lpdf.settrailerid(v) trailerid = v end
+function lpdf.setdates (v) dates = v end
+
+lpdf.registerdocumentfinalizer(update,"trailer id and dates",1)
directives.register("backend.trailerid", lpdf.settrailerid)
directives.register("backend.date", lpdf.setdates)
diff --git a/tex/context/base/mkiv/node-syn.lua b/tex/context/base/mkiv/node-syn.lua
index 835a60193..c9a7f6608 100644
--- a/tex/context/base/mkiv/node-syn.lua
+++ b/tex/context/base/mkiv/node-syn.lua
@@ -179,12 +179,6 @@ local force_synctex_line = tex.force_synctex_line
local get_synctex_line = tex.get_synctex_line
local set_synctex_mode = tex.set_synctex_mode
-local getpos = function() getpos = backends.codeinjections.getpos return getpos() end
-
-updaters.register("backend.update",function()
- getpos = backends.codeinjections.getpos
-end)
-
local foundintree = resolvers.foundintree
local eol = "\010"
@@ -208,6 +202,8 @@ local f_vlist_2 = formatters["v%i,%i:%i,%s:%i,%i,%i\010"]
local synctex = luatex.synctex or { }
luatex.synctex = synctex
+local getpos ; getpos = function() getpos = job.positions.getpos return getpos() end
+
-- status stuff
local enabled = false
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 60ab6f82f..905068fc4 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 863c2d643..925e6efa7 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua
index 8b0c5467e..e7ea73d3c 100644
--- a/tex/context/base/mkiv/strc-ref.lua
+++ b/tex/context/base/mkiv/strc-ref.lua
@@ -74,6 +74,7 @@ local lists = structures.lists
local counters = structures.counters
local jobpositions = job.positions
+local getpos = jobpositions.getpos
-- some might become local
@@ -424,12 +425,6 @@ end
-- end
-- end
-local getpos = function() getpos = backends.codeinjections.getpos return getpos () end
-
-updaters.register("backend.update",function()
- getpos = backends.codeinjections.getpos
-end)
-
local function synchronizepage(reference) -- non public helper
reference.realpage = texgetcount("realpageno")
if jobpositions.used then
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index c2fd61636..7cf012add 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 9a4afe44d..83fffc41a 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 493c21a03..f467d02e3 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 11/29/18 19:46:33
+-- merge date : 12/01/18 13:20:11
do -- begin closure to overcome local limits and interference
@@ -9850,9 +9850,9 @@ function constructors.scale(tfmdata,specification)
constructors.aftercopyingcharacters(target,tfmdata)
constructors.trytosharefont(target,tfmdata)
local vfonts=target.fonts
-if isvirtual or target.type=="virtual" or properties.virtualized then
+ if isvirtual or target.type=="virtual" or properties.virtualized then
properties.virtualized=true
-target.type="virtual"
+ target.type="virtual"
if not vfonts or #vfonts==0 then
target.fonts={ { id=0 } }
end
@@ -34316,184 +34316,190 @@ function tfm.setfeatures(tfmdata,features)
end
end
local depth={}
-local loadtfmvf=tfm.readers and tfm.readers.loadtfmvf
-directives.register("fonts.tfm.builtin",function(v)
- loadtfmvf=tfm.readers and tfm.readers.loadtfmvf
- if v and font.read_tfm then
- loadtfmvf=false
- end
-end)
-local function read_from_tfm(specification)
- local filename=specification.filename
- local size=specification.size
- depth[filename]=(depth[filename] or 0)+1
- if trace_defining then
- report_defining("loading tfm file %a at size %s",filename,size)
- end
- local tfmdata
- if loadtfmvf then
- tfmdata=loadtfmvf(filename,size)
- else
- tfmdata=font.read_tfm(filename,size)
- end
- if tfmdata then
- local features=specification.features and specification.features.normal or {}
- local features=constructors.checkedfeatures("tfm",features)
- specification.features.normal=features
- local newtfmdata=(depth[filename]==1) and tfm.reencode(tfmdata,specification)
- if newtfmdata then
- tfmdata=newtfmdata
+local read_from_tfm,check_tfm do
+ local tfmreaders=context and tfm.readers
+ local loadtfmvf=tfmreaders and tfmreaders.loadtfmvf
+ local loadtfm=font.read_tfm
+ local loadvf=font.read_vf
+ directives.register("fonts.tfm.builtin",function(v)
+ loadtfmvf=tfmreaders and tfmreaders.loadtfmvf
+ if v and loadtfm then
+ loadtfmvf=false
end
- local resources=tfmdata.resources or {}
- local properties=tfmdata.properties or {}
- local parameters=tfmdata.parameters or {}
- local shared=tfmdata.shared or {}
- shared.features=features
- shared.resources=resources
- properties.name=tfmdata.name
- properties.fontname=tfmdata.fontname
- properties.psname=tfmdata.psname
- properties.fullname=tfmdata.fullname
- properties.filename=specification.filename
- properties.format=tfmdata.format or fonts.formats.tfm
- properties.usedbitmap=tfmdata.usedbitmap
- tfmdata.properties=properties
- tfmdata.resources=resources
- tfmdata.parameters=parameters
- tfmdata.shared=shared
- shared.rawdata={ resources=resources }
- shared.features=features
- if newtfmdata then
- if not resources.marks then
- resources.marks={}
- end
- if not resources.sequences then
- resources.sequences={}
- end
- if not resources.features then
- resources.features={
- gsub={},
- gpos={},
- }
- end
- if not tfmdata.changed then
- tfmdata.changed={}
- end
- if not tfmdata.descriptions then
- tfmdata.descriptions=tfmdata.characters
- end
- otf.readers.addunicodetable(tfmdata)
- tfmenhancers.apply(tfmdata,filename)
- constructors.applymanipulators("tfm",tfmdata,features,trace_features,report_tfm)
- otf.readers.unifymissing(tfmdata)
- fonts.mappings.addtounicode(tfmdata,filename)
- tfmdata.tounicode=1
- local tounicode=fonts.mappings.tounicode
- for unicode,v in next,tfmdata.characters do
- local u=v.unicode
- if u then
- v.tounicode=tounicode(u)
- end
- end
- if tfmdata.usedbitmap then
- tfm.addtounicode(tfmdata)
- end
- end
- shared.processes=next(features) and tfm.setfeatures(tfmdata,features) or nil
- if size<0 then
- size=idiv(65536*-size,100)
- end
- parameters.factor=1
- parameters.size=size
- parameters.slant=parameters.slant or parameters[1] or 0
- parameters.space=parameters.space or parameters[2] or 0
- parameters.space_stretch=parameters.space_stretch or parameters[3] or 0
- parameters.space_shrink=parameters.space_shrink or parameters[4] or 0
- parameters.x_height=parameters.x_height or parameters[5] or 0
- parameters.quad=parameters.quad or parameters[6] or 0
- parameters.extra_space=parameters.extra_space or parameters[7] or 0
- constructors.enhanceparameters(parameters)
- properties.private=properties.private or tfmdata.private or privateoffset
- if newtfmdata then
- elseif loadtfmvf then
- local fonts=tfmdata.fonts
- if fonts then
- for i=1,#fonts do
- local font=fonts[i]
- local id=font.id
- if not id then
- local name=font.name
- local size=font.size
- if name and size then
- local data,id=constructors.readanddefine(name,size)
- if id then
- font.id=id
- font.name=nil
- font.size=nil
+ end)
+ read_from_tfm=function(specification)
+ local filename=specification.filename
+ local size=specification.size
+ depth[filename]=(depth[filename] or 0)+1
+ if trace_defining then
+ report_defining("loading tfm file %a at size %s",filename,size)
+ end
+ local tfmdata
+ if loadtfmvf then
+ tfmdata=loadtfmvf(filename,size)
+ else
+ tfmdata=loadtfm(filename,size)
+ end
+ if tfmdata then
+ local features=specification.features and specification.features.normal or {}
+ local features=constructors.checkedfeatures("tfm",features)
+ specification.features.normal=features
+ local newtfmdata=(depth[filename]==1) and tfm.reencode(tfmdata,specification)
+ if newtfmdata then
+ tfmdata=newtfmdata
+ end
+ local resources=tfmdata.resources or {}
+ local properties=tfmdata.properties or {}
+ local parameters=tfmdata.parameters or {}
+ local shared=tfmdata.shared or {}
+ shared.features=features
+ shared.resources=resources
+ properties.name=tfmdata.name
+ properties.fontname=tfmdata.fontname
+ properties.psname=tfmdata.psname
+ properties.fullname=tfmdata.fullname
+ properties.filename=specification.filename
+ properties.format=tfmdata.format or fonts.formats.tfm
+ properties.usedbitmap=tfmdata.usedbitmap
+ tfmdata.properties=properties
+ tfmdata.resources=resources
+ tfmdata.parameters=parameters
+ tfmdata.shared=shared
+ shared.rawdata={ resources=resources }
+ shared.features=features
+ if newtfmdata then
+ if not resources.marks then
+ resources.marks={}
+ end
+ if not resources.sequences then
+ resources.sequences={}
+ end
+ if not resources.features then
+ resources.features={
+ gsub={},
+ gpos={},
+ }
+ end
+ if not tfmdata.changed then
+ tfmdata.changed={}
+ end
+ if not tfmdata.descriptions then
+ tfmdata.descriptions=tfmdata.characters
+ end
+ otf.readers.addunicodetable(tfmdata)
+ tfmenhancers.apply(tfmdata,filename)
+ constructors.applymanipulators("tfm",tfmdata,features,trace_features,report_tfm)
+ otf.readers.unifymissing(tfmdata)
+ fonts.mappings.addtounicode(tfmdata,filename)
+ tfmdata.tounicode=1
+ local tounicode=fonts.mappings.tounicode
+ for unicode,v in next,tfmdata.characters do
+ local u=v.unicode
+ if u then
+ v.tounicode=tounicode(u)
+ end
+ end
+ if tfmdata.usedbitmap then
+ tfm.addtounicode(tfmdata)
+ end
+ end
+ shared.processes=next(features) and tfm.setfeatures(tfmdata,features) or nil
+ if size<0 then
+ size=idiv(65536*-size,100)
+ end
+ parameters.factor=1
+ parameters.units=1000
+ parameters.size=size
+ parameters.slant=parameters.slant or parameters[1] or 0
+ parameters.space=parameters.space or parameters[2] or 0
+ parameters.space_stretch=parameters.space_stretch or parameters[3] or 0
+ parameters.space_shrink=parameters.space_shrink or parameters[4] or 0
+ parameters.x_height=parameters.x_height or parameters[5] or 0
+ parameters.quad=parameters.quad or parameters[6] or 0
+ parameters.extra_space=parameters.extra_space or parameters[7] or 0
+ constructors.enhanceparameters(parameters)
+ properties.private=properties.private or tfmdata.private or privateoffset
+ if newtfmdata then
+ elseif loadtfmvf then
+ local fonts=tfmdata.fonts
+ if fonts then
+ for i=1,#fonts do
+ local font=fonts[i]
+ local id=font.id
+ if not id then
+ local name=font.name
+ local size=font.size
+ if name and size then
+ local data,id=constructors.readanddefine(name,size)
+ if id then
+ font.id=id
+ font.name=nil
+ font.size=nil
+ end
end
end
end
end
- end
- elseif constructors.resolvevirtualtoo then
- fonts.loggers.register(tfmdata,file.suffix(filename),specification)
- local vfname=findbinfile(specification.name,'ovf')
- if vfname and vfname~="" then
- local vfdata=font.read_vf(vfname,size)
- if vfdata then
- local chars=tfmdata.characters
- for k,v in next,vfdata.characters do
- chars[k].commands=v.commands
- end
- properties.virtualized=true
- tfmdata.fonts=vfdata.fonts
- tfmdata.type="virtual"
- local fontlist=vfdata.fonts
- local name=file.nameonly(filename)
- for i=1,#fontlist do
- local n=fontlist[i].name
- local s=fontlist[i].size
- local d=depth[filename]
- s=constructors.scaled(s,vfdata.designsize)
- if d>tfm.maxnestingdepth then
- report_defining("too deeply nested virtual font %a with size %a, max nesting depth %s",n,s,tfm.maxnestingdepth)
- fontlist[i]={ id=0 }
- elseif (d>1) and (s>tfm.maxnestingsize) then
- report_defining("virtual font %a exceeds size %s",n,s)
- fontlist[i]={ id=0 }
- else
- local t,id=constructors.readanddefine(n,s)
- fontlist[i]={ id=id }
+ elseif constructors.resolvevirtualtoo then
+ fonts.loggers.register(tfmdata,file.suffix(filename),specification)
+ local vfname=findbinfile(specification.name,'ovf')
+ if vfname and vfname~="" then
+ local vfdata=loadvf(vfname,size)
+ if vfdata then
+ local chars=tfmdata.characters
+ for k,v in next,vfdata.characters do
+ chars[k].commands=v.commands
+ end
+ properties.virtualized=true
+ tfmdata.fonts=vfdata.fonts
+ tfmdata.type="virtual"
+ local fontlist=vfdata.fonts
+ local name=file.nameonly(filename)
+ for i=1,#fontlist do
+ local n=fontlist[i].name
+ local s=fontlist[i].size
+ local d=depth[filename]
+ s=constructors.scaled(s,vfdata.designsize)
+ if d>tfm.maxnestingdepth then
+ report_defining("too deeply nested virtual font %a with size %a, max nesting depth %s",n,s,tfm.maxnestingdepth)
+ fontlist[i]={ id=0 }
+ elseif (d>1) and (s>tfm.maxnestingsize) then
+ report_defining("virtual font %a exceeds size %s",n,s)
+ fontlist[i]={ id=0 }
+ else
+ local t,id=constructors.readanddefine(n,s)
+ fontlist[i]={ id=id }
+ end
end
end
end
end
+ properties.haskerns=true
+ properties.hasligatures=true
+ properties.hasitalics=true
+ resources.unicodes={}
+ resources.lookuptags={}
+ depth[filename]=depth[filename]-1
+ return tfmdata
+ else
+ depth[filename]=depth[filename]-1
end
- properties.haskerns=true
- properties.hasligatures=true
- properties.hasitalics=true
- resources.unicodes={}
- resources.lookuptags={}
- depth[filename]=depth[filename]-1
- return tfmdata
- else
- depth[filename]=depth[filename]-1
- end
-end
-local function check_tfm(specification,fullname)
- local foundname=findbinfile(fullname,'tfm') or ""
- if foundname=="" then
- foundname=findbinfile(fullname,'ofm') or ""
- end
- if foundname=="" then
- foundname=fonts.names.getfilename(fullname,"tfm") or ""
end
- if foundname~="" then
- specification.filename=foundname
- specification.format="ofm"
- return read_from_tfm(specification)
- elseif trace_defining then
- report_defining("loading tfm with name %a fails",specification.name)
+ check_tfm=function(specification,fullname)
+ local foundname=findbinfile(fullname,'tfm') or ""
+ if foundname=="" then
+ foundname=findbinfile(fullname,'ofm') or ""
+ end
+ if foundname=="" then
+ foundname=fonts.names.getfilename(fullname,"tfm") or ""
+ end
+ if foundname~="" then
+ specification.filename=foundname
+ specification.format="ofm"
+ return read_from_tfm(specification)
+ elseif trace_defining then
+ report_defining("loading tfm with name %a fails",specification.name)
+ end
end
end
readers.check_tfm=check_tfm