diff options
author | Norbert Preining <preining@logic.at> | 2019-02-24 15:12:57 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2019-02-24 15:12:57 +0000 |
commit | 1314fbe93790c501dc436a5cf99f106b9e5c0f63 (patch) | |
tree | 04dc7734c8be8ffe385d41f4388826ef5857b6f9 /Master/texmf-dist/tex/context/base/mkiv/font-onr.lua | |
parent | eb80ce7b34f59896a1dfee5ca422495394d6677f (diff) |
Revert "ConTeXt version 2019.02.22 19:35"
This reverts commit 5c6357cdb820b4f628d036ba7b2248f221d50c0b.
git-svn-id: svn://tug.org/texlive/trunk@50112 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/font-onr.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/font-onr.lua | 79 |
1 files changed, 20 insertions, 59 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua b/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua index 8523d8729ab..26a782649f4 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-onr.lua @@ -26,7 +26,7 @@ local match, lower, gsub, strip, find = string.match, string.lower, string.gsub, 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, V, Cmt, C, Ct, Cs, Carg, Cf, Cg, Cc = lpeg.P, lpeg.S, lpeg.R, lpeg.V, lpeg.Cmt, lpeg.C, lpeg.Ct, lpeg.Cs, lpeg.Carg, lpeg.Cf, lpeg.Cg, lpeg.Cc +local P, S, R, Cmt, C, Ct, Cs, Carg, Cf, Cg = lpeg.P, lpeg.S, lpeg.R, lpeg.Cmt, lpeg.C, lpeg.Ct, lpeg.Cs, lpeg.Carg, lpeg.Cf, lpeg.Cg local lpegmatch, patterns = lpeg.match, lpeg.patterns local trace_indexing = false trackers.register("afm.indexing", function(v) trace_indexing = v end) @@ -83,40 +83,31 @@ do end - local charstrings = P("/CharStrings") - local subroutines = P("/Subrs") - local encoding = P("/Encoding") - local dup = P("dup") - local put = P("put") - local array = P("array") - local name = P("/") * C((R("az","AZ","09")+S("-_."))^1) - local digits = R("09")^1 - local cardinal = digits / tonumber - local spaces = P(" ")^1 - local spacing = patterns.whitespace^0 + local charstrings = P("/CharStrings") + local subroutines = P("/Subrs") + local encoding = P("/Encoding") + local dup = P("dup") + local put = P("put") + local array = P("array") + local name = P("/") * C((R("az","AZ","09")+S("-_."))^1) + local digits = R("09")^1 + local cardinal = digits / tonumber + local spaces = P(" ")^1 + local spacing = patterns.whitespace^0 local routines, vector, chars, n, m local initialize = function(str,position,size) n = 0 - m = size + m = size -- % tonumber(size) return position + 1 end local setroutine = function(str,position,index,size,filename) - if routines[index] then - -- we have passed the end - return false - end - local forward = position + size + local forward = position + tonumber(size) local stream = decrypt(sub(str,position+1,forward),4330,4) routines[index] = { byte(stream,1,#stream) } - n = n + 1 - if n >= m then - -- m should be index now but can we assume ordering? - return #str - end - return forward + 1 + return forward end local setvector = function(str,position,name,size,filename) @@ -161,7 +152,7 @@ do local p_filterroutines = -- dup <i> <n> RD or -| <n encrypted bytes> NP or | (1-subroutines)^0 * subroutines * spaces * Cmt(cardinal,initialize) - * (Cmt(cardinal * spaces * cardinal * p_rd * Carg(1), setroutine) * p_np + (1-p_nd))^1 + * (Cmt(cardinal * spaces * cardinal * p_rd * Carg(1), setroutine) * p_np + P(1))^1 local p_filtershapes = -- /foo <n> RD <n encrypted bytes> ND (1-charstrings)^0 * charstrings * spaces * Cmt(cardinal,initialize) @@ -184,33 +175,7 @@ do -- if one of first 4 not 0-9A-F then binary else hex - local key = spacing * P("/") * R("az","AZ") - local str = spacing * Cs { (P("(")/"") * ((1 - P("\\(") - P("\\)") - S("()")) + V(1))^0 * (P(")")/"") } - local num = spacing * (R("09") + S("+-."))^1 / tonumber - local arr = spacing * Ct (S("[{") * (num)^0 * spacing * S("]}")) - local boo = spacing * (P("true") * Cc(true) + P("false") * Cc(false)) - local nam = spacing * P("/") * Cs(R("az","AZ")^1) - - local p_filtermetadata = ( - P("/") * Carg(1) * ( ( - C("version") * str - + C("Copyright") * str - + C("Notice") * str - + C("FullName") * str - + C("FamilyName") * str - + C("Weight") * str - + C("ItalicAngle") * num - + C("isFixedPitch") * boo - + C("UnderlinePosition") * num - + C("UnderlineThickness") * num - + C("FontName") * nam - + C("FontMatrix") * arr - + C("FontBBox") * arr - ) ) / function(t,k,v) t[lower(k)] = v end - + P(1) - )^0 * Carg(1) - - local function loadpfbvector(filename,shapestoo,streams) + local function loadpfbvector(filename,shapestoo) -- for the moment limited to encoding only local data = io.loaddata(resolvers.findfile(filename)) @@ -235,14 +200,11 @@ do binary = decrypt(binary,55665,4) local names = { } - local encoding = lpegmatch(p_filterencoding,ascii) - local metadata = lpegmatch(p_filtermetadata,ascii,1,{}) local glyphs = { } routines, vector, chars = { }, { }, { } - if shapestoo or streams then - -- io.savedata("foo.txt",binary) + if shapestoo then lpegmatch(p_filterroutines,binary,1,filename) lpegmatch(p_filtershapes,binary,1,filename) local data = { @@ -254,8 +216,7 @@ do } }, } - -- only cff 1 in type 1 fonts - fonts.handlers.otf.readers.parsecharstrings(false,data,glyphs,true,"cff",streams) + fonts.handlers.otf.readers.parsecharstrings(false,data,glyphs,true,true) else lpegmatch(p_filternames,binary,1,filename) end @@ -264,7 +225,7 @@ do routines, vector, chars = nil, nil, nil - return names, encoding, glyphs, metadata + return names, encoding, glyphs end |