diff options
Diffstat (limited to 'tex/generic')
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua | 8 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 130 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-otn.lua | 76 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-pdf.tex | 179 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-plain.tex | 4 |
5 files changed, 236 insertions, 161 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua b/tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua index 3878ae648..13acd16ca 100644 --- a/tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua +++ b/tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua @@ -17,6 +17,7 @@ return function(specification) { "special", "pdf:1 0 0 rg" }, { "special", "pdf:0 1 0 rg" }, { "special", "pdf:0 0 1 rg" }, + { "special", "pdf:0 0 1 rg" }, } local chars = { identifiers[id1].characters, @@ -26,7 +27,12 @@ return function(specification) for u, v in next, f1.characters do local n = math.floor(math.random(1,3)+0.5) local c = chars[n][u] or v - v.commands = { color[n], { 'slot', n, u }, color[0] } + v.commands = { + color[n], + { 'slot', n, u }, + color[0], + { 'nop' } + } v.kerns = nil v.width = c.width v.height = c.height diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index a2a598b2d..ae366179c 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 10/09/15 21:28:28 +-- merge date : 11/19/15 19:13:15 do -- begin closure to overcome local limits and interference @@ -4211,8 +4211,8 @@ end constructors.setfactor() function constructors.scaled(scaledpoints,designsize) if scaledpoints<0 then + local factor=constructors.factor if designsize then - local factor=constructors.factor if designsize>factor then return (- scaledpoints/1000)*designsize else @@ -4650,6 +4650,10 @@ function constructors.scale(tfmdata,specification) end end end + local vi=character.vert_italic + if vi and vi~=0 then + chr.vert_italic=vi*hdelta + end local va=character.accent if va then chr.top_accent=vdelta*va @@ -5833,6 +5837,8 @@ local constructors=fonts.constructors local encodings=fonts.encodings local tfm=constructors.newhandler("tfm") tfm.version=1.000 +tfm.maxnestingdepth=5 +tfm.maxnestingsize=65536*1024 local tfmfeatures=constructors.newfeatures("tfm") local registertfmfeature=tfmfeatures.register constructors.resolvevirtualtoo=false @@ -5845,9 +5851,11 @@ function tfm.setfeatures(tfmdata,features) return {} end end +local depth={} local function read_from_tfm(specification) local filename=specification.filename local size=specification.size + depth[filename]=(depth[filename] or 0)+1 if trace_defining then report_defining("loading tfm file %a at size %s",filename,size) end @@ -5891,6 +5899,25 @@ local function read_from_tfm(specification) end properties.virtualized=true tfmdata.fonts=vfdata.fonts + tfmdata.type="virtual" + local fontlist=vfdata.fonts + local name=file.nameonly(filename) + for i=1,#fontlist do + local n=fontlist[i].name + local s=fontlist[i].size + local d=depth[filename] + s=constructors.scaled(s,vfdata.designsize) + if d>tfm.maxnestingdepth then + report_defining("too deeply nested virtual font %a with size %a, max nesting depth %s",n,s,tfm.maxnestingdepth) + fontlist[i]={ id=0 } + elseif (d>1) and (s>tfm.maxnestingsize) then + report_defining("virtual font %a exceeds size %s",n,s) + fontlist[i]={ id=0 } + else + local t,id=fonts.constructors.readanddefine(n,s) + fontlist[i]={ id=id } + end + end end end end @@ -5906,7 +5933,10 @@ local function read_from_tfm(specification) properties.haslogatures=true resources.unicodes={} resources.lookuptags={} + depth[filename]=depth[filename]-1 return tfmdata + else + depth[filename]=depth[filename]-1 end end local function check_tfm(specification,fullname) @@ -8652,7 +8682,7 @@ actions["merge kern classes"]=function(data,filename,raw) local subtable=subtables[s] local kernclass=subtable.kernclass local lookup=subtable.lookup or subtable.name - if kernclass then + if kernclass then if #kernclass>0 then kernclass=kernclass[1] lookup=type(kernclass.lookup)=="string" and kernclass.lookup or lookup @@ -8677,14 +8707,16 @@ actions["merge kern classes"]=function(data,filename,raw) if splt then local extrakerns={} local baseoffset=(fk-1)*maxseconds - for sk=2,maxseconds do + for sk=2,maxseconds do local sv=seconds[sk] - local splt=split[sv] - if splt then - local offset=offsets[baseoffset+sk] - if offset then - for i=1,#splt do - extrakerns[splt[i]]=offset + if sv then + local splt=split[sv] + if splt then + local offset=offsets[baseoffset+sk] + if offset then + for i=1,#splt do + extrakerns[splt[i]]=offset + end end end end @@ -9145,6 +9177,7 @@ local function copytotfm(data,cache_id) local m=d.math if m then local italic=m.italic + local vitalic=m.vitalic local variants=m.hvariants local parts=m.hparts if variants then @@ -9171,11 +9204,13 @@ local function copytotfm(data,cache_id) c.vert_variants=parts elseif parts then character.vert_variants=parts - italic=m.vitalic end if italic and italic~=0 then character.italic=italic end + if vitalic and vitalic~=0 then + character.vert_italic=vitalic + end local accent=m.accent if accent then character.accent=accent @@ -11610,7 +11645,6 @@ local disccodes=nodes.disccodes local glyph_code=nodecodes.glyph local glue_code=nodecodes.glue local disc_code=nodecodes.disc -local whatsit_code=nodecodes.whatsit local math_code=nodecodes.math local dir_code=whatcodes.dir local localpar_code=whatcodes.localpar @@ -14245,42 +14279,6 @@ local function featuresprocessor(head,font,attr) comprun(start,c_run) start=getnext(start) end - elseif id==whatsit_code then - local subtype=getsubtype(start) - if subtype==dir_code then - local dir=getfield(start,"dir") - if dir=="+TLT" then - topstack=topstack+1 - dirstack[topstack]=dir - rlmode=1 - elseif dir=="+TRT" then - topstack=topstack+1 - dirstack[topstack]=dir - rlmode=-1 - elseif dir=="-TLT" or dir=="-TRT" then - topstack=topstack-1 - rlmode=dirstack[topstack]=="+TRT" and -1 or 1 - else - rlmode=rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir) - end - elseif subtype==localpar_code then - local dir=getfield(start,"dir") - if dir=="TRT" then - rlparmode=-1 - elseif dir=="TLT" then - rlparmode=1 - else - rlparmode=0 - end - rlmode=rlparmode - if trace_directions then - report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode) - end - end - start=getnext(start) elseif id==math_code then start=getnext(end_of_math(start)) else @@ -14501,42 +14499,6 @@ local function featuresprocessor(head,font,attr) comprun(start,c_run) start=getnext(start) end - elseif id==whatsit_code then - local subtype=getsubtype(start) - if subtype==dir_code then - local dir=getfield(start,"dir") - if dir=="+TLT" then - topstack=topstack+1 - dirstack[topstack]=dir - rlmode=1 - elseif dir=="+TRT" then - topstack=topstack+1 - dirstack[topstack]=dir - rlmode=-1 - elseif dir=="-TLT" or dir=="-TRT" then - topstack=topstack-1 - rlmode=dirstack[topstack]=="+TRT" and -1 or 1 - else - rlmode=rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir) - end - elseif subtype==localpar_code then - local dir=getfield(start,"dir") - if dir=="TRT" then - rlparmode=-1 - elseif dir=="TLT" then - rlparmode=1 - else - rlparmode=0 - end - rlmode=rlparmode - if trace_directions then - report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode) - end - end - start=getnext(start) elseif id==math_code then start=getnext(end_of_math(start)) else diff --git a/tex/generic/context/luatex/luatex-fonts-otn.lua b/tex/generic/context/luatex/luatex-fonts-otn.lua index 1b99c56de..7fafadbc4 100644 --- a/tex/generic/context/luatex/luatex-fonts-otn.lua +++ b/tex/generic/context/luatex/luatex-fonts-otn.lua @@ -250,7 +250,6 @@ local disccodes = nodes.disccodes local glyph_code = nodecodes.glyph local glue_code = nodecodes.glue local disc_code = nodecodes.disc -local whatsit_code = nodecodes.whatsit local math_code = nodecodes.math local dir_code = whatcodes.dir @@ -316,8 +315,6 @@ local notmatchpre = { } local notmatchpost = { } local notmatchreplace = { } --- head is always a whatsit so we can safely assume that head is not changed - -- we use this for special testing and documentation local checkstep = (nodes and nodes.tracers and nodes.tracers.steppers.check) or function() end @@ -3320,43 +3317,6 @@ local function featuresprocessor(head,font,attr) comprun(start,c_run) start = getnext(start) end - elseif id == whatsit_code then -- will be function - local subtype = getsubtype(start) - if subtype == dir_code then - local dir = getfield(start,"dir") - if dir == "+TLT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = 1 - elseif dir == "+TRT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = -1 - elseif dir == "-TLT" or dir == "-TRT" then - topstack = topstack - 1 - rlmode = dirstack[topstack] == "+TRT" and -1 or 1 - else - rlmode = rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir) - end - elseif subtype == localpar_code then - local dir = getfield(start,"dir") - if dir == "TRT" then - rlparmode = -1 - elseif dir == "TLT" then - rlparmode = 1 - else - rlparmode = 0 - end - -- one might wonder if the par dir should be looked at, so we might as well drop the next line - rlmode = rlparmode - if trace_directions then - report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode) - end - end - start = getnext(start) elseif id == math_code then start = getnext(end_of_math(start)) else @@ -3592,42 +3552,6 @@ local function featuresprocessor(head,font,attr) comprun(start,c_run) start = getnext(start) end - elseif id == whatsit_code then - local subtype = getsubtype(start) - if subtype == dir_code then - local dir = getfield(start,"dir") - if dir == "+TLT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = 1 - elseif dir == "+TRT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = -1 - elseif dir == "-TLT" or dir == "-TRT" then - topstack = topstack - 1 - rlmode = dirstack[topstack] == "+TRT" and -1 or 1 - else - rlmode = rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir) - end - elseif subtype == localpar_code then - local dir = getfield(start,"dir") - if dir == "TRT" then - rlparmode = -1 - elseif dir == "TLT" then - rlparmode = 1 - else - rlparmode = 0 - end - rlmode = rlparmode - if trace_directions then - report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode) - end - end - start = getnext(start) elseif id == math_code then start = getnext(end_of_math(start)) else diff --git a/tex/generic/context/luatex/luatex-pdf.tex b/tex/generic/context/luatex/luatex-pdf.tex new file mode 100644 index 000000000..49ca9c2d6 --- /dev/null +++ b/tex/generic/context/luatex/luatex-pdf.tex @@ -0,0 +1,179 @@ +% This is a pdftex compatibility file. We could use \ifprimitive instead. + +\begingroup + +\catcode`\{ = 1 % left brace is begin-group character +\catcode`\} = 2 % right brace is end-group character + +\ifdefined\pdfextension + + % promoted + + \global\let\pdfpagewidth \pagewidth + \global\let\pdfpageheight \pageheight + + \global\let\pdfadjustspacing \adjustspacing + \global\let\pdfprotrudechars \protrudechars + \global\let\pdfnoligatures \ignoreligaturesinfont + \global\let\pdffontexpand \expandglyphsinfont + \global\let\pdfcopyfont \copyfont + + \global\let\pdfxform \saveboxresource + \global\let\pdflastxform \lastsavedboxresourceindex + \global\let\pdfrefxform \useboxresource + + \global\let\pdfximage \saveimageresource + \global\let\pdflastximage \lastsavedimageresourceindex + \global\let\pdflastximagepages\lastsavedimageresourcepages + \global\let\pdfrefximage \useimageresource + + \global\let\pdfsavepos \savepos + \global\let\pdflastxpos \lastxpos + \global\let\pdflastypos \lastypos + + \global\let\pdftexversion \luatexversion + \global\let\pdftexrevision \luatexrevision + \global\let\pdftexbanner \luatexbanner + + \global\let\pdfoutput \outputmode + \global\let\pdfdraftmode \draftmode + + \global\let\pdfpxdimen \pxdimen + + \global\let\pdfinsertht \insertht + + % also promoted + + % \global\let\pdfnormaldeviate \normaldeviate + % \global\let\pdfuniformdeviate \uniformdeviate + % \global\let\pdfsetrandomseed \setrandomseed + % \global\let\pdfrandomseed \randomseed + % + % \let\pdfprimitive \primitive + % + % \global\let\expandafter\csname ifpdfabsnum\expandafter\endcsname\csname ifabsnum\endcsname + % \global\let\expandafter\csname ifpdfabsdim\expandafter\endcsname\csname ifabsdim\endcsname + % \global\let\expandafter\csname ifpdfprimitive\expandafter\endcsname\csname ifprimitive\endcsname + + % removed (also some others but already long ago) + + \ifdefined\newdimen + \newdimen\pdfeachlineheight + \newdimen\pdfeachlinedepth + \newdimen\pdflastlinedepth + \newdimen\pdffirstlineheight + \newdimen\pdfignoreddimen + \fi + + % commands + + \protected\gdef\pdfliteral {\pdfextension literal} + \protected\gdef\pdfcolorstack {\pdfextension colorstack} + \protected\gdef\pdfsetmatrix {\pdfextension setmatrix} + \protected\gdef\pdfsave {\pdfextension save\relax} + \protected\gdef\pdfrestore {\pdfextension restore\relax} + \protected\gdef\pdfobj {\pdfextension obj } + \protected\gdef\pdfrefobj {\pdfextension refobj } + \protected\gdef\pdfannot {\pdfextension annot } + \protected\gdef\pdfstartlink {\pdfextension startlink } + \protected\gdef\pdfendlink {\pdfextension endlink\relax} + \protected\gdef\pdfoutline {\pdfextension outline } + \protected\gdef\pdfdest {\pdfextension dest } + \protected\gdef\pdfthread {\pdfextension thread } + \protected\gdef\pdfstartthread {\pdfextension startthread } + \protected\gdef\pdfendthread {\pdfextension endthread\relax} + \protected\gdef\pdfinfo {\pdfextension info } + \protected\gdef\pdfcatalog {\pdfextension catalog } + \protected\gdef\pdfnames {\pdfextension names } + \protected\gdef\pdfincludechars {\pdfextension includechars } + \protected\gdef\pdffontattr {\pdfextension fontattr } + \protected\gdef\pdfmapfile {\pdfextension mapfile } + \protected\gdef\pdfmapline {\pdfextension mapline } + \protected\gdef\pdftrailer {\pdfextension trailer } + \protected\gdef\pdfglyphtounicode {\pdfextension glyphtounicode } + + % converted + + \gdef\pdftexversion {\numexpr\pdffeedback version} + \gdef\pdftexrevision {\pdffeedback revision} + \gdef\pdflastlink {\numexpr\pdffeedback lastlink} + \gdef\pdfretval {\numexpr\pdffeedback retval} + \gdef\pdflastobj {\numexpr\pdffeedback lastobj} + \gdef\pdflastannot {\numexpr\pdffeedback lastannot} + \gdef\pdfxformname {\numexpr\pdffeedback xformname} + \gdef\pdfcreationdate {\pdffeedback creationdate} + \gdef\pdffontname {\numexpr\pdffeedback fontname} + \gdef\pdffontobjnum {\numexpr\pdffeedback fontobjnum} + \gdef\pdffontsize {\dimexpr\pdffeedback fontsize} + \gdef\pdfpageref {\numexpr\pdffeedback pageref} + \gdef\pdfcolorstackinit {\pdffeedback colorstackinit} + + % registers + + \xdef\pdfcompresslevel {\pdfvariable compresslevel} + \xdef\pdfobjcompresslevel {\pdfvariable objcompresslevel} + \xdef\pdfdecimaldigits {\pdfvariable decimaldigits} + \xdef\pdfgamma {\pdfvariable gamma} + \xdef\pdfimageresolution {\pdfvariable imageresolution} + \xdef\pdfimageapplygamma {\pdfvariable imageapplygamma} + \xdef\pdfimagegamma {\pdfvariable imagegamma} + \xdef\pdfimagehicolor {\pdfvariable imagehicolor} + \xdef\pdfimageaddfilename {\pdfvariable imageaddfilename} + \xdef\pdfpkresolution {\pdfvariable pkresolution} + \xdef\pdfinclusioncopyfonts {\pdfvariable inclusioncopyfonts} + \xdef\pdfinclusionerrorlevel {\pdfvariable inclusionerrorlevel} + \xdef\pdfreplacefont {\pdfvariable replacefont} + \xdef\pdfgentounicode {\pdfvariable gentounicode} + \xdef\pdfpagebox {\pdfvariable pagebox} + \xdef\pdfminorversion {\pdfvariable minorversion} + \xdef\pdfuniqueresname {\pdfvariable uniqueresname} + + \xdef\pdfhorigin {\pdfvariable horigin} + \xdef\pdfvorigin {\pdfvariable vorigin} + \xdef\pdflinkmargin {\pdfvariable linkmargin} + \xdef\pdfdestmargin {\pdfvariable destmargin} + \xdef\pdfthreadmargin {\pdfvariable threadmargin} + + \xdef\pdfpagesattr {\pdfvariable pagesattr} + \xdef\pdfpageattr {\pdfvariable pageattr} + \xdef\pdfpageresources {\pdfvariable pageresources} + \xdef\pdfxformattr {\pdfvariable xformattr} + \xdef\pdfxformresources {\pdfvariable xformresources} + \xdef\pdfpkmode {\pdfvariable pkmode} + + % initializations + + \global\pdfcompresslevel 9 + \global\pdfobjcompresslevel 1 + \global\pdfdecimaldigits 3 + \global\pdfgamma 1000 + \global\pdfimageresolution 71 + \global\pdfimageapplygamma 0 + \global\pdfimagegamma 2200 + \global\pdfimagehicolor 1 + \global\pdfimageaddfilename 1 + \global\pdfpkresolution 72 + \global\pdfinclusioncopyfonts 0 + \global\pdfinclusionerrorlevel 0 + \global\pdfreplacefont 0 + \global\pdfgentounicode 0 + \global\pdfpagebox 0 + \global\pdfminorversion 4 + \global\pdfuniqueresname 0 + + \global\pdfhorigin 1in + \global\pdfvorigin 1in + \global\pdflinkmargin 0pt + \global\pdfdestmargin 0pt + \global\pdfthreadmargin 0pt + + % maybe + + % \global\chardef\pdftexversion 140 + % \global\def \pdftexrevision {16} + +\fi + +\endgroup + +\endinput diff --git a/tex/generic/context/luatex/luatex-plain.tex b/tex/generic/context/luatex/luatex-plain.tex index 9902c49f3..99347ed2c 100644 --- a/tex/generic/context/luatex/luatex-plain.tex +++ b/tex/generic/context/luatex/luatex-plain.tex @@ -13,6 +13,10 @@ % We assume that pdf is used. +\ifdefined\pdfextension + \input luatex-pdf \relax +\fi + \pdfoutput 1 % We set the page dimensions because otherwise the backend does weird things |