diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-04-21 10:40:49 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-04-21 10:40:49 +0200 |
commit | 595681ed25471f1206e4942adbf0abd664fa7e11 (patch) | |
tree | b0e2a8e390dea023af96a3e5e5c056b7d9f34023 /tex | |
parent | 0bc04866afcb280678aec47daed0716a2a4d17c7 (diff) | |
download | context-595681ed25471f1206e4942adbf0abd664fa7e11.tar.gz |
2016-04-21 10:14:00
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4248 -> 4248 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/context-help.lmx | 6 | ||||
-rw-r--r-- | tex/context/base/mkiv/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-afm.lua | 224 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-otr.lua | 7 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-oup.lua | 14 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-tfm.lua | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/status-files.pdf | bin | 9243 -> 9120 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/status-lua.pdf | bin | 267891 -> 267917 bytes | |||
-rw-r--r-- | tex/context/interface/mkiv/i-context.pdf | bin | 797157 -> 795943 bytes | |||
-rw-r--r-- | tex/context/interface/mkiv/i-makeup.xml | 15 | ||||
-rw-r--r-- | tex/context/interface/mkiv/i-readme.pdf | bin | 60792 -> 60791 bytes | |||
-rw-r--r-- | tex/context/modules/mkiv/x-setups-basics.mkiv | 236 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-basics-gen.lua | 6 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 192 |
16 files changed, 487 insertions, 219 deletions
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex fcb81e92d..f9398bdd2 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 124e4fd6d..d92cddf4b 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{2016.04.19 17:16} +\newcontextversion{2016.04.21 10:10} %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-help.lmx b/tex/context/base/mkiv/context-help.lmx index 962cd3c32..7c8f5006d 100644 --- a/tex/context/base/mkiv/context-help.lmx +++ b/tex/context/base/mkiv/context-help.lmx @@ -72,9 +72,8 @@ } a.setupmenucmd { color: #FFFFFF ; - text-decoration: none ; + text-decoration: underline ; font-weight: bold ; - font-style: italic ; } a.setuplisturl { color: #000000 ; @@ -84,6 +83,9 @@ .setupmenugroup { text-decoration: none ; } + .setupinstances { + margin-top: 3ex ; + } .setupmenucategory { font-weight: bold ; font-size: 2.5ex ; diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 4fe3b2c66..b41e48c10 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2016.04.19 17:16} +\edef\contextversion{2016.04.21 10:10} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-afm.lua b/tex/context/base/mkiv/font-afm.lua index 329639b85..3dedf12e1 100644 --- a/tex/context/base/mkiv/font-afm.lua +++ b/tex/context/base/mkiv/font-afm.lua @@ -28,9 +28,11 @@ don't have this issue.</p> local fonts, logs, trackers, containers, resolvers = fonts, logs, trackers, containers, resolvers local next, type, tonumber = next, type, tonumber -local format, match, gmatch, lower, gsub, strip = string.format, string.match, string.gmatch, string.lower, string.gsub, string.strip -local abs = math.abs -local P, S, C, R, lpegmatch, patterns = lpeg.P, lpeg.S, lpeg.C, lpeg.R, lpeg.match, lpeg.patterns +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, mod = math.abs, math.mod +local bxor, rshift = bit32.bxor, bit32.rshift +local P, S, R, Cmt, C, Ct, Cs, lpegmatch, patterns = lpeg.P, lpeg.S, lpeg.R, lpeg.Cmt, lpeg.C, lpeg.Ct, lpeg.Cs, lpeg.match, lpeg.patterns local derivetable = table.derive local trace_features = false trackers.register("afm.features", function(v) trace_features = v end) @@ -48,11 +50,6 @@ local definers = fonts.definers local readers = fonts.readers local constructors = fonts.constructors -local fontloader = fontloader -local font_to_table = fontloader.to_table -local open_font = fontloader.open -local close_font = fontloader.close - local afm = constructors.newhandler("afm") local pfb = constructors.newhandler("pfb") @@ -171,7 +168,7 @@ end local function get_charmetrics(data,charmetrics,vector) local characters = data.characters local chr, ind = { }, 0 - for k,v in gmatch(charmetrics,"([%a]+) +(.-) *;") do + for k, v in gmatch(charmetrics,"([%a]+) +(.-) *;") do if k == 'C' then v = tonumber(v) if v < 0 then @@ -225,41 +222,193 @@ local function get_variables(data,fontmetrics) end end -local function get_indexes(data,pfbname) - data.resources.filename = resolvers.unresolve(pfbname) -- no shortcut - local pfbblob = open_font(pfbname) - if pfbblob then - local characters = data.characters - local pfbdata = font_to_table(pfbblob) - if pfbdata then - local glyphs = pfbdata.glyphs - if glyphs then - if trace_loading then - report_afm("getting index data from %a",pfbname) - end - for index, glyph in next, glyphs do - -- for index, glyph in table.sortedhash(glyphs) do - local name = glyph.name - if name then - local char = characters[name] - if char then - if trace_indexing then - report_afm("glyph %a has index %a",name,index) +local get_indexes + +do + + -- old font loader + + local fontloader = fontloader + + if fontloader then + + local font_to_table = fontloader.to_table + local open_font = fontloader.open + local close_font = fontloader.close + + local function get_indexes_old(data,pfbname) + local pfbblob = open_font(pfbname) + if pfbblob then + local characters = data.characters + local pfbdata = font_to_table(pfbblob) + if pfbdata then + local glyphs = pfbdata.glyphs + if glyphs then + if trace_loading then + report_afm("getting index data from %a",pfbname) + end + for index, glyph in next, glyphs do + local name = glyph.name + if name then + 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 - char.index = index end + elseif trace_loading then + report_afm("no glyph data in pfb file %a",pfbname) end + elseif trace_loading then + report_afm("no data in pfb file %a",pfbname) end + close_font(pfbblob) elseif trace_loading then - report_afm("no glyph data in pfb file %a",pfbname) + report_afm("invalid pfb file %a",pfbname) end - elseif trace_loading then - report_afm("no data in pfb file %a",pfbname) end - close_font(pfbblob) - elseif trace_loading then - report_afm("invalid pfb file %a",pfbname) + end + + -- new (unfinished) font loader but i see no differences between + -- old and new (one bad vector with old) + + 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 = mod((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 + + if fontloader then + + afm.use_new_indexer = true + get_indexes_new = get_indexes + + get_indexes = function(data,pfbname) + if afm.use_new_indexer then + return get_indexes_new(data,pfbname) + else + return get_indexes_old(data,pfbname) + end + end + + end + end local function readafm(filename) @@ -351,8 +500,9 @@ function afm.load(filename) data = readafm(filename) if data then if pfbname ~= "" then + data.resources.filename = resolvers.unresolve(pfbname) get_indexes(data,pfbname) - elseif trace_loading then + elseif trace_loading then report_afm("no pfb file for %a",filename) -- data.resources.filename = "unset" -- better than loading the afm file end diff --git a/tex/context/base/mkiv/font-otr.lua b/tex/context/base/mkiv/font-otr.lua index 3542d180e..d20238349 100644 --- a/tex/context/base/mkiv/font-otr.lua +++ b/tex/context/base/mkiv/font-otr.lua @@ -1066,14 +1066,13 @@ readers.hmtx = function(f,fontdata,specification) local nofmetrics = fontdata.horizontalheader.nofhmetrics local glyphs = fontdata.glyphs local nofglyphs = fontdata.nofglyphs - local nofrepeated = nofglyphs - nofmetrics local width = 0 -- advance local leftsidebearing = 0 for i=0,nofmetrics-1 do local glyph = glyphs[i] width = readshort(f) leftsidebearing = readshort(f) - if advance ~= 0 then + if width ~= 0 then glyph.width = width end -- if leftsidebearing ~= 0 then @@ -1082,8 +1081,8 @@ readers.hmtx = function(f,fontdata,specification) end -- The next can happen in for instance a monospace font or in a cjk font -- with fixed widths. - for i=nofmetrics,nofrepeated do - local glyph = glyphs[i] + for i=nofmetrics,nofglyphs do + local glyph = glyphs[i] if width ~= 0 then glyph.width = width end diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua index 7edaaf683..a99aaf49a 100644 --- a/tex/context/base/mkiv/font-oup.lua +++ b/tex/context/base/mkiv/font-oup.lua @@ -378,7 +378,12 @@ local function copyduplicates(fontdata) t[#t+1] = f_character_y(u) end end - report("duplicates: % t",t) + local n = #t + if n > 25 then + report("duplicates: %i : %s .. %s ",n,t[1],t[n]) + else + report("duplicates: %i : % t",n,t) + end else -- what a mess end @@ -577,13 +582,12 @@ local function checklookups(fontdata,missing,nofmissing) if r then local name = descriptions[i].name or f_index(i) if not ignore[name] then - done[#done+1] = name + done[name] = true end end end - if #done > 0 then - table.sort(done) - report("not unicoded: % t",done) + if next(done) then + report("not unicoded: % t",table.sortedkeys(done)) end end end diff --git a/tex/context/base/mkiv/font-tfm.lua b/tex/context/base/mkiv/font-tfm.lua index 83ac2f0d8..8e92c4808 100644 --- a/tex/context/base/mkiv/font-tfm.lua +++ b/tex/context/base/mkiv/font-tfm.lua @@ -155,7 +155,7 @@ local function read_from_tfm(specification) end -- let's play safe: properties.haskerns = true - properties.haslogatures = true + properties.hasligatures = true resources.unicodes = { } resources.lookuptags = { } -- diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 7198a0b1e..5dc19f144 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex b0a5f7392..9671847cc 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex da9192469..a7da0f9d2 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-makeup.xml b/tex/context/interface/mkiv/i-makeup.xml index 42a327543..2128464ef 100644 --- a/tex/context/interface/mkiv/i-makeup.xml +++ b/tex/context/interface/mkiv/i-makeup.xml @@ -113,7 +113,7 @@ </cd:arguments> </cd:command> - <cd:command name="makeup" type="environment" file="page-mak.mkvi"> + <cd:command file="page-mak.mkvi" name="makeup" type="environment"> <cd:arguments> <cd:resolve name="keyword-name"/> <cd:assignments list="yes" optional="yes"> @@ -122,7 +122,7 @@ </cd:arguments> </cd:command> - <cd:command name="makeup" type="environment" generated="yes" variant="generated" file="page-mak.mkvi"> + <cd:command file="page-mak.mkvi" generated="yes" name="makeup" type="environment" variant="generated"> <cd:sequence> <cd:variable value="makeup"/> <cd:string value="makeup"/> @@ -132,8 +132,17 @@ <cd:inherit name="setupmakeup"/> </cd:assignments> </cd:arguments> + <cd:instances> + <cd:constant value="standard"/> + <cd:constant value="page"/> + <cd:constant value="text"/> + <cd:constant value="middle"/> + </cd:instances> </cd:command> + + <!-- + <cd:command name="standardmakeup" type="environment" file="page-mak.mkvi"> <cd:arguments> <cd:assignments list="yes" optional="yes"> @@ -166,4 +175,6 @@ </cd:arguments> </cd:command> + --> + </cd:interface> diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex f83cee161..6a3f4c4cb 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/mkiv/x-setups-basics.mkiv b/tex/context/modules/mkiv/x-setups-basics.mkiv index 326323259..39547591c 100644 --- a/tex/context/modules/mkiv/x-setups-basics.mkiv +++ b/tex/context/modules/mkiv/x-setups-basics.mkiv @@ -12,19 +12,26 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% We can make this module a bit cleaner using more recent features -% or we go \LUA\ completely but as this style evolved over 15 years -% it's a waste of time. +%D We can make this module a bit cleaner using more recent features or we go \LUA\ +%D completely but as this style evolved over 15 years it's a waste of time. +%D +%D As we also have a help server we can make a common framework for this \unknown\ +%D but even then, this file is also a test for the the \XML\ processor. +%D +%D Traditionally we used the sorter to generate the lists while nowadays we can +%D as well use the \XML\ mechanisms directly. We cannot change too much because +%D manuals depend on it. +%D +%D Currently we load the \XML\ file and when not in the english interface we just +%D remap the relevant words to their translation. \unprotect \defineregister [texmacro] -% [texmacros] \definesorting [texcommand] -% [texcommands] \setupsorting [texcommand] @@ -52,7 +59,7 @@ \c!command=\setup, \c!criterium=\v!used] -% general +%D General: \unexpanded\def\setupnumfont {} \unexpanded\def\setuptxtfont {} @@ -102,7 +109,7 @@ \doifelsenothing {\xmlatt{#1}{variant}} { \let\currentSETUPvariant\empty } { - \def\currentSETUPvariant{:\xmllastatt} + \def\currentSETUPvariant{:\xmllastatt} } \edef\currentSETUPfullname { \currentSETUPprefix @@ -174,6 +181,7 @@ end end + replace('cd:command', 'name', commands, elements) replace('cd:string', 'value', commands, elements) replace('cd:variable' , 'value', variables) @@ -254,23 +262,23 @@ \xmlregisterdocumentsetup{setups}{xml:setups:basics} -\unexpanded\def\loadsetups{\complexorsimple\loadsetups} - \let\loadedsetups\empty % we load more setups, setups:<name> -\def\simpleloadsetups - {\doifnotmode{no-setup-main}{\complexloadsetups[cont-en.xml]}} - -\def\complexloadsetups[#1]% - {\doifsomething{#1} - {\doonlyonce{setups:#1} - {\doglobal\prependtocommalist{setups:#1}\loadedsetups % last overloads first - \doiffileexistselse{#1} - {\xmlloadonly{setups:#1}{#1}{setups}}% - {\xmlloadonly{setups:#1}{#1.xml}{setups}}% - % qualified path saves > 50% runtime - \xmlfilter{setups:#1}{/interface//command/command(xml:setups:register)}% - }}} +\unexpanded\def\loadsetups + {\dosingleempty\cmd_load_setups} + +\def\cmd_load_setups[#1]% + {\edef\m_cmd_asked_setups{#1}% + \doifnotmode{no-setup-main}{\def\m_cmd_asked_setups{i-context.xml}}% + \ifx\m_cmd_asked_setups\empty \else + \doonlyonce{setups:#1} + {\doglobal\prependtocommalist{setups:#1}\loadedsetups + \doiffileexistselse{#1} + {\xmlloadonly{setups:#1}{#1}{setups}}% + {\xmlloadonly{setups:#1}{#1.xml}{setups}}% + % qualified path saves > 50% runtime + \xmlfilter{setups:#1}{/interface//command/command(xml:setups:register)}}% + \fi} \newconstant \c_cmd_kind \newconditional\c_cmd_doing_line @@ -313,13 +321,14 @@ \startelement[setup][name=#1]% \startelement[noexport][comment={setup definition #1}]% \xmlsetup{\rawsynonymname{texcommand}{stp:x:#1}}{xml:setups:typeset} - % \xmlfilterlist{\loadedsetups}{/interface/command['#1' == (@type=='environment' and '\e!start' or '') .. @name]/command(xml:setups:typeset)}% \stopelement \stopelement} \unexpanded\def\placesetup {\placelistofsorts[texcommand][\c!criterium=\v!used]} \unexpanded\def\placeallsetups{\placelistofsorts[texcommand][\c!criterium=\v!all ]} +% todo: grouped + \let\placeeverysetup\placeallsetups %D Typesetting: @@ -338,59 +347,90 @@ \blank \stopxmlsetups -\startxmlsetups xml:setups:typeset:line - \ttbf - \nohyphens +\startxmlsetups xml:setups:make:string + \xmlatt{#1}{value} +\stopxmlsetups + +\startxmlsetups xml:setups:make:variable + \xmlatt{#1}{value} +\stopxmlsetups + +\let\m_cmd_current_hash\empty +\let\m_cmd_current_file\empty +\let\m_cmd_font \empty +\let\m_cmd_name \empty +\let\m_cmd_start \empty +\let\m_cmd_stop \empty + +\startxmlsetups xml:setups:make:prepare \edef\m_cmd_current_hash{\xmlatt{#1}{hash}} - \bgroup - \settrue\c_cmd_doing_line - \doif {\xmlatt{#1}{generated}} {yes} { - \ttbs - } - \letterbackslash - \doif {\xmlatt{#1}{type}} {environment} { - \doifsomethingelse {\xmlatt{#1}{begin}} { - \xmllastatt - } { - \e!start - } + \xdef\m_cmd_current_file{\xmlatt{#1}{file}}% + \xmldoifelseempty{#1}{/sequence} { + \edef\m_cmd_name{\xmlatt{#1}{name}} + } { + \edef\m_cmd_name{\xmlfilter{#1}{/sequence/(string|variable)/command(xml:setups:make:*)}} + } + \doifelse {\xmlatt{#1}{type}} {environment} { + \doifsomethingelse {\xmlatt{#1}{begin}} { + \edef\m_cmd_start{\xmllastatt} + } { + \let\m_cmd_start\e!start } - \xmldoifelseempty{#1}{/sequence} { - \xmlatt{#1}{name} + \doifsomethingelse {\xmlatt{#1}{end}} { + \edef\m_cmd_stop{\xmllastatt} } { - \xmlfilter{#1}{/sequence/first()} + \let\m_cmd_stop\e!stop } + } { + \let\m_cmd_start\empty + \let\m_cmd_stop \empty + } + \doifelse {\xmlatt{#1}{generated}} {yes} { + \let\m_cmd_font\ttsl + } { + \let\m_cmd_font\relax + } +\stopxmlsetups + +\startsetups xml:setups:make:start + \bgroup + \settrue\c_cmd_doing_line + \m_cmd_font + \letterbackslash + \m_cmd_start + \m_cmd_name \ignorespaces \egroup - \xmldoif{#1}{/arguments} { +\stopsetups + +\startsetups xml:setups:make:stop + \ifx\m_cmd_stop\empty \else \bgroup \settrue\c_cmd_doing_line - \global\c_cmd_current_argument\zerocount + \hskip.5em\unknown\hskip.5em + \m_cmd_font + \letterbackslash + \m_cmd_stop + \m_cmd_name \ignorespaces - \xmlfilter{#1}{/arguments/text()} \egroup - } - \doif {\xmlatt{#1}{type}} {environment} { + \fi +\stopsetups + +\startxmlsetups xml:setups:typeset:line + \ttbf + \nohyphens + \xmlsetup{#1}{xml:setups:make:prepare} + \directsetup{xml:setups:make:start} + \xmldoif{#1}{/arguments} { \bgroup \settrue\c_cmd_doing_line - \hskip.5em\unknown\hskip.5em - \doif {\xmlatt{#1}{generated}} {yes} { - \ttbs - } - \letterbackslash - \doifsomethingelse {\xmlatt{#1}{end}} { - \xmllastatt - } { - \e!stop - } - \xmldoifelseempty{#1}{/sequence} { - \xmlatt{#1}{name} - } { - \xmlfilter{#1}{/sequence/first()} - } + \global\c_cmd_current_argument\zerocount \ignorespaces + \xmlfilter{#1}{/arguments/text()} \egroup } + \directsetup{xml:setups:make:stop} \stopxmlsetups \startxmlsetups xml:setups:typeset:raw @@ -399,29 +439,8 @@ \veryraggedright \global\c_cmd_current_argument\zerocount \global\c_cmd_maximum_argument\xmlfilter{#1}{/arguments/*/s_count()}\relax - \edef\m_cmd_current_hash{\xmlatt{#1}{hash}} - \xdef\m_cmd_current_file{\xmlatt{#1}{file}}% - % can be made faster : - \bgroup - \settrue\c_cmd_doing_line - \doif {\xmlatt{#1}{generated}} {yes} { - \ttsl - } - \letterbackslash - \doif {\xmlatt{#1}{type}} {environment} { - \doifsomethingelse {\xmlatt{#1}{begin}} { - \xmllastatt - } { - \e!start - } - } - \xmldoifelseempty{#1}{/sequence} { - \xmlatt{#1}{name} - } { - \xmlfilter{#1}{/sequence/first()} - } - \ignorespaces - \egroup + \xmlsetup{#1}{xml:setups:make:prepare} + \directsetup{xml:setups:make:start} \xmldoif{#1}{/arguments} { \settrue\c_cmd_doing_line \bgroup @@ -430,27 +449,7 @@ \xmlfilter{#1}{/arguments/text()} \egroup } - \doif {\xmlatt{#1}{type}} {environment} { - \settrue\c_cmd_doing_line - \bgroup - \hskip.5em\unknown\hskip.5em - \doif {\xmlatt{#1}{generated}} {yes} { - \ttsl - } - \letterbackslash - \doifsomethingelse {\xmlatt{#1}{end}} { - \xmllastatt - } { - \e!stop - } - \xmldoifelseempty{#1}{/sequence} { - \xmlatt{#1}{name} - } { - \xmlfilter{#1}{/sequence/first()} - } - \ignorespaces - \egroup - } + \directsetup{xml:setups:make:stop} \stopxmlsetups \startxmlsetups xml:setups:typeset:detail @@ -484,23 +483,28 @@ \glet\m_cmd_current_file\empty \stopxmlsetups +\startsetups xml:setups:overlay:file + \vbox to \overlayheight \bgroup + \infofont + \vfill + \scratchdimen.5\exheight + \hbox to \overlaywidth \bgroup + \strut + \hss + \m_cmd_current_file + \hskip\dimexpr\scratchdimen+\strutdp\relax + \egroup + \vskip\scratchdimen + \egroup +\stopsetups + \defineoverlay [setupfilename] - [\vbox to \overlayheight - {\infofont - \vfill - \scratchdimen.5\exheight - \hbox to \overlaywidth - {\strut - \hss - \m_cmd_current_file - \hskip\dimexpr\scratchdimen+\strutdp\relax}% - \vskip\scratchdimen}] + [\directsetup{xml:setups:overlay:file}] \startxmlsetups xml:setups:resolve \ignorespaces \ctxlua{moduledata.setups.resolved('\xmlatt{#1}{name}')} - % \xmlfilterlist{\loadedsetups}{/interface/define[@name='\xmlatt{#1}{name}']/first()} \stopxmlsetups %D This is the first pass; here we generate the top line. diff --git a/tex/generic/context/luatex/luatex-basics-gen.lua b/tex/generic/context/luatex/luatex-basics-gen.lua index c298f6dd9..2a68b1c18 100644 --- a/tex/generic/context/luatex/luatex-basics-gen.lua +++ b/tex/generic/context/luatex/luatex-basics-gen.lua @@ -92,12 +92,10 @@ local remapper = { otf = "opentype fonts", ttf = "truetype fonts", ttc = "truetype fonts", - dfont = "truetype fonts", -- "truetype dictionary", cid = "cid maps", cidmap = "cid maps", - fea = "font feature files", - pfa = "type1 fonts", -- this is for Khaled, in ConTeXt we don't use this! - pfb = "type1 fonts", -- this is for Khaled, in ConTeXt we don't use this! + -- fea = "font feature files", -- no longer supported + pfb = "type1 fonts", -- needed for vector loading afm = "afm", } diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index fdfcadd43..d029bf4f8 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 : 04/19/16 17:16:02 +-- merge date : 04/21/16 10:10:19 do -- begin closure to overcome local limits and interference @@ -3693,11 +3693,8 @@ local remapper={ otf="opentype fonts", ttf="truetype fonts", ttc="truetype fonts", - dfont="truetype fonts", cid="cid maps", cidmap="cid maps", - fea="font feature files", - pfa="type1 fonts", pfb="type1 fonts", afm="afm", } @@ -6928,7 +6925,7 @@ local function read_from_tfm(specification) end end properties.haskerns=true - properties.haslogatures=true + properties.hasligatures=true resources.unicodes={} resources.lookuptags={} depth[filename]=depth[filename]-1 @@ -6981,9 +6978,11 @@ if not modules then modules={} end modules ['font-afm']={ } local fonts,logs,trackers,containers,resolvers=fonts,logs,trackers,containers,resolvers local next,type,tonumber=next,type,tonumber -local format,match,gmatch,lower,gsub,strip=string.format,string.match,string.gmatch,string.lower,string.gsub,string.strip -local abs=math.abs -local P,S,C,R,lpegmatch,patterns=lpeg.P,lpeg.S,lpeg.C,lpeg.R,lpeg.match,lpeg.patterns +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,mod=math.abs,math.mod +local bxor,rshift=bit32.bxor,bit32.rshift +local P,S,R,Cmt,C,Ct,Cs,lpegmatch,patterns=lpeg.P,lpeg.S,lpeg.R,lpeg.Cmt,lpeg.C,lpeg.Ct,lpeg.Cs,lpeg.match,lpeg.patterns local derivetable=table.derive 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) @@ -6995,10 +6994,6 @@ local findbinfile=resolvers.findbinfile local definers=fonts.definers local readers=fonts.readers local constructors=fonts.constructors -local fontloader=fontloader -local font_to_table=fontloader.to_table -local open_font=fontloader.open -local close_font=fontloader.close local afm=constructors.newhandler("afm") local pfb=constructors.newhandler("pfb") local afmfeatures=constructors.newfeatures("afm") @@ -7112,39 +7107,140 @@ local function get_variables(data,fontmetrics) end end end -local function get_indexes(data,pfbname) - data.resources.filename=resolvers.unresolve(pfbname) - local pfbblob=open_font(pfbname) - if pfbblob then - local characters=data.characters - local pfbdata=font_to_table(pfbblob) - if pfbdata then - local glyphs=pfbdata.glyphs - if glyphs then - if trace_loading then - report_afm("getting index data from %a",pfbname) - end - for index,glyph in next,glyphs do - local name=glyph.name - if name then - local char=characters[name] - if char then - if trace_indexing then - report_afm("glyph %a has index %a",name,index) +local get_indexes +do + local fontloader=fontloader + if fontloader then + local font_to_table=fontloader.to_table + local open_font=fontloader.open + local close_font=fontloader.close + local function get_indexes_old(data,pfbname) + local pfbblob=open_font(pfbname) + if pfbblob then + local characters=data.characters + local pfbdata=font_to_table(pfbblob) + if pfbdata then + local glyphs=pfbdata.glyphs + if glyphs then + if trace_loading then + report_afm("getting index data from %a",pfbname) + end + for index,glyph in next,glyphs do + local name=glyph.name + if name then + 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 - char.index=index end + elseif trace_loading then + report_afm("no glyph data in pfb file %a",pfbname) end + elseif trace_loading then + report_afm("no data in pfb file %a",pfbname) end + close_font(pfbblob) elseif trace_loading then - report_afm("no glyph data in pfb file %a",pfbname) + report_afm("invalid pfb file %a",pfbname) + end + end + end + 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 + ) + 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=mod((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 + 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 + 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 + if fontloader then + afm.use_new_indexer=true + get_indexes_new=get_indexes + get_indexes=function(data,pfbname) + if afm.use_new_indexer then + return get_indexes_new(data,pfbname) + else + return get_indexes_old(data,pfbname) end - elseif trace_loading then - report_afm("no data in pfb file %a",pfbname) end - close_font(pfbblob) - elseif trace_loading then - report_afm("invalid pfb file %a",pfbname) end end local function readafm(filename) @@ -7223,6 +7319,7 @@ function afm.load(filename) data=readafm(filename) 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) @@ -8702,18 +8799,17 @@ readers.hmtx=function(f,fontdata,specification) local nofmetrics=fontdata.horizontalheader.nofhmetrics local glyphs=fontdata.glyphs local nofglyphs=fontdata.nofglyphs - local nofrepeated=nofglyphs-nofmetrics local width=0 local leftsidebearing=0 for i=0,nofmetrics-1 do local glyph=glyphs[i] width=readshort(f) leftsidebearing=readshort(f) - if advance~=0 then + if width~=0 then glyph.width=width end end - for i=nofmetrics,nofrepeated do + for i=nofmetrics,nofglyphs do local glyph=glyphs[i] if width~=0 then glyph.width=width @@ -13841,7 +13937,12 @@ local function copyduplicates(fontdata) t[#t+1]=f_character_y(u) end end - report("duplicates: % t",t) + local n=#t + if n>25 then + report("duplicates: %i : %s .. %s ",n,t[1],t[n]) + else + report("duplicates: %i : % t",n,t) + end else end end @@ -14026,13 +14127,12 @@ local function checklookups(fontdata,missing,nofmissing) if r then local name=descriptions[i].name or f_index(i) if not ignore[name] then - done[#done+1]=name + done[name]=true end end end - if #done>0 then - table.sort(done) - report("not unicoded: % t",done) + if next(done) then + report("not unicoded: % t",table.sortedkeys(done)) end end end |