diff options
author | Karl Berry <karl@freefriends.org> | 2016-05-15 21:07:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-05-15 21:07:12 +0000 |
commit | b6a82290dcde74722176ee588102f1c924c9fa89 (patch) | |
tree | 474838d10829e68cddc94c207df2ae9b98600ada /Master/texmf-dist | |
parent | de072b82538a959d5fc50c3a3316d0668c26db9c (diff) |
context (15may16)
git-svn-id: svn://tug.org/texlive/trunk@41152 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
64 files changed, 786 insertions, 643 deletions
diff --git a/Master/texmf-dist/doc/man/man1/context.man1.pdf b/Master/texmf-dist/doc/man/man1/context.man1.pdf Binary files differindex 4a5f980a6ae..6ceacad747a 100644 --- a/Master/texmf-dist/doc/man/man1/context.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/context.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/luatools.man1.pdf b/Master/texmf-dist/doc/man/man1/luatools.man1.pdf Binary files differindex c0c5943ab74..37f9f289338 100644 --- a/Master/texmf-dist/doc/man/man1/luatools.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/luatools.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-babel.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-babel.man1.pdf Binary files differindex 3227d894b4f..1505a29d2c4 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-babel.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-babel.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-base.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-base.man1.pdf Binary files differindex 5ccf9e1fcd0..9f74842648d 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-base.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-base.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-bibtex.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-bibtex.man1.pdf Binary files differindex ff084905d04..0a68aa20636 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-bibtex.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-bibtex.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-cache.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-cache.man1.pdf Binary files differindex f5060c847c6..5c97803bd6e 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-cache.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-cache.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-chars.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-chars.man1.pdf Binary files differindex c61d14e1cd6..60b6ec0ae38 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-chars.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-chars.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-check.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-check.man1.pdf Binary files differindex b95d0464259..3bc0dfa0497 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-check.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-check.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-colors.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-colors.man1.pdf Binary files differindex 22f859c93f1..b425e9a2ca2 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-colors.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-colors.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-context.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-context.man1.pdf Binary files differindex 65a1e7179df..af59c43e5a9 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-context.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-context.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-epub.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-epub.man1.pdf Binary files differindex b5ff7c6d5b3..c2162c72a75 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-epub.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-epub.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-fcd.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-fcd.man1.pdf Binary files differindex 7a65779b1c0..a8a2b2c61ac 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-fcd.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-fcd.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-flac.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-flac.man1.pdf Binary files differindex b77435bab3b..304e6076038 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-flac.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-flac.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-fonts.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-fonts.man1.pdf Binary files differindex b23f413ba50..9686d2d545f 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-fonts.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-fonts.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-grep.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-grep.man1.pdf Binary files differindex 0d4303c73a2..1fe1de47faf 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-grep.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-grep.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-interface.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-interface.man1.pdf Binary files differindex 59b9d96135f..62b217d6b0a 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-interface.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-interface.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-metapost.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-metapost.man1.pdf Binary files differindex 53a17b66920..3ff71ce5ace 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-metapost.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-metapost.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-metatex.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-metatex.man1.pdf Binary files differindex 0eddeddc06e..1395259082e 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-metatex.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-metatex.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-modules.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-modules.man1.pdf Binary files differindex 4bf961030c3..aa5f0bc04df 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-modules.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-modules.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-package.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-package.man1.pdf Binary files differindex 431dae00983..15a86ea37e7 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-package.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-package.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-patterns.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-patterns.man1.pdf Binary files differindex 5eead7d0235..43553b9d9a7 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-patterns.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-patterns.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-pdf.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-pdf.man1.pdf Binary files differindex d2d18919974..b9651251682 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-pdf.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-pdf.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-plain.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-plain.man1.pdf Binary files differindex 9ffd758c5bf..5c261a6f1c1 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-plain.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-plain.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-profile.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-profile.man1.pdf Binary files differindex 5d9c78081dc..55a6ad3f97e 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-profile.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-profile.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-rsync.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-rsync.man1.pdf Binary files differindex 8e008c6fbf2..72467fcf9cd 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-rsync.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-rsync.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-scite.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-scite.man1.pdf Binary files differindex db75ee9779d..87e5949627e 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-scite.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-scite.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-server.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-server.man1.pdf Binary files differindex 149c8f355e6..7dda6248666 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-server.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-server.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-texworks.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-texworks.man1.pdf Binary files differindex 21318278d20..c4679588b92 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-texworks.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-texworks.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-timing.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-timing.man1.pdf Binary files differindex 4404409b84d..0949c84055f 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-timing.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-timing.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-tools.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-tools.man1.pdf Binary files differindex b30295fe8d4..4c4d4e8b227 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-tools.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-tools.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-unicode.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-unicode.man1.pdf Binary files differindex 5846a7ab40a..9b269643d7c 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-unicode.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-unicode.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-unzip.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-unzip.man1.pdf Binary files differindex 005dfd8ab4d..da35a312b31 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-unzip.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-unzip.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-update.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-update.man1.pdf Binary files differindex 50bf2847bb7..adcbd746c43 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-update.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-update.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-watch.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-watch.man1.pdf Binary files differindex bc77e1f73e1..6acf34d0162 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-watch.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-watch.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtx-youless.man1.pdf b/Master/texmf-dist/doc/man/man1/mtx-youless.man1.pdf Binary files differindex 20aca93b8f0..4205ecca42f 100644 --- a/Master/texmf-dist/doc/man/man1/mtx-youless.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtx-youless.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/mtxrun.man1.pdf b/Master/texmf-dist/doc/man/man1/mtxrun.man1.pdf Binary files differindex db7c7c0214a..2fa9701b368 100644 --- a/Master/texmf-dist/doc/man/man1/mtxrun.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/mtxrun.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/texexec.man1.pdf b/Master/texmf-dist/doc/man/man1/texexec.man1.pdf Binary files differindex c5e509a8e99..a99c42b1697 100644 --- a/Master/texmf-dist/doc/man/man1/texexec.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/texexec.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/texmfstart.man1.pdf b/Master/texmf-dist/doc/man/man1/texmfstart.man1.pdf Binary files differindex 8d412c9eea1..c79df778caf 100644 --- a/Master/texmf-dist/doc/man/man1/texmfstart.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/texmfstart.man1.pdf diff --git a/Master/texmf-dist/metapost/context/base/mpiv/mp-page.mpiv b/Master/texmf-dist/metapost/context/base/mpiv/mp-page.mpiv index 4ccf4448ec2..07d264f6012 100644 --- a/Master/texmf-dist/metapost/context/base/mpiv/mp-page.mpiv +++ b/Master/texmf-dist/metapost/context/base/mpiv/mp-page.mpiv @@ -665,6 +665,7 @@ enddef ; % for the moment we put these here: +string RuleOption ; RuleOption := "" ; numeric RuleWidth ; RuleWidth := 0 ; numeric RuleHeight ; RuleHeight := 0 ; numeric RuleDepth ; RuleDepth := 0 ; diff --git a/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua b/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua index 574d0e39e06..0c3224fe040 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua @@ -121,6 +121,8 @@ loadmodule("font-tmp.lua") loadmodule("font-dsp.lua") -- not yet in distribution loadmodule("font-oup.lua") -- not yet in distribution +loadmodule("font-onr.lua") + -- extra code loadmodule("font-syn.lua") diff --git a/Master/texmf-dist/tex/context/base/context-version.pdf b/Master/texmf-dist/tex/context/base/context-version.pdf Binary files differindex 5e69d71142f..2aacea69dd4 100644 --- a/Master/texmf-dist/tex/context/base/context-version.pdf +++ b/Master/texmf-dist/tex/context/base/context-version.pdf diff --git a/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv b/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv index ee9b7de6c9b..65128dabbb7 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2016.05.13 16:21} +\newcontextversion{2016.05.14 14:06} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/Master/texmf-dist/tex/context/base/mkiv/context-todo.tex b/Master/texmf-dist/tex/context/base/mkiv/context-todo.tex index 39cca9a3a72..9569e5352ff 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/context-todo.tex +++ b/Master/texmf-dist/tex/context/base/mkiv/context-todo.tex @@ -13,6 +13,9 @@ head||tail cleanup in disc nodes (get rid of temp i.e.\ delay till linebreak) \stopitem \startitem + cleanup passive nodes + \stopitem + \startitem optimize some callback resolution (more direct) \stopitem \startitem diff --git a/Master/texmf-dist/tex/context/base/mkiv/context.mkiv b/Master/texmf-dist/tex/context/base/mkiv/context.mkiv index bf9d4627078..72718b53cad 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/context.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2016.05.13 16:21} +\edef\contextversion{2016.05.14 14:06} \edef\contextkind {beta} %D For those who want to use this: diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-lib.mkvi b/Master/texmf-dist/tex/context/base/mkiv/font-lib.mkvi index 90de409d138..fd6f70d69a5 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-lib.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/font-lib.mkvi @@ -32,15 +32,11 @@ \registerctxluafile{font-dsp}{1.001} % ... for this one \registerctxluafile{font-off}{1.001} % the old loader -\registerctxluafile{font-syn}{1.001} - \registerctxluafile{font-tfm}{1.001} \registerctxluafile{font-hsh}{1.001} % hashes used by context \registerctxluafile{font-nod}{1.001} -\registerctxluafile{font-trt}{1.001} - \registerctxluafile{font-oti}{1.001} % otf initialization \registerctxluafile{font-ott}{1.001} % otf tables (first) @@ -57,10 +53,16 @@ % we use otf code for type one +\registerctxluafile{font-onr}{1.001} \registerctxluafile{font-one}{1.001} %registerctxluafile{font-afm}{1.001} \registerctxluafile{font-afk}{1.001} +% name database + +\registerctxluafile{font-syn}{1.001} +\registerctxluafile{font-trt}{1.001} + % so far \registerctxluafile{font-pat}{1.001} % patchers diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-one.lua b/Master/texmf-dist/tex/context/base/mkiv/font-one.lua index 5d54150c527..77f2560f6cb 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-one.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-one.lua @@ -55,7 +55,7 @@ local otfenhancers = otf.enhancers local afmfeatures = constructors.newfeatures("afm") local registerafmfeature = afmfeatures.register -afm.version = 1.510 -- incrementing this number one up will force a re-cache +afm.version = 1.512 -- incrementing this number one up will force a re-cache afm.cache = containers.define("fonts", "afm", afm.version, true) afm.autoprefixed = true -- this will become false some day (catches texnansi-blabla.*) @@ -67,357 +67,6 @@ local overloads = fonts.mappings.overloads local applyruntimefixes = fonts.treatments and fonts.treatments.applyfixes --[[ldx-- -<p>We start with the basic reader which we give a name similar to the built in <l n='tfm'/> -and <l n='otf'/> reader.</p> ---ldx]]-- - --- Comment FONTIDENTIFIER LMMATHSYMBOLS10 --- Comment CODINGSCHEME TEX MATH SYMBOLS --- Comment DESIGNSIZE 10.0 pt --- Comment CHECKSUM O 4261307036 --- Comment SPACE 0 plus 0 minus 0 --- Comment QUAD 1000 --- Comment EXTRASPACE 0 --- Comment NUM 676.508 393.732 443.731 --- Comment DENOM 685.951 344.841 --- Comment SUP 412.892 362.892 288.889 --- Comment SUB 150 247.217 --- Comment SUPDROP 386.108 --- Comment SUBDROP 50 --- Comment DELIM 2390 1010 --- Comment AXISHEIGHT 250 - ---[[ldx-- -<p>We now use a new (unfinished) pfb loader but I see no differences between the old -and new vectors (we actually had one bad vector with the old loader).</p> ---ldx]]-- - -local get_indexes - -do - - local n, m - - local progress = function(str,position,name,size) - local forward = position + tonumber(size) + 3 + 2 - n = n + 1 - if n >= m then - return #str, name - elseif forward < #str then - return forward, name - else - return #str, name - end - end - - local initialize = function(str,position,size) - n = 0 - m = tonumber(size) - return position + 1 - end - - local charstrings = P("/CharStrings") - local name = P("/") * C((R("az")+R("AZ")+R("09")+S("-_."))^1) - local size = C(R("09")^1) - local spaces = P(" ")^1 - - local p_filternames = Ct ( - (1-charstrings)^0 * charstrings * spaces * Cmt(size,initialize) - * (Cmt(name * P(" ")^1 * C(R("09")^1), progress) + P(1))^1 - ) - - -- if one of first 4 not 0-9A-F then binary else hex - - local decrypt - - do - - local r, c1, c2, n = 0, 0, 0, 0 - - local function step(c) - local cipher = byte(c) - local plain = bxor(cipher,rshift(r,8)) - r = ((cipher + r) * c1 + c2) % 65536 - return char(plain) - end - - decrypt = function(binary) - r, c1, c2, n = 55665, 52845, 22719, 4 - binary = gsub(binary,".",step) - return sub(binary,n+1) - end - - -- local pattern = Cs((P(1) / step)^1) - -- - -- decrypt = function(binary) - -- r, c1, c2, n = 55665, 52845, 22719, 4 - -- binary = lpegmatch(pattern,binary) - -- return sub(binary,n+1) - -- end - - end - - local function loadpfbvector(filename) - -- for the moment limited to encoding only - - local data = io.loaddata(resolvers.findfile(filename)) - - if not find(data,"!PS%-AdobeFont%-") then - print("no font",filename) - return - end - - if not data then - print("no data",filename) - return - end - - local ascii, binary = match(data,"(.*)eexec%s+......(.*)") - - if not binary then - print("no binary",filename) - return - end - - binary = decrypt(binary,4) - - local vector = lpegmatch(p_filternames,binary) - - vector[0] = table.remove(vector,1) - - if not vector then - print("no vector",filename) - return - end - - return vector - - end - - get_indexes = function(data,pfbname) - local vector = loadpfbvector(pfbname) - if vector then - local characters = data.characters - if trace_loading then - report_afm("getting index data from %a",pfbname) - end - for index=1,#vector do - local name = vector[index] - local char = characters[name] - if char then - if trace_indexing then - report_afm("glyph %a has index %a",name,index) - end - char.index = index - end - end - end - end - -end - ---[[ldx-- -<p>We start with the basic reader which we give a name similar to the built in <l n='tfm'/> -and <l n='otf'/> reader.</p> ---ldx]]-- - --- Comment FONTIDENTIFIER LMMATHSYMBOLS10 --- Comment CODINGSCHEME TEX MATH SYMBOLS --- Comment DESIGNSIZE 10.0 pt --- Comment CHECKSUM O 4261307036 --- Comment SPACE 0 plus 0 minus 0 --- Comment QUAD 1000 --- Comment EXTRASPACE 0 --- Comment NUM 676.508 393.732 443.731 --- Comment DENOM 685.951 344.841 --- Comment SUP 412.892 362.892 288.889 --- Comment SUB 150 247.217 --- Comment SUPDROP 386.108 --- Comment SUBDROP 50 --- Comment DELIM 2390 1010 --- Comment AXISHEIGHT 250 --- Comment DesignSize 12 (pts) --- Comment TFM designsize: 12 (in points) - -local readafm - -do -- no need for a further speedup with locals - - local spacing = patterns.spacer - local lineend = patterns.newline - local number = spacing * (R("09") + S("."))^1 / tonumber - local name = spacing * C((1-spacing)^1) - local words = spacing * (1 - lineend)^1 / strip - local rest = (1 - lineend)^0 - local fontdata = Carg(1) - local semicolon = spacing * P(";") - local plus = P("plus") * number - local minus = P("minus") * number - - -- kern pairs - - local function addkernpair(data,one,two,value) - local chr = data.characters[one] - if chr then - local kerns = chr.kerns - if kerns then - kerns[two] = tonumber(value) - else - chr.kerns = { [two] = tonumber(value) } - end - end - end - - local p_kernpair = (fontdata * P("KPX") * name * name * number) / addkernpair - - -- char metrics - - local chr = false - local ind = 0 - - local function start() - ind = 0 - chr = { } - end - - local function stop() - ind = 0 - chr = false - end - - local function setindex(i) - if i < 0 then - ind = ind + 1 -- ? - else - ind = i - end - chr = { - index = ind - } - end - - local function setwidth(width) - chr.width = width - end - - local function setname(data,name) - data.characters[name] = chr - end - - local function setboundingbox(boundingbox) - chr.boundingbox = boundingbox - end - - local function setligature(plus,becomes) - local ligatures = chr.ligatures - if ligatures then - ligatures[plus] = becomes - else - chr.ligatures = { [plus] = becomes } - end - end - - local p_charmetric = ( ( - P("C") * number / setindex - + P("WX") * number / setwidth - + P("N") * fontdata * name / setname - + P("B") * Ct((number)^4) / setboundingbox - + P("L") * (name)^2 / setligature - ) * semicolon )^1 - - local p_charmetrics = P("StartCharMetrics") * number * (p_charmetric + (1-P("EndCharMetrics")))^0 * P("EndCharMetrics") - local p_kernpairs = P("StartKernPairs") * number * (p_kernpair + (1-P("EndKernPairs")) )^0 * P("EndKernPairs") - - local function set_1(data,key,a) data.metadata[lower(key)] = a end - local function set_2(data,key,a,b) data.metadata[lower(key)] = { a, b } end - local function set_3(data,key,a,b,c) data.metadata[lower(key)] = { a, b, c } end - - local p_parameters = P(false) - + P("FontName") * fontdata * words / function(data,line) - data.metadata.fontname = line - data.metadata.fullname = line - end - + P("ItalicAngle") * fontdata * number / function(data,angle) - data.metadata.italicangle = angle - end - + P("IsFixedPitch") * fontdata * name / function(data,pitch) - data.metadata.monospaced = toboolean(pitch,true) - end - + P("CharWidth") * fontdata * number / function(data,width) - data.metadata.charwidth = width - end - + P("XHeight") * fontdata * number / function(data,xheight) - data.metadata.xheight = xheight - end - + P("Descender") * fontdata * number / function(data,descender) - data.metadata.descender = descender - end - + P("Ascender") * fontdata * number / function(data,ascender) - data.metadata.ascender = ascender - end - + P("Comment") * spacing * ( P(false) - + (fontdata * C("DESIGNSIZE") * number * rest) / set_1 -- 1 - + (fontdata * C("TFM designsize") * number * rest) / set_1 - + (fontdata * C("DesignSize") * number * rest) / set_1 - + (fontdata * C("CODINGSCHEME") * words * rest) / set_1 -- - + (fontdata * C("CHECKSUM") * number * words * rest) / set_1 -- 2 - + (fontdata * C("SPACE") * number * plus * minus * rest) / set_3 -- 3 4 5 - + (fontdata * C("QUAD") * number * rest) / set_1 -- 6 - + (fontdata * C("EXTRASPACE") * number * rest) / set_1 -- 7 - + (fontdata * C("NUM") * number * number * number * rest) / set_3 -- 8 9 10 - + (fontdata * C("DENOM") * number * number * rest) / set_2 -- 11 12 - + (fontdata * C("SUP") * number * number * number * rest) / set_3 -- 13 14 15 - + (fontdata * C("SUB") * number * number * rest) / set_2 -- 16 17 - + (fontdata * C("SUPDROP") * number * rest) / set_1 -- 18 - + (fontdata * C("SUBDROP") * number * rest) / set_1 -- 19 - + (fontdata * C("DELIM") * number * number * rest) / set_2 -- 20 21 - + (fontdata * C("AXISHEIGHT") * number * rest) / set_1 -- 22 - ) - - local parser = ( P("StartFontMetrics") / start ) - * ( p_charmetrics + p_kernpairs + p_parameters + (1-P("EndFontMetrics")) )^0 - * ( P("EndFontMetrics") / stop ) - - readafm = function(filename) - local ok, afmblob, size = resolvers.loadbinfile(filename) -- has logging - if ok and afmblob then - local data = { - resources = { - filename = resolvers.unresolve(filename), - version = afm.version, - creator = "context mkiv", - }, - properties = { - hasitalics = false, - }, - goodies = { - }, - metadata = { - filename = file.removesuffix(file.basename(filename)) - }, - characters = { - -- a temporary store - }, - descriptions = { - -- the final store - }, - } - if trace_loading then - report_afm("parsing afm file %a",filename) - end - lpegmatch(parser,afmblob,1,data) - return data - else - if trace_loading then - report_afm("no valid afm file %a",filename) - end - return nil - end - end - -end - ---[[ldx-- <p>We cache files. Caching is taken care of in the loader. We cheat a bit by adding ligatures and kern information to the afm derived data. That way we can set them faster when defining a font.</p> @@ -477,16 +126,8 @@ function afm.load(filename) end if not data or data.size ~= size or data.time ~= time or data.pfbsize ~= pfbsize or data.pfbtime ~= pfbtime then report_afm("reading %a",filename) - data = readafm(filename) + data = afm.readers.loadfont(filename,pfbname) if data then - if pfbname ~= "" then - data.resources.filename = resolvers.unresolve(pfbname) - get_indexes(data,pfbname) - elseif trace_loading then - report_afm("no pfb file for %a",filename) - -- data.resources.filename = "unset" -- better than loading the afm file - end - -- we now have all the data loaded applyenhancers(data,filename) -- otfreaders.addunicodetable(data) -- only when not done yet fonts.mappings.addtounicode(data,filename) diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua b/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua new file mode 100644 index 00000000000..2699f25bbfd --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua @@ -0,0 +1,405 @@ +if not modules then modules = { } end modules ['font-onr'] = { + version = 1.001, + comment = "companion to font-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +--[[ldx-- +<p>Some code may look a bit obscure but this has to do with the fact that we also use +this code for testing and much code evolved in the transition from <l n='tfm'/> to +<l n='afm'/> to <l n='otf'/>.</p> + +<p>The following code still has traces of intermediate font support where we handles +font encodings. Eventually font encoding went away but we kept some code around in +other modules.</p> + +<p>This version implements a node mode approach so that users can also more easily +add features.</p> +--ldx]]-- + +local fonts, logs, trackers, resolvers = fonts, logs, trackers, resolvers + +local next, type, tonumber, rawget = next, type, tonumber, rawget +local match, lower, gsub, strip, find = string.match, string.lower, string.gsub, string.strip, string.find +local char, byte, sub = string.char, string.byte, string.sub +local abs = math.abs +local bxor, rshift = bit32.bxor, bit32.rshift +local P, S, R, Cmt, C, Ct, Cs, Carg = lpeg.P, lpeg.S, lpeg.R, lpeg.Cmt, lpeg.C, lpeg.Ct, lpeg.Cs, lpeg.Carg +local lpegmatch, patterns = lpeg.match, lpeg.patterns + +local trace_indexing = false trackers.register("afm.indexing", function(v) trace_indexing = v end) +local trace_loading = false trackers.register("afm.loading", function(v) trace_loading = v end) + +local report_afm = logs.reporter("fonts","afm loading") + +fonts = fonts or { } +local handlers = fonts.handlers or { } +fonts.handlers = handlers +local afm = handlers.afm or { } +handlers.afm = afm +local readers = afm.readers or { } +afm.readers = readers + +afm.version = 1.512 -- incrementing this number one up will force a re-cache + +--[[ldx-- +<p>We start with the basic reader which we give a name similar to the built in <l n='tfm'/> +and <l n='otf'/> reader.</p> +<p>We use a new (unfinished) pfb loader but I see no differences between the old +and new vectors (we actually had one bad vector with the old loader).</p> +--ldx]]-- + +local get_indexes + +do + + local n, m + + local progress = function(str,position,name,size) + local forward = position + tonumber(size) + 3 + 2 + n = n + 1 + if n >= m then + return #str, name + elseif forward < #str then + return forward, name + else + return #str, name + end + end + + local initialize = function(str,position,size) + n = 0 + m = tonumber(size) + return position + 1 + end + + local charstrings = P("/CharStrings") + local name = P("/") * C((R("az")+R("AZ")+R("09")+S("-_."))^1) + local size = C(R("09")^1) + local spaces = P(" ")^1 + + local p_filternames = Ct ( + (1-charstrings)^0 * charstrings * spaces * Cmt(size,initialize) + * (Cmt(name * P(" ")^1 * C(R("09")^1), progress) + P(1))^1 + ) + + -- if one of first 4 not 0-9A-F then binary else hex + + local decrypt + + do + + local r, c1, c2, n = 0, 0, 0, 0 + + local function step(c) + local cipher = byte(c) + local plain = bxor(cipher,rshift(r,8)) + r = ((cipher + r) * c1 + c2) % 65536 + return char(plain) + end + + decrypt = function(binary) + r, c1, c2, n = 55665, 52845, 22719, 4 + binary = gsub(binary,".",step) + return sub(binary,n+1) + end + + -- local pattern = Cs((P(1) / step)^1) + -- + -- decrypt = function(binary) + -- r, c1, c2, n = 55665, 52845, 22719, 4 + -- binary = lpegmatch(pattern,binary) + -- return sub(binary,n+1) + -- end + + end + + local function loadpfbvector(filename) + -- for the moment limited to encoding only + + local data = io.loaddata(resolvers.findfile(filename)) + + if not data then + print("no data",filename) + return + end + + if not find(data,"!PS%-AdobeFont%-") then + print("no font",filename) + return + end + + local ascii, binary = match(data,"(.*)eexec%s+......(.*)") + + if not binary then + print("no binary",filename) + return + end + + binary = decrypt(binary,4) + + local vector = lpegmatch(p_filternames,binary) + + if vector[1] == ".notdef" then + -- tricky + vector[0] = table.remove(vector,1) + end + + if not vector then + print("no vector",filename) + return + end + + return vector + + end + + get_indexes = function(data,pfbname) + local vector = loadpfbvector(pfbname) + if vector then + local characters = data.characters + if trace_loading then + report_afm("getting index data from %a",pfbname) + end + for index=1,#vector do + local name = vector[index] + local char = characters[name] + if char then + if trace_indexing then + report_afm("glyph %a has index %a",name,index) + end + char.index = index + end + end + end + end + +end + +--[[ldx-- +<p>We start with the basic reader which we give a name similar to the built in <l n='tfm'/> +and <l n='otf'/> reader. We only need data that is relevant for our use. We don't support +more complex arrangements like multiple master (obsolete), direction specific kerning, etc.</p> +--ldx]]-- + +local spacing = patterns.whitespace +local lineend = patterns.newline +local number = spacing * S("+-")^-1 * (R("09") + S("."))^1 / tonumber +local name = spacing * C((1-spacing)^1) +local words = spacing * (1 - lineend)^1 / strip +local rest = (1 - lineend)^0 +local fontdata = Carg(1) +local semicolon = spacing * P(";") +local plus = P("plus") * number +local minus = P("minus") * number + +-- kern pairs + +local function addkernpair(data,one,two,value) + local chr = data.characters[one] + if chr then + local kerns = chr.kerns + if kerns then + kerns[two] = tonumber(value) + else + chr.kerns = { [two] = tonumber(value) } + end + end +end + +local p_kernpair = (fontdata * P("KPX") * name * name * number) / addkernpair + +-- char metrics + +local chr = false +local ind = 0 + +local function start(data,version) + data.metadata.afmversion = version + ind = 0 + chr = { } +end + +local function stop() + ind = 0 + chr = false +end + +local function setindex(i) + if i < 0 then + ind = ind + 1 -- ? + else + ind = i + end + chr = { + index = ind + } +end + +local function setwidth(width) + chr.width = width +end + +local function setname(data,name) + data.characters[name] = chr +end + +local function setboundingbox(boundingbox) + chr.boundingbox = boundingbox +end + +local function setligature(plus,becomes) + local ligatures = chr.ligatures + if ligatures then + ligatures[plus] = becomes + else + chr.ligatures = { [plus] = becomes } + end +end + +local p_charmetric = ( ( + P("C") * number / setindex + + P("WX") * number / setwidth + + P("N") * fontdata * name / setname + + P("B") * Ct((number)^4) / setboundingbox + + P("L") * (name)^2 / setligature + ) * semicolon )^1 + +local p_charmetrics = P("StartCharMetrics") * number * (p_charmetric + (1-P("EndCharMetrics")))^0 * P("EndCharMetrics") +local p_kernpairs = P("StartKernPairs") * number * (p_kernpair + (1-P("EndKernPairs" )))^0 * P("EndKernPairs" ) + +local function set_1(data,key,a) data.metadata[lower(key)] = a end +local function set_2(data,key,a,b) data.metadata[lower(key)] = { a, b } end +local function set_3(data,key,a,b,c) data.metadata[lower(key)] = { a, b, c } end + +-- Notice string +-- EncodingScheme string +-- MappingScheme integer +-- EscChar integer +-- CharacterSet string +-- Characters integer +-- IsBaseFont boolean +-- VVector number number +-- IsFixedV boolean + +local p_parameters = P(false) + + fontdata + * ((P("FontName") + P("FullName") + P("FamilyName"))/lower) + * words / function(data,key,value) + data.metadata[key] = value + end + + fontdata + * ((P("Weight") + P("Version"))/lower) + * name / function(data,key,value) + data.metadata[key] = value + end + + fontdata + * P("IsFixedPitch") + * name / function(data,pitch) + data.metadata.monospaced = toboolean(pitch,true) + end + + fontdata + * P("FontBBox") + * Ct(number^4) / function(data,boundingbox) + data.metadata.boundingbox = boundingbox + end + + fontdata + * ((P("CharWidth") + P("CapHeight") + P("XHeight") + P("Descender") + P("Ascender") + P("ItalicAngle"))/lower) + * number / function(data,key,value) + data.metadata[key] = value + end + + P("Comment") * spacing * ( P(false) + + (fontdata * C("DESIGNSIZE") * number * rest) / set_1 -- 1 + + (fontdata * C("TFM designsize") * number * rest) / set_1 + + (fontdata * C("DesignSize") * number * rest) / set_1 + + (fontdata * C("CODINGSCHEME") * words * rest) / set_1 -- + + (fontdata * C("CHECKSUM") * number * words * rest) / set_1 -- 2 + + (fontdata * C("SPACE") * number * plus * minus * rest) / set_3 -- 3 4 5 + + (fontdata * C("QUAD") * number * rest) / set_1 -- 6 + + (fontdata * C("EXTRASPACE") * number * rest) / set_1 -- 7 + + (fontdata * C("NUM") * number * number * number * rest) / set_3 -- 8 9 10 + + (fontdata * C("DENOM") * number * number * rest) / set_2 -- 11 12 + + (fontdata * C("SUP") * number * number * number * rest) / set_3 -- 13 14 15 + + (fontdata * C("SUB") * number * number * rest) / set_2 -- 16 17 + + (fontdata * C("SUPDROP") * number * rest) / set_1 -- 18 + + (fontdata * C("SUBDROP") * number * rest) / set_1 -- 19 + + (fontdata * C("DELIM") * number * number * rest) / set_2 -- 20 21 + + (fontdata * C("AXISHEIGHT") * number * rest) / set_1 -- 22 + ) + +local fullparser = ( P("StartFontMetrics") * fontdata * name / start ) + * ( p_charmetrics + p_kernpairs + p_parameters + (1-P("EndFontMetrics")) )^0 + * ( P("EndFontMetrics") / stop ) + +local infoparser = ( P("StartFontMetrics") * fontdata * name / start ) + * ( p_parameters + (1-P("EndFontMetrics")) )^0 + * ( P("EndFontMetrics") / stop ) + +-- infoparser = ( P("StartFontMetrics") * fontdata * name / start ) +-- * ( p_parameters + (1-P("EndFontMetrics") - P("StartCharMetrics")) )^0 +-- * ( (P("EndFontMetrics") + P("StartCharMetrics")) / stop ) + +local function read(filename,parser) + local afmblob = io.loaddata(filename) + if afmblob then + local data = { + resources = { + filename = resolvers.unresolve(filename), + version = afm.version, + creator = "context mkiv", + }, + properties = { + hasitalics = false, + }, + goodies = { + }, + metadata = { + filename = file.removesuffix(file.basename(filename)) + }, + characters = { + -- a temporary store + }, + descriptions = { + -- the final store + }, + } + if trace_loading then + report_afm("parsing afm file %a",filename) + end + lpegmatch(parser,afmblob,1,data) + return data + else + if trace_loading then + report_afm("no valid afm file %a",filename) + end + return nil + end +end + +function readers.loadfont(afmname,pfbname) + local data = read(resolvers.findfile(afmname),fullparser) + if data then + if not pfbname or pfbname == "" then + pfbname = file.replacesuffix(file.nameonly(afmname),"pfb") + pfbname = resolvers.findfile(pfbname) + end + if pfbname and pfbname ~= "" then + data.resources.filename = resolvers.unresolve(pfbname) + get_indexes(data,pfbname) + elseif trace_loading then + report_afm("no pfb file for %a",afmname) + -- data.resources.filename = "unset" -- better than loading the afm file + end + return data + end +end + +function readers.getinfo(filename) + local data = read(resolvers.findfile(filename),infoparser) + if data then + return data.metadata + end +end + diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua b/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua index f27995212bb..ef0d44a843e 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua @@ -308,106 +308,107 @@ end but to keep the overview, we define them here.</p> --ldx]]-- +filters.afm = fonts.handlers.afm.readers.getinfo filters.otf = fonts.handlers.otf.readers.getinfo filters.ttf = filters.otf filters.ttc = filters.otf -------.ttx = filters.otf -local function normalize(t) -- only for afm parsing - local boundingbox = t.fontbbox - if boundingbox then - for i=1,#boundingbox do - boundingbox[i] = tonumber(boundingbox[i]) - end - else - boundingbox = { 0, 0, 0, 0 } - end - return { - copyright = t.copyright, - fontname = t.fontname, - fullname = t.fullname, - familyname = t.familyname, - weight = t.weight, - widtht = t.width, - italicangle = tonumber(t.italicangle) or 0, - monospaced = toboolean(t.isfixedpitch) or false, - boundingbox = boundingbox, - version = t.version, -- not used - capheight = tonumber(t.capheight), - xheight = tonumber(t.xheight), - ascender = tonumber(t.ascender), - descender = tonumber(t.descender), - } -end - -local p_spaces = lpegpatterns.whitespace -local p_number = (R("09")+S(".-+"))^1 / tonumber -local p_boolean = P("false") * Cc(false) - + P("false") * Cc(false) -local p_string = P("(") * C((lpegpatterns.nestedparents + 1 - P(")"))^1) * P(")") -local p_array = P("[") * Ct((p_number + p_boolean + p_string + p_spaces^1)^1) * P("]") - + P("{") * Ct((p_number + p_boolean + p_string + p_spaces^1)^1) * P("}") - -local p_key = P("/") * C(R("AZ","az")^1) -local p_value = p_string - + p_number - + p_boolean - + p_array - -local p_entry = p_key * p_spaces^0 * p_value - -function filters.afm(name) - -- we could parse the afm file as well, and then report an error but - -- it's not worth the trouble - local pfbname = findfile(removesuffix(name)..".pfb","pfb") or "" - if pfbname == "" then - pfbname = findfile(nameonly(name)..".pfb","pfb") or "" - end - if pfbname ~= "" then - local f = io.open(name) - if f then - local hash = { } - local okay = false - for line in f:lines() do -- slow but only a few lines at the beginning - if find(line,"StartCharMetrics",1,true) then - break - else - local key, value = match(line,"^(.+)%s+(.+)%s*$") - if key and #key > 0 then - hash[lower(key)] = value - end - end - end - f:close() - return normalize(hash) - end - end - return nil, "no matching pfb file" -end +-- local function normalize(t) -- only for afm parsing +-- local boundingbox = t.boundingbox or t.fontbbox +-- if boundingbox then +-- for i=1,#boundingbox do +-- boundingbox[i] = tonumber(boundingbox[i]) +-- end +-- else +-- boundingbox = { 0, 0, 0, 0 } +-- end +-- return { +-- copyright = t.copyright, +-- fontname = t.fontname, +-- fullname = t.fullname, +-- familyname = t.familyname, +-- weight = t.weight, +-- widtht = t.width, +-- italicangle = tonumber(t.italicangle) or 0, +-- monospaced = t.monospaced or toboolean(t.isfixedpitch) or false, +-- boundingbox = boundingbox, +-- version = t.version, -- not used +-- capheight = tonumber(t.capheight), +-- xheight = tonumber(t.xheight), +-- ascender = tonumber(t.ascender), +-- descender = tonumber(t.descender), +-- } +-- end +-- +-- function filters.afm(name) +-- -- we could parse the afm file as well, and then report an error but +-- -- it's not worth the trouble +-- local pfbname = findfile(removesuffix(name)..".pfb","pfb") or "" +-- if pfbname == "" then +-- pfbname = findfile(nameonly(name)..".pfb","pfb") or "" +-- end +-- if pfbname ~= "" then +-- local f = io.open(name) +-- if f then +-- local hash = { } +-- local okay = false +-- for line in f:lines() do -- slow but only a few lines at the beginning +-- if find(line,"StartCharMetrics",1,true) then +-- break +-- else +-- local key, value = match(line,"^(.+)%s+(.+)%s*$") +-- if key and #key > 0 then +-- hash[lower(key)] = value +-- end +-- end +-- end +-- f:close() +-- return normalize(hash) +-- end +-- end +-- return nil, "no matching pfb file" +-- end -function filters.pfb(name) - local f = io.open(name) - if f then - local hash = { } - local okay = false - for line in f:lines() do -- slow but only a few lines at the beginning - if find(line,"dict begin") then - okay = true - elseif not okay then - -- go on - elseif find(line,"currentdict end") then - break - else - local key, value = lpegmatch(p_entry,line) - if key and value then - hash[lower(key)] = value - end - end - end - f:close() - return normalize(hash) - end -end +-- local p_spaces = lpegpatterns.whitespace +-- local p_number = (R("09")+S(".-+"))^1 / tonumber +-- local p_boolean = P("false") * Cc(false) +-- + P("false") * Cc(false) +-- local p_string = P("(") * C((lpegpatterns.nestedparents + 1 - P(")"))^1) * P(")") +-- local p_array = P("[") * Ct((p_number + p_boolean + p_string + p_spaces^1)^1) * P("]") +-- + P("{") * Ct((p_number + p_boolean + p_string + p_spaces^1)^1) * P("}") +-- +-- local p_key = P("/") * C(R("AZ","az")^1) +-- local p_value = p_string +-- + p_number +-- + p_boolean +-- + p_array +-- +-- local p_entry = p_key * p_spaces^0 * p_value +-- +-- function filters.pfb(name) +-- local f = io.open(name) +-- if f then +-- local hash = { } +-- local okay = false +-- for line in f:lines() do -- slow but only a few lines at the beginning +-- if find(line,"dict begin") then +-- okay = true +-- elseif not okay then +-- -- go on +-- elseif find(line,"currentdict end") then +-- break +-- else +-- local key, value = lpegmatch(p_entry,line) +-- if key and value then +-- hash[lower(key)] = value +-- end +-- end +-- end +-- f:close() +-- return normalize(hash) +-- end +-- end --[[ldx-- <p>The scanner loops over the filters using the information stored in diff --git a/Master/texmf-dist/tex/context/base/mkiv/grph-rul.lua b/Master/texmf-dist/tex/context/base/mkiv/grph-rul.lua index 5d3cb8ad5d1..e5aa053963d 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/grph-rul.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/grph-rul.lua @@ -23,6 +23,10 @@ local a_colorspace = attributes.private('colormodel') local mpcolor = attributes.colors.mpcolor +local trace_mp = false trackers.register("rules.mp", function(v) trace_mp = v end) + +local report_mp = logs.reporter("rules","mp") + local floor = math.floor local random = math.random @@ -65,6 +69,7 @@ FakeWord(%width%,%height%,%depth%,%line%,%color%); FakeRule(%width%,%height%,%depth%,%line%,%color%); ]], ["fake:rest"] = replacer [[ +RuleOption := "%option%" ; RuleWidth := %width% ; RuleHeight := %height% ; RuleDepth := %depth% ; @@ -87,8 +92,12 @@ def RuleColor = %color% enddef ; offset = p.offset or 0, line = (p.line or 65536) * bpfactor, color = mpcolor(p.ma,p.ca,p.ta), + option = p.option or "", } local m = cache[code] + if trace_mp then + report_mp(m) + end if m and m ~= "" then pdfprint("direct",m) end diff --git a/Master/texmf-dist/tex/context/base/mkiv/node-met.lua b/Master/texmf-dist/tex/context/base/mkiv/node-met.lua index 272b1d1769a..432ecd1ec94 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/node-met.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/node-met.lua @@ -91,6 +91,7 @@ nodes.slide = node.slide nodes.vpack = node.vpack nodes.fields = node.fields nodes.is_node = node.is_node +nodes.setglue = node.setglue nodes.first_glyph = node.first_glyph nodes.has_glyph = node.has_glyph or node.first_glyph diff --git a/Master/texmf-dist/tex/context/base/mkiv/node-rul.lua b/Master/texmf-dist/tex/context/base/mkiv/node-rul.lua index 5ac43ea4ac9..a1ac67657a6 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/node-rul.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/node-rul.lua @@ -490,6 +490,15 @@ function nodes.shifts.enable() tasks.enableaction("shipouts","nodes.shifts.handler") end +-- linefillers (placeholder) + +nodes.linefillers = nodes.linefillers or { } +nodes.linefillers.data = nodes.linefillers.data or { } + +function nodes.linefillers.handler(head) + return head, false +end + -- interface local implement = interfaces.implement diff --git a/Master/texmf-dist/tex/context/base/mkiv/node-rul.mkiv b/Master/texmf-dist/tex/context/base/mkiv/node-rul.mkiv index 8706b8ecf39..8c7f1d08bd4 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/node-rul.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/node-rul.mkiv @@ -348,8 +348,8 @@ \clf_defineshift continue {\shiftparameter\c!continue}% unit {\shiftparameter\c!unit}% - method \shiftparameter\c!method - dy \shiftparameter\c!dy % number + method \shiftparameter\c!method + dy \shiftparameter\c!dy % number \relax}} \unexpanded\def\node_shifts_redefine#1% @@ -366,6 +366,7 @@ {\def\currentshift{#1}% \expandafter\let\expandafter\c_node_shifts_index\csname\??shiftindex#1\endcsname \advance\c_node_shifts_index\plusone + \clf_enableshifts % will be relaxed \attribute\shiftedattribute\numexpr \plusthousand*\c_node_shifts_index +\csname\??shiftattribute#1\ifcsname\??shift#1:\number\c_node_shifts_index\s!parent\endcsname:\number\c_node_shifts_index\fi\endcsname diff --git a/Master/texmf-dist/tex/context/base/mkiv/spac-hor.mkiv b/Master/texmf-dist/tex/context/base/mkiv/spac-hor.mkiv index 19f2f53b3f8..08e5f6343e8 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/spac-hor.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/spac-hor.mkiv @@ -631,7 +631,7 @@ \newskip\s_spac_narrower_left \newskip\s_spac_narrower_right -\newskip\s_spac_narrower_mid +\newskip\s_spac_narrower_middle \installcommandhandler \??narrower {narrower} \??narrower @@ -655,21 +655,21 @@ {\ifcsname\??narrowermethod#1\endcsname \lastnamedcs \else - \global\advance\s_spac_narrower_mid#1\relax + \global\advance\s_spac_narrower_middle#1\relax \fi} \def\spac_narrower_initialize[#1]% hm, can be dorepeat directly {\dorepeatwithcommand[#1]\spac_narrower_method_analyze} -\installnarrowermethod \v!left {\global\advance\s_spac_narrower_left \narrowerparameter\c!left \relax} -\installnarrowermethod \v!middle {\global\advance\s_spac_narrower_mid \narrowerparameter\c!middle\relax} -\installnarrowermethod \v!right {\global\advance\s_spac_narrower_right \narrowerparameter\c!right \relax} -\installnarrowermethod{-\v!left }{\global\advance\s_spac_narrower_left -\narrowerparameter\c!left \relax} -\installnarrowermethod{-\v!middle}{\global\advance\s_spac_narrower_mid -\narrowerparameter\c!middle\relax} -\installnarrowermethod{-\v!right }{\global\advance\s_spac_narrower_right-\narrowerparameter\c!right \relax} -\installnarrowermethod \v!reset {\global \s_spac_narrower_left \zeropoint - \global \s_spac_narrower_mid \zeropoint - \global \s_spac_narrower_right \zeropoint\relax} +\installnarrowermethod \v!left {\global\advance\s_spac_narrower_left \narrowerparameter\c!left \relax} +\installnarrowermethod \v!middle {\global\advance\s_spac_narrower_middle \narrowerparameter\c!middle\relax} +\installnarrowermethod \v!right {\global\advance\s_spac_narrower_right \narrowerparameter\c!right \relax} +\installnarrowermethod{-\v!left }{\global\advance\s_spac_narrower_left -\narrowerparameter\c!left \relax} +\installnarrowermethod{-\v!middle}{\global\advance\s_spac_narrower_middle-\narrowerparameter\c!middle\relax} +\installnarrowermethod{-\v!right }{\global\advance\s_spac_narrower_right -\narrowerparameter\c!right \relax} +\installnarrowermethod \v!reset {\global \s_spac_narrower_left \zeropoint + \global \s_spac_narrower_middle \zeropoint + \global \s_spac_narrower_right \zeropoint\relax} \installnarrowermethod \v!none {} \unexpanded\def\spac_narrower_start#1% @@ -686,12 +686,12 @@ \def\spac_narrower_start_apply#1% {\narrowerparameter\c!before - \global\s_spac_narrower_left \zeropoint - \global\s_spac_narrower_right\zeropoint - \global\s_spac_narrower_mid \zeropoint + \global\s_spac_narrower_left \zeropoint + \global\s_spac_narrower_right \zeropoint + \global\s_spac_narrower_middle\zeropoint \processcommalistwithparameters[#1]\spac_narrower_initialize - \advance\leftskip \dimexpr\s_spac_narrower_left +\s_spac_narrower_mid\relax - \advance\rightskip\dimexpr\s_spac_narrower_right+\s_spac_narrower_mid\relax + \advance\leftskip \dimexpr\s_spac_narrower_left +\s_spac_narrower_middle\relax + \advance\rightskip\dimexpr\s_spac_narrower_right+\s_spac_narrower_middle\relax \seteffectivehsize} \unexpanded\def\spac_narrower_stop diff --git a/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf b/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf Binary files differindex 50c9c743acf..c0eaf445aca 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf +++ b/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf diff --git a/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf b/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf Binary files differindex c59d3c52fd2..c4c0c12ace9 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf +++ b/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf diff --git a/Master/texmf-dist/tex/context/base/mkiv/task-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/task-ini.lua index eaf342234de..696a3b4a95e 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/task-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/task-ini.lua @@ -117,6 +117,7 @@ appendaction("finalizers", "lists", "builders.paragraphs.keeptogether") ------------("finalizers", "lists", "nodes.handlers.graphicvadjust") -- todo appendaction("finalizers", "fonts", "builders.paragraphs.solutions.splitters.optimize") -- experimental appendaction("finalizers", "lists", "builders.paragraphs.tag") +appendaction("finalizers", "lists", "nodes.linefillers.handler") -- still experimental @@ -191,6 +192,7 @@ disableaction("finalizers", "builders.paragraphs.keeptogether") disableaction("finalizers", "builders.paragraphs.solutions.splitters.optimize") -------------("finalizers", "nodes.handlers.graphicvadjust") -- sort of obsolete disableaction("finalizers", "builders.paragraphs.tag") +disableaction("finalizers", "nodes.linefillers.handler") disableaction("math", "noads.handlers.showtree") disableaction("math", "noads.handlers.tags") diff --git a/Master/texmf-dist/tex/context/base/mkiv/typo-lin.lua b/Master/texmf-dist/tex/context/base/mkiv/typo-lin.lua index 5fc26a3547b..a74a635f679 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/typo-lin.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/typo-lin.lua @@ -372,21 +372,21 @@ function paragraphs.moveinline(n,blob,dx,dy) end end -local f_anchor = formatters["_plib_.set('md:h',%i,{x=true,c=true})"] -local s_anchor = 'md:h' +-- local f_anchor = formatters["_plib_.set('md:h',%i,{x=true,c=true})"] +-- local s_anchor = 'md:h' +-- +-- local function setanchor(h_anchor) +-- return new_latelua(f_anchor(h_anchor)) +-- end + +local lateluafunction = nodepool.lateluafunction +local setposition = job.positions.set +local t_anchor = { x = true, c = true } local function setanchor(h_anchor) - return new_latelua(f_anchor(h_anchor)) + return lateluafunction(function() setposition("md:h",h_anchor,t_anchor) end) end --- local lateluafunction = nodepool.lateluafunction --- local setposition = job.positions.set --- local t_anchor = { x = true, c = true } - --- local function setanchor(h_anchor) --- return lateluafunction(function() setposition("md:h",h_anchor,t_anchor) end) --- end - function paragraphs.calculatedelta(n,width,delta,atleft,islocal,followshape,area) local line = type(n) ~= "table" and getprop(n,"line") or n if not line then diff --git a/Master/texmf-dist/tex/context/interface/mkiv/i-context.pdf b/Master/texmf-dist/tex/context/interface/mkiv/i-context.pdf Binary files differindex 890c34fa73e..47cde86b1e3 100644 --- a/Master/texmf-dist/tex/context/interface/mkiv/i-context.pdf +++ b/Master/texmf-dist/tex/context/interface/mkiv/i-context.pdf diff --git a/Master/texmf-dist/tex/context/interface/mkiv/i-context.xml b/Master/texmf-dist/tex/context/interface/mkiv/i-context.xml index 606950c10bb..f1e85658f3a 100644 --- a/Master/texmf-dist/tex/context/interface/mkiv/i-context.xml +++ b/Master/texmf-dist/tex/context/interface/mkiv/i-context.xml @@ -2,6 +2,26 @@ <?context-directive job ctxfile x-setups.ctx ?> +<!-- + + Right from the start the ConTeXt user interface was sytematic enough to be described using a + common framework. First it was done in the TeX language at the top of the files where features + were implemented. Later we switched to XML where all definitions were moved to one file. That + file could be translated to different user interfaces. + + The current XML files are a follow up on this. Instead of one big file we now have many small + files, and support for shared (XML) definitions has been extended. Many more commands are defined, + including those considered low level. There are no longer translated files needed but you can + still generate them. + + These files can be used to generate overviews (see x-setups-*.mkiv) but also for generating + information for text editors. We also use them for the (local) help service. + + Wolfgang Schuster & Hans Hagen + +--> + + <cd:interface xmlns:cd="http://www.pragma-ade.com/commands"> <cd:interfacefile filename="i-common-definitions.xml"/> diff --git a/Master/texmf-dist/tex/context/interface/mkiv/i-readme.pdf b/Master/texmf-dist/tex/context/interface/mkiv/i-readme.pdf Binary files differindex f75f051baa6..4300c8f1cf7 100644 --- a/Master/texmf-dist/tex/context/interface/mkiv/i-readme.pdf +++ b/Master/texmf-dist/tex/context/interface/mkiv/i-readme.pdf diff --git a/Master/texmf-dist/tex/context/modules/mkiv/x-setups-basics.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/x-setups-basics.mkiv index 283067fcb73..fd6998013c5 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/x-setups-basics.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/x-setups-basics.mkiv @@ -444,7 +444,7 @@ \nohyphens \veryraggedright \global\c_cmd_current_argument\zerocount - \global\c_cmd_maximum_argument\xmlfilter{#1}{/arguments/*/s_count()}\relax + \global\c_cmd_maximum_argument0\xmlfilter{#1}{/arguments/*/s_count()}\relax \xmlsetup{#1}{xml:setups:make:prepare} \ttbf \directsetup{xml:setups:make:start} diff --git a/Master/texmf-dist/tex/context/modules/mkiv/x-setups-overview.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/x-setups-overview.mkiv index a0d0aa1b8aa..8cfe14439d9 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/x-setups-overview.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/x-setups-overview.mkiv @@ -12,6 +12,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% context --interface=en --global --result=setup-en x-setups-overview.mkiv + \usemodule[setups-basics] \unprotect diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua index d913e27de41..ea46d7d357a 100644 --- a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/Master/texmf-dist/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 : 05/13/16 16:21:29 +-- merge date : 05/14/16 14:06:50 do -- begin closure to overcome local limits and interference @@ -22254,46 +22254,32 @@ end -- closure do -- begin closure to overcome local limits and interference -if not modules then modules={} end modules ['font-one']={ +if not modules then modules={} end modules ['font-onr']={ version=1.001, comment="companion to font-ini.mkiv", author="Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local fonts,logs,trackers,containers,resolvers=fonts,logs,trackers,containers,resolvers +local fonts,logs,trackers,resolvers=fonts,logs,trackers,resolvers local next,type,tonumber,rawget=next,type,tonumber,rawget -local match,gmatch,lower,gsub,strip,find=string.match,string.gmatch,string.lower,string.gsub,string.strip,string.find +local match,lower,gsub,strip,find=string.match,string.lower,string.gsub,string.strip,string.find local char,byte,sub=string.char,string.byte,string.sub local abs=math.abs local bxor,rshift=bit32.bxor,bit32.rshift local P,S,R,Cmt,C,Ct,Cs,Carg=lpeg.P,lpeg.S,lpeg.R,lpeg.Cmt,lpeg.C,lpeg.Ct,lpeg.Cs,lpeg.Carg local lpegmatch,patterns=lpeg.match,lpeg.patterns -local trace_features=false trackers.register("afm.features",function(v) trace_features=v end) local trace_indexing=false trackers.register("afm.indexing",function(v) trace_indexing=v end) local trace_loading=false trackers.register("afm.loading",function(v) trace_loading=v end) -local trace_defining=false trackers.register("fonts.defining",function(v) trace_defining=v end) local report_afm=logs.reporter("fonts","afm loading") -local setmetatableindex=table.setmetatableindex -local derivetable=table.derive -local findbinfile=resolvers.findbinfile -local definers=fonts.definers -local readers=fonts.readers -local constructors=fonts.constructors -local afm=constructors.newhandler("afm") -local pfb=constructors.newhandler("pfb") -local otf=fonts.handlers.otf -local otfreaders=otf.readers -local otfenhancers=otf.enhancers -local afmfeatures=constructors.newfeatures("afm") -local registerafmfeature=afmfeatures.register -afm.version=1.510 -afm.cache=containers.define("fonts","afm",afm.version,true) -afm.autoprefixed=true -afm.helpdata={} -afm.syncspace=true -local overloads=fonts.mappings.overloads -local applyruntimefixes=fonts.treatments and fonts.treatments.applyfixes +fonts=fonts or {} +local handlers=fonts.handlers or {} +fonts.handlers=handlers +local afm=handlers.afm or {} +handlers.afm=afm +local readers=afm.readers or {} +afm.readers=readers +afm.version=1.512 local get_indexes do local n,m @@ -22337,14 +22323,14 @@ do end local function loadpfbvector(filename) local data=io.loaddata(resolvers.findfile(filename)) - if not find(data,"!PS%-AdobeFont%-") then - print("no font",filename) - return - end if not data then print("no data",filename) return end + if not find(data,"!PS%-AdobeFont%-") then + print("no font",filename) + return + end local ascii,binary=match(data,"(.*)eexec%s+......(.*)") if not binary then print("no binary",filename) @@ -22352,7 +22338,9 @@ do end binary=decrypt(binary,4) local vector=lpegmatch(p_filternames,binary) - vector[0]=table.remove(vector,1) + if vector[1]==".notdef" then + vector[0]=table.remove(vector,1) + end if not vector then print("no vector",filename) return @@ -22379,91 +22367,85 @@ do end end end -local readafm -do - local spacing=patterns.spacer - local lineend=patterns.newline - local number=spacing*(R("09")+S("."))^1/tonumber - local name=spacing*C((1-spacing)^1) - local words=spacing*(1-lineend)^1/strip - local rest=(1-lineend)^0 - local fontdata=Carg(1) - local semicolon=spacing*P(";") - local plus=P("plus")*number - local minus=P("minus")*number - local function addkernpair(data,one,two,value) - local chr=data.characters[one] - if chr then - local kerns=chr.kerns - if kerns then - kerns[two]=tonumber(value) - else - chr.kerns={ [two]=tonumber(value) } - end - end - end - local p_kernpair=(fontdata*P("KPX")*name*name*number)/addkernpair - local chr=false - local ind=0 - local function start() - ind=0 - chr={} - end - local function stop() - ind=0 - chr=false - end - local function setindex(i) - if i<0 then - ind=ind+1 +local spacing=patterns.whitespace +local lineend=patterns.newline +local number=spacing*S("+-")^-1*(R("09")+S("."))^1/tonumber +local name=spacing*C((1-spacing)^1) +local words=spacing*(1-lineend)^1/strip +local rest=(1-lineend)^0 +local fontdata=Carg(1) +local semicolon=spacing*P(";") +local plus=P("plus")*number +local minus=P("minus")*number +local function addkernpair(data,one,two,value) + local chr=data.characters[one] + if chr then + local kerns=chr.kerns + if kerns then + kerns[two]=tonumber(value) else - ind=i + chr.kerns={ [two]=tonumber(value) } end - chr={ - index=ind - } end - local function setwidth(width) - chr.width=width - end - local function setname(data,name) - data.characters[name]=chr - end - local function setboundingbox(boundingbox) - chr.boundingbox=boundingbox +end +local p_kernpair=(fontdata*P("KPX")*name*name*number)/addkernpair +local chr=false +local ind=0 +local function start(data,version) + data.metadata.afmversion=version + ind=0 + chr={} +end +local function stop() + ind=0 + chr=false +end +local function setindex(i) + if i<0 then + ind=ind+1 + else + ind=i end - local function setligature(plus,becomes) - local ligatures=chr.ligatures - if ligatures then - ligatures[plus]=becomes - else - chr.ligatures={ [plus]=becomes } - end - end - local p_charmetric=(( - P("C")*number/setindex+P("WX")*number/setwidth+P("N")*fontdata*name/setname+P("B")*Ct((number)^4)/setboundingbox+P("L")*(name)^2/setligature - )*semicolon )^1 - local p_charmetrics=P("StartCharMetrics")*number*(p_charmetric+(1-P("EndCharMetrics")))^0*P("EndCharMetrics") - local p_kernpairs=P("StartKernPairs")*number*(p_kernpair+(1-P("EndKernPairs")) )^0*P("EndKernPairs") - local function set_1(data,key,a) data.metadata[lower(key)]=a end - local function set_2(data,key,a,b) data.metadata[lower(key)]={ a,b } end - local function set_3(data,key,a,b,c) data.metadata[lower(key)]={ a,b,c } end - local p_parameters=P(false)+P("FontName")*fontdata*words/function(data,line) - data.metadata.fontname=line - data.metadata.fullname=line - end+P("ItalicAngle")*fontdata*number/function(data,angle) - data.metadata.italicangle=angle - end+P("IsFixedPitch")*fontdata*name/function(data,pitch) - data.metadata.monospaced=toboolean(pitch,true) - end+P("CharWidth")*fontdata*number/function(data,width) - data.metadata.charwidth=width - end+P("XHeight")*fontdata*number/function(data,xheight) - data.metadata.xheight=xheight - end+P("Descender")*fontdata*number/function(data,descender) - data.metadata.descender=descender - end+P("Ascender")*fontdata*number/function(data,ascender) - data.metadata.ascender=ascender - end+P("Comment")*spacing*(P(false)+(fontdata*C("DESIGNSIZE")*number*rest)/set_1 + chr={ + index=ind + } +end +local function setwidth(width) + chr.width=width +end +local function setname(data,name) + data.characters[name]=chr +end +local function setboundingbox(boundingbox) + chr.boundingbox=boundingbox +end +local function setligature(plus,becomes) + local ligatures=chr.ligatures + if ligatures then + ligatures[plus]=becomes + else + chr.ligatures={ [plus]=becomes } + end +end +local p_charmetric=(( + P("C")*number/setindex+P("WX")*number/setwidth+P("N")*fontdata*name/setname+P("B")*Ct((number)^4)/setboundingbox+P("L")*(name)^2/setligature + )*semicolon )^1 +local p_charmetrics=P("StartCharMetrics")*number*(p_charmetric+(1-P("EndCharMetrics")))^0*P("EndCharMetrics") +local p_kernpairs=P("StartKernPairs")*number*(p_kernpair+(1-P("EndKernPairs" )))^0*P("EndKernPairs" ) +local function set_1(data,key,a) data.metadata[lower(key)]=a end +local function set_2(data,key,a,b) data.metadata[lower(key)]={ a,b } end +local function set_3(data,key,a,b,c) data.metadata[lower(key)]={ a,b,c } end +local p_parameters=P(false)+fontdata*((P("FontName")+P("FullName")+P("FamilyName"))/lower)*words/function(data,key,value) + data.metadata[key]=value + end+fontdata*((P("Weight")+P("Version"))/lower)*name/function(data,key,value) + data.metadata[key]=value + end+fontdata*P("IsFixedPitch")*name/function(data,pitch) + data.metadata.monospaced=toboolean(pitch,true) + end+fontdata*P("FontBBox")*Ct(number^4)/function(data,boundingbox) + data.metadata.boundingbox=boundingbox + end+fontdata*((P("CharWidth")+P("CapHeight")+P("XHeight")+P("Descender")+P("Ascender")+P("ItalicAngle"))/lower)*number/function(data,key,value) + data.metadata[key]=value + end+P("Comment")*spacing*(P(false)+(fontdata*C("DESIGNSIZE")*number*rest)/set_1 +(fontdata*C("TFM designsize")*number*rest)/set_1+(fontdata*C("DesignSize")*number*rest)/set_1+(fontdata*C("CODINGSCHEME")*words*rest)/set_1 +(fontdata*C("CHECKSUM")*number*words*rest)/set_1 +(fontdata*C("SPACE")*number*plus*minus*rest)/set_3 @@ -22477,42 +22459,109 @@ do +(fontdata*C("SUBDROP")*number*rest)/set_1 +(fontdata*C("DELIM")*number*number*rest)/set_2 +(fontdata*C("AXISHEIGHT")*number*rest)/set_1 - ) - local parser=(P("StartFontMetrics")/start )*(p_charmetrics+p_kernpairs+p_parameters+(1-P("EndFontMetrics")) )^0*(P("EndFontMetrics")/stop ) - readafm=function(filename) - local ok,afmblob,size=resolvers.loadbinfile(filename) - if ok and afmblob then - local data={ - resources={ - filename=resolvers.unresolve(filename), - version=afm.version, - creator="context mkiv", - }, - properties={ - hasitalics=false, - }, - goodies={}, - metadata={ - filename=file.removesuffix(file.basename(filename)) - }, - characters={ - }, - descriptions={ - }, - } - if trace_loading then - report_afm("parsing afm file %a",filename) - end - lpegmatch(parser,afmblob,1,data) - return data - else - if trace_loading then - report_afm("no valid afm file %a",filename) - end - return nil + ) +local fullparser=(P("StartFontMetrics")*fontdata*name/start )*(p_charmetrics+p_kernpairs+p_parameters+(1-P("EndFontMetrics")) )^0*(P("EndFontMetrics")/stop ) +local infoparser=(P("StartFontMetrics")*fontdata*name/start )*(p_parameters+(1-P("EndFontMetrics")) )^0*(P("EndFontMetrics")/stop ) +local function read(filename,parser) + local afmblob=io.loaddata(filename) + if afmblob then + local data={ + resources={ + filename=resolvers.unresolve(filename), + version=afm.version, + creator="context mkiv", + }, + properties={ + hasitalics=false, + }, + goodies={}, + metadata={ + filename=file.removesuffix(file.basename(filename)) + }, + characters={ + }, + descriptions={ + }, + } + if trace_loading then + report_afm("parsing afm file %a",filename) + end + lpegmatch(parser,afmblob,1,data) + return data + else + if trace_loading then + report_afm("no valid afm file %a",filename) + end + return nil + end +end +function readers.loadfont(afmname,pfbname) + local data=read(resolvers.findfile(afmname),fullparser) + if data then + if not pfbname or pfbname=="" then + pfbname=file.replacesuffix(file.nameonly(afmname),"pfb") + pfbname=resolvers.findfile(pfbname) end + if pfbname and pfbname~="" then + data.resources.filename=resolvers.unresolve(pfbname) + get_indexes(data,pfbname) + elseif trace_loading then + report_afm("no pfb file for %a",afmname) + end + return data end end +function readers.getinfo(filename) + local data=read(resolvers.findfile(filename),infoparser) + if data then + return data.metadata + end +end + +end -- closure + +do -- begin closure to overcome local limits and interference + +if not modules then modules={} end modules ['font-one']={ + version=1.001, + comment="companion to font-ini.mkiv", + author="Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright="PRAGMA ADE / ConTeXt Development Team", + license="see context related readme files" +} +local fonts,logs,trackers,containers,resolvers=fonts,logs,trackers,containers,resolvers +local next,type,tonumber,rawget=next,type,tonumber,rawget +local match,gmatch,lower,gsub,strip,find=string.match,string.gmatch,string.lower,string.gsub,string.strip,string.find +local char,byte,sub=string.char,string.byte,string.sub +local abs=math.abs +local bxor,rshift=bit32.bxor,bit32.rshift +local P,S,R,Cmt,C,Ct,Cs,Carg=lpeg.P,lpeg.S,lpeg.R,lpeg.Cmt,lpeg.C,lpeg.Ct,lpeg.Cs,lpeg.Carg +local lpegmatch,patterns=lpeg.match,lpeg.patterns +local trace_features=false trackers.register("afm.features",function(v) trace_features=v end) +local trace_indexing=false trackers.register("afm.indexing",function(v) trace_indexing=v end) +local trace_loading=false trackers.register("afm.loading",function(v) trace_loading=v end) +local trace_defining=false trackers.register("fonts.defining",function(v) trace_defining=v end) +local report_afm=logs.reporter("fonts","afm loading") +local setmetatableindex=table.setmetatableindex +local derivetable=table.derive +local findbinfile=resolvers.findbinfile +local definers=fonts.definers +local readers=fonts.readers +local constructors=fonts.constructors +local afm=constructors.newhandler("afm") +local pfb=constructors.newhandler("pfb") +local otf=fonts.handlers.otf +local otfreaders=otf.readers +local otfenhancers=otf.enhancers +local afmfeatures=constructors.newfeatures("afm") +local registerafmfeature=afmfeatures.register +afm.version=1.512 +afm.cache=containers.define("fonts","afm",afm.version,true) +afm.autoprefixed=true +afm.helpdata={} +afm.syncspace=true +local overloads=fonts.mappings.overloads +local applyruntimefixes=fonts.treatments and fonts.treatments.applyfixes local enhancers={ } local steps={ @@ -22556,14 +22605,8 @@ function afm.load(filename) end if not data or data.size~=size or data.time~=time or data.pfbsize~=pfbsize or data.pfbtime~=pfbtime then report_afm("reading %a",filename) - data=readafm(filename) + data=afm.readers.loadfont(filename,pfbname) if data then - if pfbname~="" then - data.resources.filename=resolvers.unresolve(pfbname) - get_indexes(data,pfbname) - elseif trace_loading then - report_afm("no pfb file for %a",filename) - end applyenhancers(data,filename) fonts.mappings.addtounicode(data,filename) otfreaders.pack(data) diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts.lua index 1d2f2037fea..c493844c85b 100644 --- a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts.lua +++ b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts.lua @@ -260,6 +260,7 @@ if non_generic_context.luatex_fonts.skip_loading ~= true then -- type one code + loadmodule('font-onr.lua') -- was font-afm.lua loadmodule('font-one.lua') -- was font-afm.lua loadmodule('font-afk.lua') |