From 8def9a965dd090ee803cc6c12e186bb48ae4dcf7 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 11 Aug 2009 23:48:00 +0200 Subject: beta 2009.08.11 23:48 --- metapost/context/font/punkfont.mp | 854 +++++++++++++++++++++++++++++++ scripts/context/lua/luatools.lua | 2 +- scripts/context/ruby/texexec.rb | 3 + scripts/context/ruby/texmfstart.rb | 1 + scripts/context/stubs/mswin/luatools.lua | 2 +- scripts/context/stubs/unix/luatools | 2 +- tex/context/base/back-pdf.mkiv | 2 +- tex/context/base/java-fld.tex | 1 - tex/context/base/java-ini.lua | 6 +- tex/context/base/lpdf-fld.lua | 32 +- tex/context/base/lpdf-ini.lua | 2 +- tex/context/base/lpdf-mis.lua | 4 +- tex/context/base/lpdf-wid.lua | 2 +- tex/context/base/lxml-ini.mkiv | 2 +- tex/context/base/m-punk.tex | 232 +++++++++ tex/context/base/scrn-fld.mkiv | 45 +- tex/context/base/supp-mps.mkii | 4 +- tex/context/base/syst-aux.mkiv | 11 +- tex/context/base/syst-gen.mkii | 11 +- 19 files changed, 1180 insertions(+), 38 deletions(-) create mode 100644 metapost/context/font/punkfont.mp create mode 100644 tex/context/base/m-punk.tex diff --git a/metapost/context/font/punkfont.mp b/metapost/context/font/punkfont.mp new file mode 100644 index 000000000..a96e2e29f --- /dev/null +++ b/metapost/context/font/punkfont.mp @@ -0,0 +1,854 @@ +% Remark: +% +% This file is a merge of the original punk files by Donald Knuth, who +% added this comment: +% +% Font inspired by Gerard and Marjan Unger's lectures, +% Feb 1985 +% +% The regular punk files are part of TeXLive and in metafont format. All +% errors introduced are ours. We also changed the encoding to unicode. In +% due time we might add a few more more characters. We still need to +% improve some of the metrics which involves a bit of trial and error. The +% font just covers basic latin shapes but in ConTeXt MkIV we add virtual +% composed shapes. There is a module m-punk.tex that implements this. This +% derivate is also used in mk.tex (mk.pdf) which is one of our tests for +% LuaTeX. We published an article on it in the MAPS (NTG magazine). +% +% 2008, Taco Hoekwater & Hans Hagen + +if unknown punk_font_loaded : + + if unknown scale_factor : + scale_factor := 1 ; + fi ; + + boolean punk_font_loaded ; + + punk_font_loaded := true ; + warningcheck := 0 ; + designsize := 10pt#; + font_identifier := "Punk Nova" ; % dedicated to Don Knuth and Hermann Zapf + + ht# := 7pt# ; % height of characters + u# := 1/4pt# ; % unit width + % s# := 1.2pt# ; % extra sidebar + % s# := 0.1pt# ; % extra sidebar, needed because we use the bbox currently + s# := 0 ; % extra sidebar, ok +% s# := 1.2pt# ; % extra sidebar + px# := .6pt# ; % horizontal thickness of pen + py# := .5pt# ; % vertical thickness of pen + dot# := 1.3pt# ; % diameter of dots + dev# := .3pt# ; % standard deviation of punk points + + % dot# := .8pt# ; % diameter of dots + % px# := .3pt# ; % horizontal thickness of pen + % py# := .2pt# ; % vertical thickness of pen + + % seed := sqrt2 ; + % randomseed := seed ; + proofing := 0 ; + pt := .1pt ; + mag := scale_factor * 10 ; + bp_per_pixel := bpppix_ * mag ; + + define_pixels(u,dev) ; + define_blacker_pixels(px,py,dot) ; + define_whole_pixels(s) ; + xoffset := s ; + + pickup pencircle xscaled px yscaled py ; + punk_pen := savepen ; + pickup pencircle scaled dot ; + path dot_pen_path ; + dot_pen_path := tensepath makepath currentpen ; + + defaultcolormodel := 1 ; + + def beginpunkchar(expr c,n,h,v) = % code $c$; width is $n$ units + hdev := h * dev ; % modify horizontal amounts of deviation + vdev := v * dev ; % modify vertical amounts of deviation + beginchar(c,n*u#,ht#,0) ; + italcorr 0 ; + % italcorr ht#*slant; + pickup punk_pen + enddef ; + +% extra_endchar := extra_endchar & "w := w+2s ; charwd := charwd+2s# ;" ; +% extra_endchar := extra_endchar & "setbounds currentpicture to (0,-d)--(w*1.2,-d)--(w*1.2,h)--(0,h)--cycle;" ; + +% extra_endchar := extra_endchar & "w := w+2s ; " ; +% extra_endchar := extra_endchar & "w := 1.2w ; " ; +% extra_endchar := extra_endchar & "charwd := 1.2charwd ; " ; +% extra_endchar := extra_endchar & "setbounds currentpicture to (0,-d)--(w,-d)--(w,h)--(0,h)--cycle;" ; + +% todo: + +% extra_endchar := extra_endchar & +% "currentpicture := currentpicture shifted (0,1pt#) ; setbounds currentpicture to " & +% "llcorner currentpicture shifted ( 0,-1pt#) -- lrcorner currentpicture shifted ( 1pt#,-1pt#) -- " & +% "urcorner currentpicture shifted ( 1pt#, 1pt#) -- ulcorner currentpicture shifted ( 0, 1pt#) -- cycle ; " ; + + def ^ = + transformed currenttransform + enddef ; + + def makebox(text rule) = + for y=0, h : % horizontals + rule((-s,y)^,(w-s,y)^) ; + endfor + for x=-s, 0, w-2s, w-s : % verticals + rule((x,0)^,(x,h)^) ; + endfor + enddef ; + + rulepen := pensquare ; + + vardef pp expr z = + z + (hdev * normaldeviate, vdev * normaldeviate) + enddef; + + def pd expr z = % {\bf drawdot} + addto currentpicture contour dot_pen_path shifted z.t_ withpen penspeck + enddef; + + def initialize_punk_upper = + ht# := 7pt# ; dev# := .3pt# ; + enddef ; + def initialize_punk_lower = + sht# := ht#; sdev := dev; + ht# := .6ht# ; dev := .7dev ; + enddef ; + def revert_punk_lower = + ht# := sht#; dev := sdev; + enddef ; + +fi ; + + +initialize_punk_upper ; + +beginpunkchar("A",13,1,2); +z1=pp(1.5u,0); z2=(.5w,1.1h); z3=pp(w-1.5u,0); +pd z1; pd z3; draw z1--z2--z3; % left and right diagonals +z4=pp .3[z1,z2]; z5=pp .3[z3,z2]; pd z4; pd z5; draw z4--z5; % crossbar +endchar; + +beginpunkchar("B",12,1,1); +z1=pp(2u,0); z2=pp(2u,.6h); z3=pp(2u,h); pd z1; pd z3; draw z1--z3; % stem +z1.5=pp(w-u,.5y2); z2.5=pp(w-u,.5[y2,y3]); draw z2--z2.5--z3; % upper lobe +draw flex(z2,z1.5,z1); % lower lobe +endchar; + +beginpunkchar("C",13,1,2); +z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=(.6w,0); z5=(w-2u,.2h); +pd z1; pd z5; draw z1..z2..z3..z4..z5; % arc +endchar; + +beginpunkchar("D",14,1,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6h); +pd z1; pd z2; draw flex(z1,z3,z2); % lobe +draw z1--z2; % stem +endchar; + +beginpunkchar("E",12,.5,1); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2.5u,h); z4=pp(w-2u,0); +pd z3; pd z4; draw z4--z1--z2--z3; % stem and arms +z5=pp(2u,.6h); z6=pp(w-3u,.6h); pd z5; pd z6; draw z5--z6; % crossbar +endchar; + +beginpunkchar("F",12,.5,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,h); +pd z1; pd z3; draw z1--z2--z3; % stem and arm +z5=pp(2u,.6h); z6=pp(w-3u,.6h); z4=pp .5[z5,z6]-(0,.1h); +pd z5; pd z6; draw flex (z5,z4,z6); % crossbar +endchar; + +beginpunkchar("G",13,.5,.5); +z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=pp(.6w,0); z5=(w-2u,0); +pd z1; draw z1..z2..z3..z4---z5; % arc +z6=pp(.5[u,x5],.4h); pd z6; pd z5; draw z6--(pp(x5,y6))--z5; % spur +endchar; + +beginpunkchar("H",14,1,.5); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h); +z5=pp(2u,.6h); z6=pp(w-2u,.6h); +pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw flex(z3,z6,z4); % stems +pd z5; draw z5--z6; % crossbar +endchar; + +beginpunkchar("I",5,1,2); +z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h); +pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem +endchar; + +beginpunkchar("J",9,1,2); +z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0); +pd z1; pd z3; draw z1--z2--z3; % arc +endchar; + +beginpunkchar("K",14,1,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(2u,1/3h); z4=pp(w-1.5u,h); +pd z1; pd z2; draw z1--z2; % stem +pd z3; pd z4; draw z3--z4; % upper diagonal +z6=pp(w-u,0); z5=1/3[z3,z4]; +pd z6; draw flex(z5,.8[z1,2/3[z5,z6] ],z6);% lower diagonal +endchar; + +beginpunkchar("L",11,1,2); +z1=pp(2u,h); z2=pp(2u,0); z3=pp(w-1.5u,0); +pd z1; pd z3; draw z1--z2--z3; % stem and arm +endchar; + +beginpunkchar("M",17,.5,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(.5w,0); z4=pp(w-2u,h); z5=pp(w-2u,0); +pd z1; pd z5; draw z1--z2--z3--z4--z5; % stems and diagonals +endchar; + +beginpunkchar("N",13,.75,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h); +pd z1; pd z4; draw z1--z2--z3--z4; % stems and diagonals +endchar; + +beginpunkchar("O",12,.5,2); +z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); +pd z1; draw z1{left}..z2..z3..z4..z1; % bowl +endchar; + +beginpunkchar("P",13,1,2); +z1=pp(2u,0); z2=pp(2u,1.1h); z3=pp(2u,.5h); z4=pp(w,.6[y3,y2]); +pd z1; pd z3; draw z1--z2--z4--z3; % stem and bowl +endchar; + +beginpunkchar("Q",14,.5,2); +z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); +pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl +z5=pp(.4w,.2h); z6=pp(w-u,-.1h); z7=pp(.5[x5,x6],-.2h); +pd z5; pd z6; draw z5--z7--z6; % tail +endchar; + +beginpunkchar("R",16,1,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6[y2,y4]); z4=pp(2u,.5h); z5=pp(w-1.5u,0); +pd z1; pd z2; pd z5; draw z1--flex(z2,z3,z4)--z5; % stem, bowl, and diagonal +endchar; + +beginpunkchar("S",11,.3,1); +z1=pp(w-2u,.9h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.6[z6,z2]; +z5=pp(w-u,.35h); z6=pp(.5w,u); z7=pp(u,.2h); +pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % stroke +endchar; + +beginpunkchar("T",13,.75,2); +z1=pp(u,h); z2=pp(w-u,h); z3=pp(.5w,0); +pd z1; pd z2; pd z3; draw z1--z2; % arms +draw .5[z1,z2]--z3; % stem +endchar; + +beginpunkchar("U",13,.3,2); +z1=pp(2u,h); z2=pp(2u,.2h); z3=pp(.5w,0); z4=pp(w-2u,.2h); z5=pp(w-2u,h); +pd z1; pd z5; draw z1---z2...z3{z4-z2}...z4---z5; % stroke +endchar; + +beginpunkchar("V",13,1,2); +z1=pp(1.5u,h); z2=pp(.5w,0); z3=pp(w-1.5u,h); +pd z1; pd z3; draw z1--z2--z3; % diagonals +endchar; + +beginpunkchar("W",18,1,2); +z1=pp(1.5u,h); z2=pp(.5[x1,x3],0); z3=pp(.5w,.8h); z4=pp(.5[x3,x5],0); +z5=pp(w-1.5u,h); +pd z1; pd z5; draw z1--z2--z3--z4--z5; % diagonals +endchar; + +beginpunkchar("X",13,1,1); +z1=pp(1.5u,h); z2=pp(w-1.5u,0); z3=pp(1.5u,0); z4=pp(w-2.5u,h); +pd z1; pd z2; draw z1--z2; % main diagonal +pd z3; pd z4; draw z3--z4; % cross diagonal +endchar; + +beginpunkchar("Y",13,1,2); +z1=pp(1.5u,h); z2=pp(w-1.5u,h); z3=pp(.5w,.5h); z4=pp(.5w,0); +pd z1; pd z2; pd z4; draw z1--z3--z4; % stem and left diagonal +draw z2--z3; % right diagonal +endchar; + +beginpunkchar("Z",11,1,2); +z1=pp(1.5u,h); z2=pp(w-2.5u,h); z3=pp(1.5u,0); z4=pp(w-1.5u,0); +pd z1; pd z4; draw z1--z2--z3--z4; % diagonals +endchar; + +beginpunkchar(198,16,1,2); % \AE +z1=pp(1.5u,0); z2=pp(.6w,h); z3=pp(w-1.5u,h); +pd z1; pd z3; draw z1--z2--z3; % left diagonal and upper arm +z4=pp .3[z1,z2]; z5=pp(.6w,0); z6=pp(w-2u,.3h); +pd z4; pd z6; draw z4--z6; % crossbar +z7=pp(w-u,0); pd z2; pd z7; draw z2--z5--z7; % stem and lower arm +endchar; + +beginpunkchar(338,18,1,2); % \OE +z1=pp(.5w,h); z2=pp(u,.4h); z3=pp(.5w,0); +pd z1; draw z1..z2..{right}z3; % bowl +z4=pp(w-1.5u,h); z5=pp(w-2u,.4h); z6=pp(w-u,0); +pd z4; pd z6; draw z4--z1--z3--z6; % arms and stem +pd z5; draw z5--.4[z3,z1]; % crossbar +endchar; + +beginpunkchar(216,14,1,1); % \O +z1=pp(.5w,h); z2=pp(u,.5h); z3=pp(.5w,0); z4=pp(w-u,.5h); +z5=pp(w-2u,1.1h); z6=pp(2u,-.1h); +pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % bowl and diagonal +endchar; + +beginpunkchar(915,11,1,2); % $\Gamma$ +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-1.5u,h); +pd z1; pd z3; draw z1--z2--z3; % stem and arm +endchar; + +beginpunkchar(916,15,1,2); % $\Delta$ +z1=pp(u,0); z2=pp(.5w,h); z3=pp(w-u,0); +pd z1; draw z1--z2..tension 5..z3..tension 5..z1; % triangle +endchar; + +beginpunkchar(920,15,.5,2); % $\Theta$ +z1=pp(.5w,h); z2=pp(u,.6h); z3=pp(.5w,0); z4=pp(w-u,.6h); +pd z1; draw z1..tension.8..z2..z3..z4..tension.8..z1; % bowl +z5=pp(x2+2u,.4h); z6=pp(x4-2u,.4h); pd z5; pd z6; draw z5--z6; % bar +endchar; + +beginpunkchar(923,12,1,2); % $\Lambda$ +z1=pp(u,0); z2=pp(.5w,h); z3=pp(w-u,0); +pd z1; pd z3; draw z1--z2--z3; % diagonals +endchar; + +beginpunkchar(926,12,1,1); % $\Xi$ +z1=pp(u,h); z2=pp(w-u,h); pd z1; pd z2; draw z1--z2; % upper arm +z3=pp(2u,.55h); z4=pp(w-2u,.55h); pd z3; pd z4; draw z3--z4; % bar +z5=pp(u,0); z6=pp(w-u,0); pd z5; pd z6; draw z5--z6; % lower arm +endchar; + +beginpunkchar(928,13,1,.5); % $\Pi$ +z1=pp(1.5u,0); z2=pp(1.5u,h); z3=pp(w-1.5u,h); z4=pp(w-1.5u,0); +pd z1; pd z4; draw z1--z2--z3--z4; % stems and bar +endchar; + +beginpunkchar(930,13,1,1); % $\Sigma$ +z1=pp(w-u,h); z2=pp(u,h); z3=pp(.5w-u,.5h); z4=pp(u,0); z5=pp(w-u,0); +pd z1; pd z5; draw z1--z2{.5[z4,z5]-z2}..z3--z4--z5; % arms and diagonals +endchar; + +beginpunkchar(932,15,1,.5); % $\Upsilon$ +z1=pp(u,.8h); z2=pp(.3w,h); z3=pp(.5w,.5h); z4=pp(.5w,0); +pd z1; pd z4; draw z1..z2..tension2..z3---z4; % left arc and stem +z5=pp(w-u,.8h); z6=pp(.7w,h); +pd z5; draw z5..z6..tension2..{z4-z3}z3; % right arc +endchar; + +beginpunkchar(933,13,1,2); % $\Phi$ +z1=pp(.5w,h); z2=pp(.5w,0); pd z1; pd z2; draw z1--z2; % stem +z3=pp(.5w,2/3h); z4=pp(u,.5h); z5=pp(.5w,1/4h); z6=pp(w-u,.5h); +pd z3; draw z3..z4..z5..z6..z3; % bowl +endchar; + +beginpunkchar(936,14,1,1); % $\Psi$ +z1=pp(.5w,h); z2=pp(.5w,0); pd z1; pd z2; draw z1--z2; % stem +z3=pp(u,.8h); z4=pp(.5w,.2h); z5=pp(w-u,.8h); +pd z3; pd z5; draw z3{.4[z1,z2]-z3}..z4{right}..{z5-.4[z1,z2]}z5; % stroke +endchar; + +beginpunkchar(937,13,1,2); % $\Omega$ +z1=pp(u,0); z2=pp(1/3w,0); z3=pp(u,2/3h); z4=pp(.5w,h); +z5=pp(w-u,2/3h); z6=pp(2/3w,0); z7=pp(w-u,0); +pd z1; pd z7; draw z1--z2{up}..z3..z4..z5..{down}z6--z7; % bowl and arms +endchar; + +beginpunkchar(".",5,1,2); +pd pp(.5w,0); % dot +endchar; + +beginpunkchar(",",5,.5,.5); +z1=pp(.5w,0); z2=pp(w-u,-.1h); z3=pp(.5w,-.3h); +pd z1; pd z3; draw z1--z2--z3; % stroke +endchar; + +beginpunkchar(":",5,1,.5); +pd pp(.5w,0); pd pp(.5w,.4h); % dots +endchar; + +beginpunkchar(";",5,.5,.5); +z1=pp(.5w,0); z2=pp(w-u,-.1h); z3=pp(.5w,-.3h); +pd z1; pd z3; draw z1--z2--z3; % stroke +pd pp(.5w,.4h); % dot +endchar; + +beginpunkchar("!",5,.5,.5); +pd pp(.5w,0); % dot +z1=pp(.5w,1.05h); z2=pp(.5w,.3h); pd z1; pd z2; draw z1--z2; % stem +endchar; + +beginpunkchar(161,5,.5,.5); % spanish inverted ! +pd pp(.5w,.9h); % dot +z1=pp(.5w,-.1h); z2=pp(.5w,.6h); pd z1; pd z2; draw z1--z2; % stem +endchar; + +beginpunkchar("?",9,1,.5); +z1=pp(1.5u,.8h); z2=pp(.5w,h); z3=pp(w-u,.8h); z4=pp(.5w,.3h); +pd z1; pd z4; draw z1..z2..z3..{down}z4; % arc and stem +pd pp(.5w,0); % dot +endchar; + +beginpunkchar(191,9,1,.5); % spanish inverted ? +z1=pp(1.5u,.1h); z2=pp(.5w,-.1h); z3=pp(w-u,.1h); z4=pp(.5w,.6h); +pd z1; pd z4; draw z1..z2..z3..{up}z4; % arc and stem +pd pp(.5w,.9h); % dot +endchar; + +beginpunkchar("&",14,.5,.5); +z1=pp(w-2u,h); z2=pp(u,h); z3=pp(3u,0); z5=pp(w-u,.6h); z6=pp(w-2u,0); +pd z1; pd z5; draw z1--z2--z3--z5; % arms and stem +draw z1--.5[z2,z3]; pd z6; draw z6--.6[z3,z5]; % diagonals +endchar; + +beginpunkchar("$",12,.5,.5); +z1=pp(w-1.5u,.7h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.5[z3,z5]; +z5=pp(w-u,.3h); z6=pp(.5w,0); z7=pp(u,.3h); +pd z1; pd z7; draw z1..z2..z3..z4..z5..z6..z7; % stroke +z8=z2+(0,.1h); pd z8; draw z8--z6; % stem +endchar; + +beginpunkchar("%",18,.5,.5); +z1=pp(3.5u,1.1h); z2=pp(u,.8h); z3=pp(3.5u,.5h); z4=pp(6u,.8h); +z5=pp(w-3.5u,.5h); z6=pp(w-6u,.2h); z7=pp(w-3.5u,-.1h); z8=pp(w-u,.2h); +pd z1; draw z1..z2..z3..z4..z1; % upper bowl +pd z5; draw z5..z6..z7..z8..z5; % lower bowl +z9=pp(w-3u,1.1h); z0=pp(3u,-.1h); pd z0; draw z9--z0; % diagonal +draw z1{z5-z1}..z9; % link +endchar; + +beginpunkchar("@",18,1,.5); +z1=pp(2u,0); z2=pp(1/3w,.7h); z3=pp(w-6u,0); +z4=pp(w,.3h); z5=pp(1/3w,h); z6=pp(u,.5h); z7=.7[z2,z3]; +pd z1; pd z7; draw z1--z2--z3{right}..z4..z5..z6..z7; % diagonals and stroke +endchar; + +beginpunkchar("-",7,.5,.5); +z1=pp(u,.4h); z2=pp(w-u,.5h); pd z1; pd z2; draw z1--z2; % bar +endchar; + +beginpunkchar(8211,9,.5,.5); % -- +z1=pp(0,.5h); z2=pp(w,.4h); pd z1; pd z2; draw z1--z2; % bar +endchar; + +beginpunkchar(8212,18,.5,.5); % --- +z1=pp(0,.5h); z2=pp(w,.4h); pd z1; pd z2; draw z1--z2; % bar +endchar; + +beginpunkchar("+",9,.5,1); +z1=pp(0,.5h); z2=pp(w,.5h); pd z1; pd z2; draw z1--z2; % bar +z3=pp(.5w,.1h); z4=pp(.5w,.9h); pd z3; pd z4; draw z3--z4; % stem +endchar; + +beginpunkchar("*",13,.5,1); +z0=pp(.5w,1.1h); z1=pp(u,.9h); z2=pp(2u,.3h); z3=pp(w-u,.3h); z4=pp(w-u,.9h); +pd z0; draw z0--z2..1/3[.5[z2,z4],z0]..z4--z1--z3--z0; % star +endchar; + +beginpunkchar(39,5,.5,1.5); % ' apostrofe HH/TH (to be checked) +z1=pp(w/2,h); z2=pp(w/2+u,.85h); z3=pp(w/2,2/3h); +pd z1; pd z3; draw z1..z2..z3; % stroke +endchar; + +beginpunkchar(34,9,1,1.5); % " HH/TH (to be checked) +z1=pp(1.5u,h); z2=pp(1.5u,.6h); z3=pp(w-1.5u,h); z4=pp(w-1.5u,.6h); +pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw z3--z4; +endchar; + +beginpunkchar(8216,5,.3,.5); % ` +z1=pp(w-1.5u,h); z2=pp(u,.85h); z3=pp(w-u,2/3h); +pd z1; pd z3; draw z1--z2--z3; % stroke +endchar; + +beginpunkchar(8217,5,.3,.5); % ' +z1=pp(1.5u,h); z2=pp(w-u,.85h); z3=pp(u,2/3h); +pd z1; pd z3; draw z1--z2--z3; % stroke +endchar; + +beginpunkchar(8220,9,.3,.5); % `` quotedblleft +z1=pp(.5w+.5u,h); z2=pp(w-u,.6h); z3=pp(u,.95h); +pd z1; pd z3; draw z1--z2--z3; % stroke +endchar; + +beginpunkchar(8221,9,.3,.5); % '' quotedblright +z1=pp(.5w-.5u,h); z2=pp(u,.6h); z3=pp(w-u,.95h); +pd z1; pd z3; draw z1--z2--z3; % stroke +endchar; + +beginpunkchar("(",7,.5,.5); +z1=pp(w-u,h); z2=pp(u,.5h); z3=pp(w-u,0); +pd z1; pd z3; draw z1..z2..z3; % stroke +endchar; + +beginpunkchar(")",7,.5,.5); +z1=pp(u,h); z2=pp(w-u,.5h); z3=pp(u,0); pd z1; pd z3; draw z1..z2..z3; % stroke +endchar; + +beginpunkchar("[",8,.5,.5); +z1=pp(w-u,h); z2=pp(.5w,h); z3=pp(.5w,0); z4=pp(w-u,0); +pd z1; pd z4; draw z1--z2--z3--z4; % bars and stem +endchar; + +beginpunkchar("]",8,.5,.5); +z1=pp(u,h); z2=pp(.5w,h); z3=pp(.5w,0); z4=pp(u,0); +pd z1; pd z4; draw z1--z2--z3--z4; % bars and stem +endchar; + +beginpunkchar("<",9,.5,.5); +z1=pp(w-u,.9h); z2=pp(u,.5h); z3=pp(w-u,.1h); +pd z1; pd z3; draw z1--z2--z3; % diagonals +endchar; + +beginpunkchar(">",9,.5,.5); +z1=pp(u,.9h); z2=pp(w-u,.5h); z3=pp(u,.1h); +pd z1; pd z3; draw z1--z2--z3; % diagonals +endchar; + +beginpunkchar("{",10,.5,.5); % HH/TH +z1=pp(w-2u,h); z3=pp(2u,.5h); z5=pp(w-2u,0); +z2=pp(w-4u,.6h); z4=(w-4u,.4h); +pd z1; pd z3; pd z5; draw z1{left}..z2--z3 & z3--z4..{right}z5; +endchar; + +beginpunkchar("}",10,.5,.5); % HH/TH +z1=pp(2u,h); z3=pp(w-2u,.5h); z5=pp(2u,0); +z2=pp(4u,.6h); z4=(4u,.4h); +pd z1; pd z3; pd z5; draw z1{right}..z2--z3 & z3--z4..{left}z5; +endchar; + +beginpunkchar("=",9,.5,.5); +z5=pp(u,2/3h); z6=pp(w-u,2/3h); pd z5; pd z6; draw z5--z6; % upper bar +z7=pp(u,1/3h); z8=pp(w-u,1/3h); pd z7; pd z8; draw z7--z8; % lower bar +endchar; + +beginpunkchar("#",15,.5,.5); +z1=pp(.5w,h); z2=pp(3u,0); z3=pp(w-3u,h); z4=pp(.5w,0); +pd z2; pd z3; draw z3--z1--z2; draw z3--z4--z2; % diagonals (linked) +z5=pp(u,2/3h); z6=pp(w-u,2/3h); pd z5; pd z6; draw z5--z6; % upper bar +z7=pp(u,1/3h); z8=pp(w-u,1/3h); pd z7; pd z8; draw z7--z8; % lower bar +endchar; + +beginpunkchar("/",9,1,1); +z1=pp(1.5u,-.05h); z2=pp(w-1.5u,1.05h); pd z1; pd z2; draw z1--z2; % diagonal +endchar; + +beginpunkchar("\",9,1,1); % HH/TH +z1=pp(1.5u,1.05h); z2=pp(w-1.5u,-.05h); pd z1; pd z2; draw z1--z2; % reverse diagonal +endchar; + + +beginpunkchar("0",9,.5,1); +z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); +pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl +endchar; + +beginpunkchar("1",9,.3,1); +z1=pp(2u,.7h); z2=pp(.6w,h); z3=pp(.6w,0); +pd z1; pd z3; draw z1--z2--z3; % serif and stem +endchar; + +beginpunkchar("2",9,1,1); +z1=pp(2u,.7h); z2=pp(.5w,h); z3=pp(w-u,.6h); z4=pp(u,0); z5=pp(w-2u,0); +pd z1; pd z5; draw z1..z2..z3..z4--z5; % stroke +endchar; + +beginpunkchar("3",9,.5,.5); +z1=pp(2u,.7h); z2=pp(.5w,h); z3=pp(w-u,.5[y2,y4]); +z4=pp(.5w-u,.55h); z5=pp(w-u,.5[y4,y6]); z6=pp(.5w,0); z7=pp(1.5u,.2h); +pd z1; pd z7; draw z1..z2..z3..z4&z4..z5..z6..z7; % arcs +endchar; + +beginpunkchar("4",9,1,1); +z1=pp(w-u,.3h); z2=pp(u,.3h); z3=pp(2/3w,h); z4=pp(2/3w,0); +pd z1; pd z4; draw z1--z2--z3--z4; % stem and diagonals +endchar; + +beginpunkchar("5",9,.5,.5); +z1=pp(w-2u,h); z2=pp(2u,h); z3=pp(u,.7h); z4=pp(w-u,.5[y3,y5]); +z5=pp(.5w,0); z6=pp(u,.2h); +pd z1; pd z6; draw z1--z2--z3..z4..z5..z6; % stroke +endchar; + +beginpunkchar("6",9,1,1); +z1=pp(2/3w,h); z2=pp(u,.3h); z3=pp(.5w,0); z4=pp(w-u,.3h); z5=pp(.6w,.6h); +z6=pp z2; pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % stroke +endchar; + +beginpunkchar("7",9,.5,1); +z1=pp(2u,h); z2=pp(w-.5u,h); z3=pp(.4w,0); +pd z1; pd z3; draw z1--z2&z2..z3{down}; % stroke +endchar; + +beginpunkchar("8",9,.5,.5); +z1=pp(.5w,h); z2=pp(u,.5[y1,y3]); z3=pp(.5w,.6h); z4=pp(w-u,.5[y3,y5]); +z5=pp(.5w,0); z6=pp(u,.5[y5,y3]); z7=pp(w-u,.5[y1,y3]); +pd z1; draw z1{curl 8}..z2..z3..z4..z5..z6..z3..z7..z1; % stroke +endchar; + +beginpunkchar("9",9,1,1); +z1=pp(1/3w,0); z2=pp(w-u,.7h); z3=pp(.5w,h); z4=pp(u,.7h); z5=pp(.5w,.4h); +pd z1; pd z5; draw z1..z2..z3..z4..z5; % stroke +endchar; + +beginpunkchar(96,9,1,1); % \`{} grave +z1=pp(2.5u,h); z2=pp(.6w,.8h); pd z1; pd z2; draw z1--z2; % diagonal +endchar; + +beginpunkchar(180,9,1,1); % \'{} acute +z1=pp(w-2.5u,h); z2=pp(.4w,.8h); pd z1; pd z2; draw z1--z2; % diagonal +endchar; + +beginpunkchar(710,13,1,1); % \^{} circumflex +z1=pp(2.5u,.8h); z2=pp(.5w,h); z3=(w-2.5u,.8h); +pd z1; pd z3; draw z1--z2--z3; % diagonals +endchar; + +beginpunkchar(711,13,1,1); % \v{} caron +z1=pp(2.5u,.9h); z2=pp(.5w,.7h); z3=pp(w-2.5u,.9h); +pd z1; pd z3; draw z1--z2--z3; % diagonals +endchar; + +beginpunkchar(728,11,1,1); % \u{} breve +z1=pp(2u,h); z2=pp(.5w,.75h); z3=pp(w-2u,h); +pd z1; pd z3; draw flex(z1,z2,z3); % stroke +endchar; + +beginpunkchar(175,12,1,1); % \={} macron +z1=pp(u,.8h); z2=pp(w-u,.8h); pd z1; pd z2; draw z1--z2; % bar +endchar; + +beginpunkchar(729,5,1,1); % \.{} +pd pp(.5w,.9h); % dot +endchar; + +beginpunkchar(168,13,1,1); % \"{} diaeresis +pd pp(1/5w,.9h); pd pp(4/5w,.9h); % dots +endchar; + +beginpunkchar(732,13,1,1); % \~{} tilde +z1=pp(u,.75h); z2=pp(w-u,.9h); pd z1; pd z2; draw z1{up}..{up}z2; % stroke +endchar; + +beginpunkchar(733,13,1,1); % \H{} hungarumlaut +z1=pp(4u,h); z2=pp(2.5u,.7h); z3=pp(w-2u,h); z4=pp(w-3.5u,.7h); +pd z1; pd z3; draw z1--z2--z4--z3; % diagonals (linked) +endchar; + +beginpunkchar(730,13,0,0); % Scandinavian loop, for \AA\ and \aa (ring) +z0=(.5w,.66h); % point $z^2$ of lowercase A +z1=(.5w,.9h); draw z0{z0-(1.5u,0)}..z1..{(w-1.5u,0)-z0}z0; % loop +endchar; + +beginpunkchar(184,13,.5,.5); % Cedilla, for \c c +z1=(.6w,0); z2=pp(.6w,-.1h); z3=pp(2.5u,-.1h); +pd z3; draw z1--z2--z3; % stroke +endchar; + +initialize_punk_lower ; + +beginpunkchar(305,5,1,2); % dotless I +z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h); +pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem +endchar; + +beginpunkchar(567,9,1,2); % dotless J +z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0); +pd z1; pd z3; draw z1--z2--z3; % arc +endchar; + +beginpunkchar(223,18,.3,1); % German SS +z1=pp(.5w-u,.9h); z2=pp(1/3w,h); z3=pp(u,.7h); z4=.6[z6,z2]; +z5=pp(.5w,.35h); z6=pp(1/3w,u); z7=pp(u,.2h); +pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % left stroke +for i=1 upto 7: z[i+10]=pp(z[i] shifted (.5w-u,0)); endfor +pd z11; pd z17; draw z11--z12...z13..z14..z15...z16--z17; % right stroke +endchar; + +beginpunkchar("a",13,1,2); +z1=pp(1.5u,0); z2=(.5w,1.1h); z3=pp(w-1.5u,0); +pd z1; pd z3; draw z1--z2--z3; % left and right diagonals +z4=pp .3[z1,z2]; z5=pp .3[z3,z2]; pd z4; pd z5; draw z4--z5; % crossbar +endchar; + +beginpunkchar("b",12,1,1); +z1=pp(2u,0); z2=pp(2u,.6h); z3=pp(2u,h); pd z1; pd z3; draw z1--z3; % stem +z1.5=pp(w-u,.5y2); z2.5=pp(w-u,.5[y2,y3]); draw z2--z2.5--z3; % upper lobe +draw flex(z2,z1.5,z1); % lower lobe +endchar; + +beginpunkchar("c",13,1,2); +z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=(.6w,0); z5=(w-2u,.2h); +pd z1; pd z5; draw z1..z2..z3..z4..z5; % arc +endchar; + +beginpunkchar("d",14,1,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6h); +pd z1; pd z2; draw flex(z1,z3,z2); % lobe +draw z1--z2; % stem +endchar; + +beginpunkchar("e",12,.5,1); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2.5u,h); z4=pp(w-2u,0); +pd z3; pd z4; draw z4--z1--z2--z3; % stem and arms +z5=pp(2u,.6h); z6=pp(w-3u,.6h); pd z5; pd z6; draw z5--z6; % crossbar +endchar; + +beginpunkchar("f",12,.5,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,h); +pd z1; pd z3; draw z1--z2--z3; % stem and arm +z5=pp(2u,.6h); z6=pp(w-3u,.6h); z4=pp .5[z5,z6]-(0,.1h); +pd z5; pd z6; draw flex (z5,z4,z6); % crossbar +endchar; + +beginpunkchar("g",13,.5,.5); +z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=pp(.6w,0); z5=(w-2u,0); +pd z1; draw z1..z2..z3..z4---z5; % arc +z6=pp(.5[u,x5],.4h); pd z6; pd z5; draw z6--(pp(x5,y6))--z5; % spur +endchar; + +beginpunkchar("h",14,1,.5); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h); +z5=pp(2u,.6h); z6=pp(w-2u,.6h); +pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw flex(z3,z6,z4); % stems +pd z5; draw z5--z6; % crossbar +endchar; + +beginpunkchar("i",5,1,2); +z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h); +pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem +endchar; + +beginpunkchar("j",9,1,2); +z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0); +pd z1; pd z3; draw z1--z2--z3; % arc +endchar; + +beginpunkchar("k",14,1,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(2u,1/3h); z4=pp(w-1.5u,h); +pd z1; pd z2; draw z1--z2; % stem +pd z3; pd z4; draw z3--z4; % upper diagonal +z6=pp(w-u,0); z5=1/3[z3,z4]; +pd z6; draw flex(z5,.8[z1,2/3[z5,z6] ],z6);% lower diagonal +endchar; + +beginpunkchar("l",11,1,2); +z1=pp(2u,h); z2=pp(2u,0); z3=pp(w-1.5u,0); +pd z1; pd z3; draw z1--z2--z3; % stem and arm +endchar; + +beginpunkchar("m",17,.5,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(.5w,0); z4=pp(w-2u,h); z5=pp(w-2u,0); +pd z1; pd z5; draw z1--z2--z3--z4--z5; % stems and diagonals +endchar; + +beginpunkchar("n",13,.75,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h); +pd z1; pd z4; draw z1--z2--z3--z4; % stems and diagonals +endchar; + +beginpunkchar("o",12,.5,2); +z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); +pd z1; draw z1{left}..z2..z3..z4..z1; % bowl +endchar; + +beginpunkchar("p",13,1,2); +z1=pp(2u,0); z2=pp(2u,1.1h); z3=pp(2u,.5h); z4=pp(w,.6[y3,y2]); +pd z1; pd z3; draw z1--z2--z4--z3; % stem and bowl +endchar; + +beginpunkchar("q",14,.5,2); +z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); +pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl +z5=pp(.4w,.2h); z6=pp(w-u,-.1h); z7=pp(.5[x5,x6],-.2h); +pd z5; pd z6; draw z5--z7--z6; % tail +endchar; + +beginpunkchar("r",16,1,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6[y2,y4]); z4=pp(2u,.5h); z5=pp(w-1.5u,0); +pd z1; pd z2; pd z5; draw z1--flex(z2,z3,z4)--z5; % stem, bowl, and diagonal +endchar; + +beginpunkchar("s",11,.3,1); +z1=pp(w-2u,.9h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.6[z6,z2]; +z5=pp(w-u,.35h); z6=pp(.5w,u); z7=pp(u,.2h); +pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % stroke +endchar; + +beginpunkchar("t",13,.75,2); +z1=pp(u,h); z2=pp(w-u,h); z3=pp(.5w,0); +pd z1; pd z2; pd z3; draw z1--z2; % arms +draw .5[z1,z2]--z3; % stem +endchar; + +beginpunkchar("u",13,.3,2); +z1=pp(2u,h); z2=pp(2u,.2h); z3=pp(.5w,0); z4=pp(w-2u,.2h); z5=pp(w-2u,h); +pd z1; pd z5; draw z1---z2...z3{z4-z2}...z4---z5; % stroke +endchar; + +beginpunkchar("v",13,1,2); +z1=pp(1.5u,h); z2=pp(.5w,0); z3=pp(w-1.5u,h); +pd z1; pd z3; draw z1--z2--z3; % diagonals +endchar; + +beginpunkchar("w",18,1,2); +z1=pp(1.5u,h); z2=pp(.5[x1,x3],0); z3=pp(.5w,.8h); z4=pp(.5[x3,x5],0); +z5=pp(w-1.5u,h); +pd z1; pd z5; draw z1--z2--z3--z4--z5; % diagonals +endchar; + +beginpunkchar("x",13,1,1); +z1=pp(1.5u,h); z2=pp(w-1.5u,0); z3=pp(1.5u,0); z4=pp(w-2.5u,h); +pd z1; pd z2; draw z1--z2; % main diagonal +pd z3; pd z4; draw z3--z4; % cross diagonal +endchar; + +beginpunkchar("y",13,1,2); +z1=pp(1.5u,h); z2=pp(w-1.5u,h); z3=pp(.5w,.5h); z4=pp(.5w,0); +pd z1; pd z2; pd z4; draw z1--z3--z4; % stem and left diagonal +draw z2--z3; % right diagonal +endchar; + +beginpunkchar("z",11,1,2); +z1=pp(1.5u,h); z2=pp(w-2.5u,h); z3=pp(1.5u,0); z4=pp(w-1.5u,0); +pd z1; pd z4; draw z1--z2--z3--z4; % diagonals +endchar; + +beginpunkchar(230,16,1,2); % \ae +z1=pp(1.5u,0); z2=pp(.6w,h); z3=pp(w-1.5u,h); +pd z1; pd z3; draw z1--z2--z3; % left diagonal and upper arm +z4=pp .3[z1,z2]; z5=pp(.6w,0); z6=pp(w-2u,.3h); +pd z4; pd z6; draw z4--z6; % crossbar +z7=pp(w-u,0); pd z2; pd z7; draw z2--z5--z7; % stem and lower arm +endchar; + +beginpunkchar(339,18,1,2); % \oe +z1=pp(.5w,h); z2=pp(u,.4h); z3=pp(.5w,0); +pd z1; draw z1..z2..{right}z3; % bowl +z4=pp(w-1.5u,h); z5=pp(w-2u,.4h); z6=pp(w-u,0); +pd z4; pd z6; draw z4--z1--z3--z6; % arms and stem +pd z5; draw z5--.4[z3,z1]; % crossbar +endchar; + +beginpunkchar(248,14,1,1); % \o +z1=pp(.5w,h); z2=pp(u,.5h); z3=pp(.5w,0); z4=pp(w-u,.5h); +z5=pp(w-2u,1.1h); z6=pp(2u,-.1h); +pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % bowl and diagonal +endchar; + +revert_punk_lower; + +beginpunkchar("_",12,.5,.5); % _ +z1=pp(0,-.2h); z2=pp(w,-.2h); pd z1; pd z2; draw z1--z2; % bar +endchar; + +beginpunkchar("^",12,1,.5); % +z1=pp(.5w,h); z2=pp(1.5u,.6h); z3=pp(w-1.5u,.6h); +pd z2; pd z3; draw z2--z1--z3; +endchar; diff --git a/scripts/context/lua/luatools.lua b/scripts/context/lua/luatools.lua index aacdbd16d..f0fcd517d 100644 --- a/scripts/context/lua/luatools.lua +++ b/scripts/context/lua/luatools.lua @@ -6657,7 +6657,7 @@ logs.setprogram('LuaTools',"TDS Management Tool 1.31",environment.arguments["ver local instance = resolvers.reset() -resolvers.defaultlibs = { -- not all are needed +resolvers.defaultlibs = { -- not all are needed (this will become: context.lus (lua spec) 'l-string.lua', 'l-lpeg.lua', 'l-table.lua', diff --git a/scripts/context/ruby/texexec.rb b/scripts/context/ruby/texexec.rb index a549659ef..94b14e428 100644 --- a/scripts/context/ruby/texexec.rb +++ b/scripts/context/ruby/texexec.rb @@ -1,3 +1,6 @@ +#!/usr/bin/env ruby +#encoding: ASCII-8BIT + banner = ['TeXExec', 'version 6.2.1', '1997-2009', 'PRAGMA ADE/POD'] $: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! diff --git a/scripts/context/ruby/texmfstart.rb b/scripts/context/ruby/texmfstart.rb index 4976f7fd0..97087c3ae 100644 --- a/scripts/context/ruby/texmfstart.rb +++ b/scripts/context/ruby/texmfstart.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +#encoding: ASCII-8BIT # We have removed the fast, server and client variants and no longer # provide the distributed 'serve trees' option. After all, we're now diff --git a/scripts/context/stubs/mswin/luatools.lua b/scripts/context/stubs/mswin/luatools.lua index aacdbd16d..f0fcd517d 100644 --- a/scripts/context/stubs/mswin/luatools.lua +++ b/scripts/context/stubs/mswin/luatools.lua @@ -6657,7 +6657,7 @@ logs.setprogram('LuaTools',"TDS Management Tool 1.31",environment.arguments["ver local instance = resolvers.reset() -resolvers.defaultlibs = { -- not all are needed +resolvers.defaultlibs = { -- not all are needed (this will become: context.lus (lua spec) 'l-string.lua', 'l-lpeg.lua', 'l-table.lua', diff --git a/scripts/context/stubs/unix/luatools b/scripts/context/stubs/unix/luatools index aacdbd16d..f0fcd517d 100755 --- a/scripts/context/stubs/unix/luatools +++ b/scripts/context/stubs/unix/luatools @@ -6657,7 +6657,7 @@ logs.setprogram('LuaTools',"TDS Management Tool 1.31",environment.arguments["ver local instance = resolvers.reset() -resolvers.defaultlibs = { -- not all are needed +resolvers.defaultlibs = { -- not all are needed (this will become: context.lus (lua spec) 'l-string.lua', 'l-lpeg.lua', 'l-table.lua', diff --git a/tex/context/base/back-pdf.mkiv b/tex/context/base/back-pdf.mkiv index c635f1c3b..2d3ba8524 100644 --- a/tex/context/base/back-pdf.mkiv +++ b/tex/context/base/back-pdf.mkiv @@ -161,7 +161,7 @@ \def\predefinesymbol[#1]% {\begingroup - \setobject{SYM}{#1}\hbox{\symbol[#1]}% + \settightobject{SYM}{#1}\hbox{\symbol[#1]}% to be checked ... maybe only fitting \dogetobjectreference{SYM}{#1}\lastref \ctxlua{backends.codeinjections.registersymbol("#1",\lastref)}% \endgroup} diff --git a/tex/context/base/java-fld.tex b/tex/context/base/java-fld.tex index 4fdf41ce4..3c24b7e02 100644 --- a/tex/context/base/java-fld.tex +++ b/tex/context/base/java-fld.tex @@ -144,7 +144,6 @@ function Do_Vide_Field ( Name, Closable ) { ++visible_fields ; visible_field[visible_fields] = Name ; v.hidden = false ; - % v.display = display.visible ; if (Closable) { v.readonly = false ; v.value = "On" } diff --git a/tex/context/base/java-ini.lua b/tex/context/base/java-ini.lua index 0fe7d3d29..6dc789e71 100644 --- a/tex/context/base/java-ini.lua +++ b/tex/context/base/java-ini.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['java-ini'] = { license = "see context related readme files" } +local format = string.format + javascripts = javascripts or { } javascripts.codes = javascripts.codes or { } javascripts.preambles = javascripts.preambles or { } @@ -96,7 +98,9 @@ function javascripts.code(name,arguments) end local f = functions[name] if f then - return string.format("%s(%s)",name,arguments or "") + -- temporary hack, i need a more clever approach + arguments = '"' .. arguments.gsub(arguments,'%s*,%s*','"%1",') .. '"' + return format("%s(%s)",name,arguments or "") end end diff --git a/tex/context/base/lpdf-fld.lua b/tex/context/base/lpdf-fld.lua index b9c63347f..6bdfdd36c 100644 --- a/tex/context/base/lpdf-fld.lua +++ b/tex/context/base/lpdf-fld.lua @@ -73,6 +73,8 @@ local plus = { AutoView = 256, -- 288 (6+9) } +-- todo: check what is interfaced + flag.readonly = flag.ReadOnly flag.required = flag.Required flag.protected = flag.Password @@ -86,7 +88,7 @@ plus.hidden = plus.Hidden plus.printable = plus.Printable plus.auto = plus.AutoView --- some day .. lpeg with function +-- some day .. lpeg with function or table local function fieldflag(specification) local o, n = specification.options, 0 @@ -101,7 +103,7 @@ end local function fieldplus(specification) local o, n = specification.options, 0 if o and o ~= "" then - for p in gmatch(o,"[^, ]") do + for p in gmatch(o,"[^, ]+") do n = n + (plus[p] or 0) end end @@ -117,11 +119,12 @@ local function checked(what) end local function fieldactions(specification) -- share actions +--~ print(table.serialize(specification)) local d, a = { }, nil a = specification.mousedown if a and a ~= "" then d.D = checked(a) end a = specification.mouseup if a and a ~= "" then d.U = checked(a) end - a = specification.enterregion if a and a ~= "" then d.E = checked(a) end - a = specification.exitregion if a and a ~= "" then d.X = checked(a) end + a = specification.regionin if a and a ~= "" then d.E = checked(a) end -- Enter + a = specification.regionout if a and a ~= "" then d.X = checked(a) end -- eXit a = specification.afterkeystroke if a and a ~= "" then d.K = checked(a) end a = specification.formatresult if a and a ~= "" then d.F = checked(a) end a = specification.validateresult if a and a ~= "" then d.V = checked(a) end @@ -218,9 +221,8 @@ local function fieldappearances(specification) return lpdf.sharedobj(tostring(appearance)) end -local function fieldstates(specification) - -- splitter not needed, wil go - -- todo: caching +local function fieldstates(specification,forceyes) + -- we don't use Opt here (too messy for radio buttons) local values, default = specification.values, specification.default if not values then -- error @@ -263,15 +265,16 @@ local function fieldstates(specification) if not offvalue then offvalue = offn end + forceyes = forceyes and "On" -- spec likes Yes more but we've used On for ages now if default == yesn then - default = pdfconstant(yesn) + default = pdfconstant(forceyes or yesn) else default = pdfconstant("Off") end - local appearance = pdfdictionary { -- mayeb also cache components - N = pdfdictionary { [yesn] = registeredsymbol(yesn), Off = registeredsymbol(offn) }, - R = pdfdictionary { [yesr] = registeredsymbol(yesr), Off = registeredsymbol(offr) }, - D = pdfdictionary { [yesd] = registeredsymbol(yesd), Off = registeredsymbol(offd) } + local appearance = pdfdictionary { -- maybe also cache components + N = pdfdictionary { [forceyes or yesn] = registeredsymbol(yesn), Off = registeredsymbol(offn) }, + R = pdfdictionary { [forceyes or yesr] = registeredsymbol(yesr), Off = registeredsymbol(offr) }, + D = pdfdictionary { [forceyes or yesd] = registeredsymbol(yesd), Off = registeredsymbol(offd) } } local appearanceref = lpdf.sharedobj(tostring(appearance)) return appearanceref, default @@ -630,14 +633,15 @@ function methods.combo(name,specification) methods.choice(name,specification,"PopUp,Edit") end --- probably no default appearance needed for first kid +-- Probably no default appearance needed for first kid and no javascripts for the +-- parent ... I will look into it when I have to make a complex document. function methods.check(name,specification) -- no /Opt because (1) it's messy - see pdf spec, (2) it discouples kids and -- contrary to radio there is no way to associate then local field = fields[name] local kind = field.kind - local appearance, default = fieldstates(field) + local appearance, default = fieldstates(field,true) if not field.pobj then local d = pdfdictionary { Subtype = pdf_widget, diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index 1b099ed9b..753b09180 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -168,7 +168,7 @@ local tostring_z = function() return "null" end local tostring_t = function() return "true" end local tostring_f = function() return "false" end local tostring_r = function(t) return t[1] .. " 0 R" end -local tostring_v = function(t) return concat(t, "") end +local tostring_v = function(t) return concat(t[1],"") end local function value_x(t) return t end -- the call is experimental local function value_s(t,key) return t[1] end -- the call is experimental diff --git a/tex/context/base/lpdf-mis.lua b/tex/context/base/lpdf-mis.lua index 87230aff2..e3ed8919d 100644 --- a/tex/context/base/lpdf-mis.lua +++ b/tex/context/base/lpdf-mis.lua @@ -71,11 +71,11 @@ lpdf.registerdocumentfinalizer(initializeoverprint) function codeinjections.addtransparencygroup() -- png: /CS /DeviceRGB /I true - local d = tostring ( pdfdictionary { + local d = pdfdictionary { S = pdfconstant("Transparency"), I = true, K = true, - } ) + } lpdf.registerpagefinalizer(function() lpdf.addtopageattributes("Group",d) end) end diff --git a/tex/context/base/lpdf-wid.lua b/tex/context/base/lpdf-wid.lua index cc61a4f96..c87192b3a 100644 --- a/tex/context/base/lpdf-wid.lua +++ b/tex/context/base/lpdf-wid.lua @@ -241,7 +241,7 @@ local function insertrenderingwindow(label,width,height,specification) AA = actions, } local r = pdfreserveobj("annot") - node.write(nodes.pdfannot(label,width,height,d(),r)) -- save ref + node.write(nodes.pdfannot(width,height,0,d(),r)) -- save ref return pdfreference(r) end diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv index 494e4f0b7..34a14f9d9 100644 --- a/tex/context/base/lxml-ini.mkiv +++ b/tex/context/base/lxml-ini.mkiv @@ -109,7 +109,7 @@ \let\xmlgrab\xmlsetsetup \def\xmlsetup#1#2% % we pass the reference so that we have access to the frozen number - {\def\xmlself{#1}% % by using #1 inside a setup + {\def\xmlself{#1}% % by using #1 inside a setup; maybe self becomes obsolete \setupwithargument{#2}{#1}} \newtoks \registeredxmlsetups diff --git a/tex/context/base/m-punk.tex b/tex/context/base/m-punk.tex new file mode 100644 index 000000000..3b1baa75b --- /dev/null +++ b/tex/context/base/m-punk.tex @@ -0,0 +1,232 @@ +%D \module +%D [ file=m-punk, +%D version=2008.04.15, +%D title=\CONTEXT\ Modules, +%D subtitle=Punk Support, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\ifx\luaversion\undefined \endinput \fi + +% At some point the font generation code will move into the +% ConTeXt MkIV kernel. + +\startluacode +do + local concat = table.concat + local chardata = characters.data + local fontdata = fonts.ids + + fonts.mp = fonts.mp or { } + + fonts.mp.version = fonts.mp.version or 1.11 + fonts.mp.inline = true + fonts.mp.cache = containers.define("fonts", "mp", fonts.mp.version, true) + + metapost.characters = metapost.characters or { } + +-- todo: use table share as in otf + + local characters, descriptions = { }, { } + local factor, l, n, w, h, d, total, variants = 100, { }, 0, 0, 0, 0, 0, 0, true + + -- A next version of mplib will provide the tfm font information which + -- gives better glyph dimensions, plus additional kerning information. + + local flusher = { + startfigure = function(chrnum,llx,lly,urx,ury) + l, n = { }, chrnum + w, h, d = urx - llx, ury, -lly + total = total + 1 + inline = fonts.mp.inline + end, + flushfigure = function(t) + for i=1, #t do + l[#l+1] = t[i] + end + end, + stopfigure = function() + local cd = chardata[n] + if inline then + descriptions[n] = { + -- unicode = n, + name = cd and cd.adobename, + width = w*100, + height = h*100, + depth = d*100, + boundingbox = { 0, -d, w, h }, + } + characters[n] = { + commands = { -- todo: xforms, should happen in backend + { "special", "pdf: " .. concat(l," ") }, + } + } + else + descriptions[n] = { + -- unicode = n, + name = cd and cd.adobename, + width = w*100, + height = h*100, + depth = d*100, + boundingbox = { 0, -d, w, h }, + } + characters[n] = { + commands = { + { "image", { stream = concat(l," "), bbox = { 0, -d*65536, w*65536, h*65536 } } }, + } + } + end + end + } + + metapost.characters.instances = metapost.characters.instances or 10 + + function metapost.characters.process(mpxformat, name, instances, scalefactor) + statistics.starttiming(metapost.characters) + scalefactor = scalefactor or 1 + instances = instances or metapost.characters.instances or 10 + local fontname = file.removesuffix(file.basename(name)) + local hash = file.robustname(string.format("%s %05i %03i", fontname, scalefactor*1000, instances)) + local lists = containers.read(fonts.mp.cache(), hash) + if not lists then + statistics.starttiming(flusher) + -- we can use a format per font + local data = io.loaddata(resolvers.find_file(name)) + metapost.reset(mpxformat) + metapost.set_outer_color(2) -- no outer color and no reset either + lists = { } + for i=1,instances do + list = { } + characters, descriptions = { }, { } + metapost.process( + mpxformat, + { + "randomseed := " .. i*10 .. ";", + "scale_factor := " .. scalefactor .. " ;", + data + }, + false, + flusher + ) + lists[i] = { + designsize = 655360, + name = string.format("%s-%03i",hash,i), + parameters = { + slant = 0, + space = 333 * scalefactor, + space_stretch = 166.5 * scalefactor, + space_shrink = 111 * scalefactor, + x_height = 431 * scalefactor, + quad =1000 * scalefactor, + extra_space = 0 + }, + ["type"] = "virtual", + characters = characters, + descriptions = descriptions, + -- embedding = "subset", + -- mkiv: + spacer = "space", + unit = 1000, + shared = { }, + unique = { }, + } + end + metapost.reset(mpxformat) -- saves memory + lists = containers.write(fonts.mp.cache(), hash, lists) + statistics.stoptiming(flusher) + end + variants = variants + #lists + statistics.stoptiming(metapost.characters) + return lists + end + + function fonts.vf.aux.combine.commands.metafont(g,v) + local size = g.specification.size + local data = metapost.characters.process(v[2],v[3],v[4],size/655360) + local list, t = { }, { } + for d=1,#data do + t = data[d] + t = fonts.tfm.scale(t, -1000) + local id = font.nextid() + t.fonts = { { id = id } } + fontdata[id] = t + fonts.vf.aux.compose_characters(t) + list[d] = font.define(t) + end + for k, v in pairs(t) do + g[k] = v -- kind of replace, when not present, make nil + end + g.virtualized = true + g.variants = list + end + + fonts.define.methods.install( "punk", { + { "metafont", "mfplain", "punkfont.mp", 10 }, + } ) + + cases.actions[99] = function(current) + local used = fontdata[current.font].variants + if used then + local f = math.random(1,#used) + current.font = used[f] + return current, true + else + return current, false + end + end + + metapost.characters.flusher = flusher + + statistics.register("metapost font generation", function() + local time = statistics.elapsedtime(flusher) + if total > 0 then + return string.format("%i glyphs, %.3f seconds runtime, %i glyphs/second", total, time, total/time) + else + return string.format("%i glyphs, %.3f seconds runtime", total, time) + end + end) + + statistics.register("metapost font loading",function() + local time = statistics.elapsedtime(metapost.characters) + if variants > 0 then + return string.format("%.3f seconds, %i instances, %0.3f instances/second", time, variants, variants/time) + else + return string.format("%.3f seconds, %i instances", time, variants) + end + end) + +end +\stopluacode + +\unexpanded\def\EnableRandomPunk {\setcharactercasing[99]} +\unexpanded\def\RandomPunk {\groupedcommand\EnableRandomPunk\donothing} +\unexpanded\def\StartRandomPunk {\begingroup\EnableRandomPunk} +\unexpanded\def\StopRandomPunk {\endgroup} + +\starttypescript [serif] [punk] [default] + \setups[font:fallback:serif] % no style variants yet + \definefontsynonym [Serif] [demo@punk] +\stoptypescript + +\starttypescript [punk] + \definetypeface [punk] [rm] [serif] [punk] [default] +\stoptypescript + +\endinput + +\usetypescript[punk] + +\setupbodyfont[punk,14pt] + +\starttext + \definedfont[demo@punk at 10pt]hello world\par + \definedfont[demo@punk at 12pt]hello world\par + \definedfont[demo@punk at 16pt]hello world\par + \definedfont[demo@punk at 20pt]hello world\par +\stoptext + diff --git a/tex/context/base/scrn-fld.mkiv b/tex/context/base/scrn-fld.mkiv index eef6bbe7d..4bcc0eabd 100644 --- a/tex/context/base/scrn-fld.mkiv +++ b/tex/context/base/scrn-fld.mkiv @@ -150,6 +150,32 @@ \def\donormalfield{\doprocessfield\dohandlefield} \def\dofitfield {\doprocessfield\dohandlefitfield} +% \def\doprocessfield#1[#2][#3]% \method [name] [label] +% {\dontleavehmode +% \begingroup +% \loadfieldscripts +% \edef\currentfieldname {#2}% +% \edef\currentfieldlabel{#3}% +% \edef\currentfieldgroup{\ctxlua{backends.codeinjections.getfieldgroup("#2")}}% +% \ifx\currentfieldlabel\empty +% \let\currentfieldlabel\currentfieldname +% \fi +% \ifx\currentfieldgroup\empty +% #1[#2][\v!label,\v!frame,\v!horizontal][][][]% +% \else +% \getvalue{\??fd::\currentfieldgroup}% +% #1[#2][][][][]% todo: pass setups +% \fi +% \endgroup} + +% \def\dosetupfieldindeed#1#2[#3][#4][#5][#6][#7]% +% {#1[#2][#4][#5][#6][#7]} +% +% equals: + +\def\dosetupfieldindeed#1#2[#3]% [#4][#5][#6][#7]% + {#1[#2]} % [#4][#5][#6][#7]} + \def\doprocessfield#1[#2][#3]% \method [name] [label] {\dontleavehmode \begingroup @@ -163,7 +189,8 @@ \ifx\currentfieldgroup\empty #1[#2][\v!label,\v!frame,\v!horizontal][][][]% \else - #1[#2][][][][]% todo: pass setups + \def\dosetupfield{\dosetupfieldindeed{#1}{#2}}% + \getvalue{\??fd::\currentfieldgroup}% \fi \endgroup} @@ -246,11 +273,11 @@ \v!horizontal=>\HorizontalFieldtrue, \v!vertical=>\VerticalFieldtrue]% \ifVerticalField - \getparameters[\??fd][\c!distance=\!!zeropoint,\c!inbetween=\vskip\@@localoffset,\c!align=\v!right,\c!width=20em]% + \getparameters[\??fd][\c!distance=\zeropoint,\c!inbetween=\vskip\@@localoffset,\c!align=\v!right,\c!width=20em]% \else\ifHorizontalField \getparameters[\??fd][\c!distance=\@@localoffset,\c!inbetween=,\c!align=\c!left,\c!height=10ex]% \else - \getparameters[\??fd][\c!distance=\!!zeropoint,\c!inbetween=,\c!align=\c!left]% + \getparameters[\??fd][\c!distance=\zeropoint,\c!inbetween=,\c!align=\c!left]% \fi\fi \getparameters[\??fd][\c!n=,\c!before=,\c!after=\vss,\c!style=,\c!color=,#3]% \ifShowFieldFrame @@ -283,7 +310,7 @@ \c!clickin=,\c!clickout=,\c!regionin=,\c!regionout=, \c!afterkey=,\c!format=,\c!validate=,\c!calculate=, \c!focusin=,\c!focusout=, - \c!fieldoffset=\!!zeropoint,\c!fieldbackgroundcolor=, + \c!fieldoffset=\zeropoint,\c!fieldbackgroundcolor=, \c!fieldframecolor=,\c!fieldlayer=\@@iafieldlayer,#5]% \scratchdimen\framedwidth \edef\@@fdwidth {\the\scratchdimen}% \scratchdimen\framedheight\edef\@@fdheight{\the\scratchdimen}% @@ -324,11 +351,11 @@ \c!clickin=,\c!clickout=,\c!regionin=,\c!regionout=, \c!focusin=,\c!focusout=, \c!afterkey=,\c!format=,\c!validate=,\c!calculate=, - \c!fieldoffset=\!!zeropoint,\c!fieldbackgroundcolor=, + \c!fieldoffset=\zeropoint,\c!fieldbackgroundcolor=, \c!fieldframecolor=,\c!fieldlayer=\@@iafieldlayer,#5,\c!align=] {\edef\defaultfield{\ctxlua{backends.codeinjections.getdefaultfieldvalue("#1")}}% -\dopresetsymbol\defaultfield -\setbox\scratchbox\hbox{\dogetsymbol\defaultfield}% + % \dopresetsymbol\defaultfield + \setbox\scratchbox\hbox{\symbol[\defaultfield]}% \edef\@@fdwidth {\the\wd\scratchbox}% \ifcase\fitfieldmode \edef\@@fdheight{\the\ht\scratchbox}% @@ -376,7 +403,7 @@ \setupfield [systemfield] [\c!n=1024, % beware: weblink plugin truncates - \c!location=\v!low,\c!strut=\v!yes,\c!fieldoffset=0pt, + \c!location=\v!low,\c!strut=\v!yes,\c!fieldoffset=\zeropoint, \c!height=1.2\openlineheight,\c!width=\dimen0,\c!offset=\v!overlay, \c!style=,\c!align=\v!middle,\c!frame=\v!off, \c!color=red,\c!fieldbackgroundcolor=\s!white,\c!fieldframecolor=blue, @@ -438,7 +465,7 @@ {\fitfield[\currentsystemfield:but]}% #2}% \ht0\strutht\dp0\strutdp\box0 - \enfgroup} + \endgroup} %D And one more: diff --git a/tex/context/base/supp-mps.mkii b/tex/context/base/supp-mps.mkii index 9864cd9a1..3629ccf0b 100644 --- a/tex/context/base/supp-mps.mkii +++ b/tex/context/base/supp-mps.mkii @@ -1174,8 +1174,8 @@ \ifx\undefined\interactionmode \chardef\interactionmode=255 \fi - \def\MPOSTbatchswitch {-int=batchmode} - \def\MPOSTnonstopswitch {-int=nonstopmode} + \def\MPOSTbatchswitch {-interaction=batchmode} % was -int, but newer mpost does not support partial flags + \def\MPOSTnonstopswitch {-interaction=nonstopmode} % was -int, but newer mpost does not support partial flags \def\MPOSTformatswitch {-progname=metafun -mem=} \def\MPOSTdriver {dvips} diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index d650e4513..7b119f578 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -1842,7 +1842,8 @@ \def\undoassign[#1][#2]{\let\setsomevalue\doresetvalue\p!doassign#1\@relax@#2==\empty\@relax@} %D \macros -%D {processassignmentlist,processassignmentcommand} +%D {processassignmentlist,processassignmentcommand, +%D startprocessassignmentlist,startprocessassignmentcommand} %D %D For Wolfgang: %D @@ -1861,6 +1862,14 @@ \def\processassignmentcommand[#1]% {\normalexpanded{\noexpand\processassignmentlist[#1]}} +\long\def\startprocessassignmentlist[#1]#2\stopprocessassignmentlist + {\long\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% + \processassignmentlist[#1]\currentassignmentlistcommand} + +\long\def\startprocessassignmentcommand[#1]#2\stopprocessassignmentcommand + {\long\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% + \normalexpanded{\noexpand\processassignmentlist[#1]}\currentassignmentlistcommand} + %D \macros{currentvalue} %D %D Just in case a \type{\getparameter} argument itself ends up diff --git a/tex/context/base/syst-gen.mkii b/tex/context/base/syst-gen.mkii index 2db71650f..65a501360 100644 --- a/tex/context/base/syst-gen.mkii +++ b/tex/context/base/syst-gen.mkii @@ -2911,7 +2911,8 @@ {\ifundefined{#1#2}\dosetvalue{#1}{#2}{#3}\fi} %D \macros -%D {processassignmentlist,processassignmentcommand} +%D {processassignmentlist,processassignmentcommand, +%D startprocessassignmentlist,startprocessassignmentcommand} %D %D For Wolfgang: %D @@ -2927,6 +2928,14 @@ \def\processassignmentcommand[#1]% {\normalexpanded{\noexpand\processassignmentlist[#1]}} +\long\def\startprocessassignmentlist[#1]#2\stopprocessassignmentlist + {\long\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% + \processassignmentlist[#1]\currentassignmentlistcommand} + +\long\def\startprocessassignmentcommand[#1]#2\stopprocessassignmentcommand + {\long\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% + \normalexpanded{\noexpand\processassignmentlist[#1]}\currentassignmentlistcommand} + %D \macros %D {getparameters,geteparameters,getgparameters, %D forgetparameters} -- cgit v1.2.3