Type the dishes and prices, choose the size and the design, and download a print-ready menu. Capitals, prices, dashes and the dietary key are set to the Corvane standard for you. Nothing to install; it works offline.
Size and design
The heading
Today’s special prints in a box under the heading
Sections and dishes
Type freely: “28.00”, “$28” and “28” all print the same way, and titles follow the house style. Marks: V vegetarian, VG vegan, GF gluten-free, N contains nuts, S spicy, ★ signature. Only the marks you use appear in the key.
Small print
Photograph used by the Photo design
ST.menus[m.id])) ST=fresh();
const M=()=>ST.menus[ST.current];
function save(){ try{ localStorage.setItem(KEY,JSON.stringify(ST)); }catch(e){} }
/* ---------------- house style ---------------- */
const SMALL=new Set(["a","an","and","as","at","but","by","for","from","in","of","on","or","the","to","with","vs","de","la","du","en"]);
function clean(s){
return String(s||"").replace(/\s+/g," ").trim()
.replace(/ - /g," – ").replace(/--/g,"–").replace(/\.\.\./g,"…")
.replace(/(\w)'(\w)/g,"$1’$2").replace(/'/g,"’");
}
function titleCase(s){
s=clean(s); if(!s) return "";
return s.split(" ").map((w,i)=>{
if(/^[A-Z0-9&]{2,4}$/.test(w)) return w; // GF, BBQ, 8 oz stays
const lw=w.toLowerCase();
if(i>0 && SMALL.has(lw)) return lw;
return lw.replace(/^(\P{L}*)(\p{L})/u,(m,a,b)=>a+b.toUpperCase()).replace(/-(\p{L})/gu,(m,b)=>"-"+b.toUpperCase());
}).join(" ");
}
function sentence(s){ s=clean(s).replace(/[.;,]+$/,""); return s ? s[0].toUpperCase()+s.slice(1) : ""; }
function price(s){
s=clean(s).replace(/[$£€]/g,"").replace(/\s*\/\s*/g," / ");
return s.replace(/\d+(?:\.\d+)?/g,n=>{ const v=parseFloat(n); return Number.isInteger(v)?String(v):v.toFixed(2); });
}
const nameStyle=d=>d==="classic"?"title":"title";
/* ---------------- drawing: one painter for the proof and the file ---------------- */
const MMPT=25.4/72;
function Pen(ctx,scale,dry){
const px=pt=>pt*MMPT*scale;
const api={
font(o){ ctx.font=(o.italic?"italic ":"")+(o.weight||400)+" "+px(o.pt)+"px \""+(o.exp?EXP:SANS)+"\""; },
w(t,o){ api.font(o); const tr=(o.track||0)/1000*px(o.pt); return (ctx.measureText(t).width+Math.max(0,t.length-1)*tr)/scale; },
lines(t,wmm,o){
const words=String(t).split(" ").filter(Boolean), out=[]; let cur="";
words.forEach(w=>{ const tr=cur?cur+" "+w:w; if(cur&&api.w(tr,o)>wmm){ out.push(cur); cur=w; } else cur=tr; });
if(cur) out.push(cur); return out;
},
lh:o=>(o.lead||o.pt*1.3)*MMPT,
/* one line made of runs in different styles, aligned in [x, x+w] */
runs(rs,x,y,w,align,lh){
const ws=rs.map(r=>api.w(r.t,r));
const total=ws.reduce((a,b)=>a+b,0);
let cx = align==="center" ? x+(w-total)/2 : align==="right" ? x+w-total : x;
if(!dry) rs.forEach((r,i)=>{ api.draw(r.t,cx,y,r,lh); cx+=ws[i]; });
return total;
},
draw(t,x,y,o,lh){
api.font(o); ctx.fillStyle=o.color||C.navy; ctx.textBaseline="alphabetic";
const base=(y+ (lh||api.lh(o))*0.78)*scale, tr=(o.track||0)/1000*px(o.pt);
if(!tr){ ctx.fillText(t,x*scale,base); return; }
let cx=x*scale; for(const ch of t){ ctx.fillText(ch,cx,base); cx+=ctx.measureText(ch).width+tr; }
},
/* wrapped paragraph; returns the y below it */
text(t,x,y,w,o){
const ls=api.lines(o.caps?String(t).toUpperCase():t,w,o), lh=api.lh(o);
ls.forEach(l=>{ if(!dry){ const lw=api.w(l,o); const dx=o.align==="center"?x+(w-lw)/2:o.align==="right"?x+w-lw:x; api.draw(l,dx,y,o,lh); } y+=lh; });
return y;
},
rect(x,y,w,h,col){ if(dry) return; ctx.fillStyle=col; ctx.fillRect(x*scale,y*scale,w*scale,h*scale); },
frame(x,y,w,h,col,lw){ if(dry) return; ctx.strokeStyle=col; ctx.lineWidth=Math.max(1,lw*scale); ctx.strokeRect(x*scale,y*scale,w*scale,h*scale); },
diamond(cx,cy,r,col){ if(dry) return; ctx.fillStyle=col; ctx.beginPath(); ctx.moveTo(cx*scale,(cy-r)*scale); ctx.lineTo((cx+r)*scale,cy*scale); ctx.lineTo(cx*scale,(cy+r)*scale); ctx.lineTo((cx-r)*scale,cy*scale); ctx.closePath(); ctx.fill(); },
mono(cx,y,h,col){ if(dry) return; const p=new Path2D(P.mono); const s=h/1953.44*scale; ctx.save(); ctx.translate((cx-h*1.0238/2)*scale,y*scale); ctx.scale(s,s); ctx.fillStyle=col; ctx.fill(p); ctx.restore(); },
img(im,x,y,w,h){ if(dry||!im) return; const ar=im.naturalWidth/im.naturalHeight, box=w/h; let sw,sh;
if(ar>box){ sh=h; sw=h*ar; } else { sw=w; sh=w/ar; }
ctx.save(); ctx.beginPath(); ctx.rect(x*scale,y*scale,w*scale,h*scale); ctx.clip();
ctx.drawImage(im,(x+(w-sw)/2)*scale,(y+(h-sh)/2)*scale,sw*scale,sh*scale); ctx.restore(); },
shade(x,y,w,h){ if(dry) return; const g=ctx.createLinearGradient(0,y*scale,0,(y+h)*scale);
g.addColorStop(0,"rgba(0,0,0,0)"); g.addColorStop(1,"rgba(0,0,0,.55)"); ctx.fillStyle=g; ctx.fillRect(x*scale,y*scale,w*scale,h*scale); }
};
return api;
}
let PHOTO=null, PHOTO_SRC="";
function photoSrc(m){ return m.photoData || P.images[m.photo] || ""; }
/* The page, measured and drawn by the same code. k scales the type when a menu is long. */
function paint(ctx,scale,m,k,dry,two){
const F=FORMATS[m.format], W=F.w, H=F.h, pen=Pen(ctx,scale,dry), d=m.design;
const big=W>=200, small=W<120;
k=k*(big?1.2:small?0.95:1); // the base size follows the sheet
const mx = small?9:big?18:13; // side margin
const paper = d==="column" ? C.lav : "#ffffff";
pen.rect(0,0,W,H,paper);
const used=new Set(); let sigUsed=false;
m.sections.forEach(s=>s.items.forEach(it=>{ (it.marks||[]).forEach(x=>used.add(x)); if(it.sig) sigUsed=true; }));
if(m.special&&m.special.on) (m.special.marks||[]).forEach(x=>used.add(x));
/* ---- heading ---- */
let y;
const venue=clean(m.venue), title=clean(m.title);
const vpt = (big?26:small?17:21)*(d==="column"?1.05:1);
if(d==="photo"){
const ph=big?104:small?64:74;
if(PHOTO) pen.img(PHOTO,0,0,W,ph); else pen.rect(0,0,W,ph,C.blue);
pen.shade(0,ph*0.35,W,ph*0.65);
let ty=ph-(big?36:small?27:30);
pen.mono(W/2,ty-(big?13:10),big?10:8,"#ffffff");
ty=pen.text(venue,mx,ty,W-2*mx,{pt:vpt,exp:true,weight:500,caps:true,track:small?120:180,align:"center",color:"#ffffff",lead:vpt*1.1});
pen.text(title,mx,ty+1.5,W-2*mx,{pt:7.5,weight:600,caps:true,track:260,align:"center",color:"#ffffff"});
y=ph+7;
}else if(d==="classic"){
pen.frame(5,5,W-10,H-10,C.gold,0.35);
y=small?14:big?20:16;
pen.mono(W/2,y,big?12:9,C.gold); y+=big?17:13;
y=pen.text(venue,mx,y,W-2*mx,{pt:vpt,exp:true,weight:500,caps:true,track:small?110:170,align:"center",color:C.navy,lead:vpt*1.12});
y=pen.text(title,mx,y+1.5,W-2*mx,{pt:7.5,weight:600,caps:true,track:280,align:"center",color:C.gold})+3;
}else{
y=small?12:big?18:14;
pen.mono(mx+5,y,10,C.gold);
y+=15;
y=pen.text(venue,mx,y,W-2*mx,{pt:vpt*1.08,exp:true,weight:500,color:C.navy,lead:vpt*1.16});
y=pen.text(title,mx,y+1,W-2*mx,{pt:7.5,weight:700,caps:true,track:240,color:C.gold})+2.5;
}
const al = d==="column" ? "left" : "center";
const sub=[clean(m.note), m.dateOn?clean(m.dateText):""].filter(Boolean).join(" · ");
if(sub) y=pen.text(sub,mx,y,W-2*mx,{pt:7.2,weight:500,align:al,color:"#6E6E73",track:20})+1;
if(clean(m.priceLine)) y=pen.text(clean(m.priceLine),mx,y+0.6,W-2*mx,{pt:9.5,exp:true,weight:500,italic:EXP!=="Jost",align:al,color:C.navy})+1;
y+=big?5:3.5;
/* ---- foot: the key, the small print, the place ---- */
const footW=W-2*mx;
const keyBits=MARKS.filter(x=>used.has(x[0])).map(x=>x[0]+" "+x[1]);
if(sigUsed) keyBits.unshift("★ "+(clean(m.sigLabel)||"signature").toLowerCase());
const foot=[];
if(keyBits.length) foot.push({t:keyBits.join(" · "),o:{pt:6.6,weight:600,align:"center",color:C.navy}});
if(clean(m.footer)) foot.push({t:clean(m.footer),o:{pt:6.4,align:"center",color:"#6E6E73"}});
foot.push({t:P.place,o:{pt:6,weight:600,caps:true,track:160,align:"center",color:C.gold}});
const footDry=Pen(ctx,scale,true);
let fh=0; foot.forEach(f=>{ fh=footDry.text(f.t,mx,fh,footW,f.o)+0.8; });
const bottom=H-(d==="classic"?12:9);
let fy=bottom-fh; const limit=fy-4;
foot.forEach(f=>{ fy=pen.text(f.t,mx,fy,footW,f.o)+0.8; });
/* ---- the special ---- */
if(m.special&&m.special.on&&clean(m.special.text)){
const sp=m.special, bw=Math.min(W-2*mx, big?120:W-2*mx), bx=(W-bw)/2, pad=3.5;
const inner=bw-2*pad, mdry=Pen(ctx,scale,true);
const ho={pt:6.8,weight:700,caps:true,track:220,align:"center",color:C.gold};
const to={pt:9.5*k,exp:true,weight:500,align:"center",color:C.navy};
const po={pt:8.5*k,weight:700,align:"center",color:C.gold};
let h=pad; h=mdry.text(clean(sp.head)||"Today’s special",bx+pad,h,inner,ho)+0.8; h=mdry.text(sentence(sp.text),bx+pad,h,inner,to);
if(m.showPrices&&price(sp.price)) h=mdry.text(price(sp.price),bx+pad,h+0.5,inner,po); h+=pad;
pen.frame(bx,y,bw,h,C.gold,0.35);
let yy=y+pad; yy=pen.text(clean(sp.head)||"Today’s special",bx+pad,yy,inner,ho)+0.8; yy=pen.text(sentence(sp.text),bx+pad,yy,inner,to);
if(m.showPrices&&price(sp.price)) pen.text(price(sp.price),bx+pad,yy+0.5,inner,po);
y+=h+(big?7:5);
}
/* ---- the body: blocks, flowed into one or two columns ---- */
const cols = ((d==="column"&&big)||two) ? 2 : 1, gut=10;
const cw=(W-2*mx-(cols-1)*gut)/cols;
const center = d!=="column";
const blocks=[];
const sp=(big?1:0.85)*k;
const mk=it=>(it.marks||[]).filter(Boolean);
const mdry=Pen(ctx,scale,true);
m.sections.forEach((s,si)=>{
const head={pt:(center?9.5:9)*k,weight:center?500:700,exp:center,caps:true,track:center?240:200,align:center?"center":"left",color:center?C.gold:C.navy};
const items=s.items.filter(it=>clean(it.name));
if(!clean(s.title)&&!items.length) return;
const hb={keep:true,draw:(x,yy,P2)=>{ let h=0;
if(center){ P2.diamond(x+cw/2,yy+1.6,1.1*k,C.gold); h+=4.2*k; }
h=P2.text(clean(s.title),x,yy+h,cw,head)-yy;
if(clean(s.note)) h=P2.text(sentence(s.note),x,yy+h+0.4,cw,{pt:7*k,italic:true,align:head.align,color:"#6E6E73"})-yy;
return h+3.2*sp; }};
hb.h=hb.draw(0,0,mdry); if(si>0) hb.gap=(big?6:4.5)*k; blocks.push(hb);
items.forEach(it=>{
const name=titleCase(it.name), pr=m.showPrices?price(it.price):"", marks=mk(it);
const no={pt:10*k,exp:center,weight:center?500:700,color:C.navy};
const mo={pt:6.3*k,weight:700,color:C.gold,track:40};
const po={pt:9*k,weight:700,color:C.gold};
const dO={pt:7.6*k,italic:center,color:"#55555A",align:center?"center":"left",lead:7.6*k*1.32};
const b={draw:(x,yy,P2)=>{
let h=0;
if(it.sig){ h=P2.text("★ "+(clean(m.sigLabel)||"Signature"),x,yy,cw,{pt:5.8*k,weight:700,caps:true,track:200,color:C.gold,align:center?"center":"left"})-yy+0.3; }
const lh=P2.lh(no);
const mtxt=marks.length?" "+marks.join(" "):"";
if(center){
const one=[{t:name,...no}].concat(mtxt?[{t:mtxt,...mo}]:[]).concat(pr?[{t:" "+pr,...po}]:[]);
const tw=one.reduce((a,r)=>a+P2.w(r.t,r),0);
if(tw<=cw){ P2.runs(one,x,yy+h,cw,"center",lh); h+=lh; }
else { h=P2.text(name,x,yy+h,cw,Object.assign({align:"center"},no))-yy;
const two=(mtxt?[{t:mtxt.trim(),...mo}]:[]).concat(pr?[{t:(mtxt?" ":"")+pr,...po}]:[]);
if(two.length){ P2.runs(two,x,yy+h,cw,"center",lh); h+=lh; } }
}else{
const pw=pr?P2.w(pr,po)+3:0;
const nl=P2.lines(name,cw-pw-(mtxt?P2.w(mtxt,mo):0),no);
nl.forEach((l,i)=>{
const r=[{t:l,...no}]; if(i===nl.length-1&&mtxt) r.push({t:mtxt,...mo});
P2.runs(r,x,yy+h,cw-pw,"left",lh);
if(i===0&&pr) P2.runs([{t:pr,...po}],x,yy+h,cw,"right",lh);
h+=lh;
});
}
const desc=sentence(it.desc);
if(desc) h=P2.text(desc,x+(center?0:0),yy+h+0.3,center?cw:cw-(pr?14:0),dO)-yy;
return h+3.4*sp; }};
b.h=b.draw(0,0,mdry); blocks.push(b);
});
});
// place: one column top to bottom, or two columns balanced at a section break
const top=y, avail=limit-top;
const colH=arr=>arr.reduce((h,b,j)=>h+(j>0&&b.gap?b.gap:0)+b.h,0);
const placed=[]; let over=false, usedH=0;
const stack=(arr,x)=>{ let cy=top; arr.forEach((b,j)=>{ const g=(j>0&&b.gap)?b.gap:0; placed.push({b,x,y:cy+g}); cy+=g+b.h; }); return cy-top; };
if(cols===2&&blocks.length>1){
let best=null;
for(let i=1;iavail+0.5;
const shift = !over ? Math.max(0,Math.min((avail-usedH)/2, center?60:0)) : 0;
/* nothing is printed over the small print: what does not fit stays off the page, and Checks says so */
placed.forEach(p=>{ if(p.y+p.b.h+shift<=limit+0.5) p.b.draw(p.x,p.y+shift,pen); });
const cy=top+usedH;
return {over, k, fill:(cy-top)/avail, blocks:blocks.length};
}
/* tightest first fit */
const LADDER=[1,0.96,0.92,0.88,0.84,0.8,0.76,0.72];
let _mc=null;
function fitK(m){
if(!_mc){ _mc=document.createElement("canvas"); _mc.width=_mc.height=4; }
const ctx=_mc.getContext("2d"), wide=FORMATS[m.format].w>=200 && m.design!=="column";
/* one column while the type stays comfortable; on A4 a long menu then goes to two columns */
for(const k of LADDER){ if(wide&&k<0.84) break; if(!paint(ctx,4,m,k,true,false).over) return {k,two:false,over:false}; }
if(wide) for(const k of LADDER){ if(!paint(ctx,4,m,k,true,true).over) return {k,two:true,over:false}; }
return {k:LADDER[LADDER.length-1],two:wide,over:true};
}
/* ---------------- proof ---------------- */
let FIT={k:1,over:false};
function render(){
const m=M(), F=FORMATS[m.format], cv=$("#proof"), box=$("#proofBox");
const maxW=Math.max(260,box.clientWidth-36), maxH=Math.max(420,window.innerHeight-210);
const css=Math.min(maxW, maxH*F.w/F.h), dpr=window.devicePixelRatio||1;
cv.style.width=css+"px"; cv.style.height=(css*F.h/F.w)+"px";
cv.width=Math.round(css*dpr); cv.height=Math.round(css*F.h/F.w*dpr);
FIT=fitK(m);
paint(cv.getContext("2d"),cv.width/F.w,m,FIT.k,false,FIT.two);
flags(m);
$("#fmtlabel").textContent=F.label;
const n=m.sections.reduce((a,s)=>a+s.items.length,0);
$("#count").textContent=m.sections.length+" sections · "+n+" dishes";
$("#meta").textContent=clean(m.venue)+" · "+clean(m.title)+" · "+F.label+" · "+DESIGNS[m.design].split(" · ")[0]+(FIT.k<1?" · type at "+Math.round(FIT.k*100)+"%":"");
}
let _q=0; function later(){ clearTimeout(_q); _q=setTimeout(()=>{ save(); render(); },30); }
function flags(m){
const out=[];
if(FIT.over) out.push(["err","The menu does not fit on the "+m.format+" "+(m.format==="A4"?"page":"card")+", even with the type at its smallest. Shorten a description, take a dish out, or choose a larger size."]);
m.sections.forEach(s=>s.items.forEach(it=>{
const n=titleCase(it.name)||"A dish";
if(!clean(it.name)&&(clean(it.desc)||clean(it.price))) out.push(["warn","A dish in “"+(clean(s.title)||"a section")+"” has no name, so it is left off the menu."]);
if(m.showPrices&&clean(it.name)&&!price(it.price)) out.push(["warn",n+" has no price."]);
if(clean(it.desc).length>130) out.push(["warn",n+": the description is long ("+clean(it.desc).length+" characters). Menus read best under 100."]);
}));
if(m.special&&m.special.on&&!clean(m.special.text)) out.push(["warn","Today’s special is ticked but empty."]);
if(m.design==="photo"&&!PHOTO) out.push(["warn","The Photo design has no photograph yet."]);
if(!out.some(x=>x[0]==="err")){
if(FIT.k<1) out.push(["info","The type is set at "+Math.round(FIT.k*100)+"% so everything fits. A larger size gives it more room."]);
if(!out.length) out.push(["ok","Everything is in order. The menu is ready to download."]);
}
$("#flags").innerHTML=out.map(f=>'
'+esc(f[1])+'
').join("");
}
const esc=s=>String(s).replace(/[&<>"]/g,c=>({"&":"&","<":"<",">":">",'"':"""}[c]));
/* ---------------- the form ---------------- */
function loadPhoto(cb){
const src=photoSrc(M());
if(!src){ PHOTO=null; PHOTO_SRC=""; cb&&cb(); return; }
if(src===PHOTO_SRC&&PHOTO){ cb&&cb(); return; }
const im=new Image(); im.onload=()=>{ PHOTO=im; PHOTO_SRC=src; cb&&cb(); }; im.onerror=()=>{ PHOTO=null; cb&&cb(); }; im.src=src;
}
function fillForm(){
const m=M();
$("#tabs").innerHTML=P.menus.map(x=>{ const s=ST.menus[x.id]; return ''; }).join("");
$("#format").innerHTML=Object.entries(FORMATS).map(([k,v])=>'').join("");
$("#design").innerHTML=Object.entries(DESIGNS).map(([k,v])=>'').join("");
$("#format").value=m.format; $("#design").value=m.design;
$("#showPrices").checked=!!m.showPrices; $("#specialOn").checked=!!(m.special&&m.special.on); $("#dateOn").checked=!!m.dateOn;
["venue","note","dateText","priceLine","sigLabel","footer"].forEach(k=>{ $("#"+k).value=m[k]||""; });
$("#mtitle").value=m.title||"";
const sp=m.special||{}; $("#spHead").value=sp.head||""; $("#spText").value=sp.text||""; $("#spPrice").value=sp.price||"";
$("#specialCard").style.display=$("#specialOn").checked?"":"none";
$("#photoNote").textContent=m.photoData?"Your own photo is in use on this computer.":"The standard photo for "+clean(m.venue)+" is in use (Pexels).";
sections();
}
function sections(){
const m=M();
$("#sections").innerHTML=m.sections.map((s,si)=>
'