File talk:Wikipedia ak0.png

From Meta, a Wikimedia project coordination wiki

This was a very quick sketch of an idea that can be developed further. The inspiration is that Wikipedia is, by nature, continually being added to. The vertical wiggle is a stylised version of continuous-form paper, as well as being reminiscent of a W. The text is a drawing, not a font, so could be adapted to other languages, with effort. The proportions of the logo and text need adjusting, maybe to get more wiggles in the wiggle. I hacked this up quickly in Illustrator. I may get serious and program it up in MetaPost (as the author of w:MetaPost it is the least I can do). -- AndrewKepert 08:18, 25 Aug 2003 (UTC)

I like the concept. Give the letters a bit more space, hard to read when it's small. Ezel Ezel 09:06, 25 Aug 2003 (UTC)

Added a small version with the caption asked for. This gets it closer to the 150x150 ideal (squarer, scaled down). The "The free encyclopedia" font is an arbitrary font that I had lying around, the result of ... oooh ... 10 seconds of searching. A more sympathetic choice would be wise. I will post some metapost source here tomorrow if others want to try their luck! -- AndrewKepert 10:16, 25 Aug 2003 (UTC)



Final effort

This is my final go at it. As you can see, it has alpha transparency.

The final version is generated totally by MetaPost code (also pdftex, ghostscript, netpbm). There are many variables that can be tweaked. In particular:

  • The length and slope of the main zigzag
  • Features of the "Wikipedia" text:
    • The dimensions of the zigzag (height, spacing, pen)
    • the heights of the features (ex-height, bar height, dot-on-i height)
    • whether "k" and "d" have hooks on top (set hook=-1)
  • Colours of all elements, including the (faked) gradient

For those interested, you can build these logos yourself on any linux (or similar) system that has TeTeX, Ghostscript and netpbm installed. You should only need three files for this: wikip.mp, pdfprologue,tex and Makefile. Put them all in the one folder and run "make". It works for me!


MetaPost code

Here are the files. I have boxed them up and used <pre> since wiki-style verbatim text doesn't like tabs, which are essential to the Makefile. The version 4 of the image is the default make target.

wikip.mp
boolean debug;
debug:=true;
pair centre;
centre:=(100mm,150mm);
path wiggle[];

def wigglepath(expr w,dy,n,t,k)=begingroup
	%% Returns a path with 1+n straight segments whose tilt
	%% varies from 0 (segment 0, horizontal) to t (degrees CCW).
	%% w=width of straight segments of wiggle
	%% dy=vertical skip between straight segments
	%% n=last segment number (preferably even)
	%% k=decay constant for exponential decay of tilt
	save x,y,i,tilt,wiggle;
	numeric tilt[]; path wiggle;
	tilt0=0;
	for i=1 upto n:
		tilt[i]:=if odd i:180-fi t*mexp(256k*(i-n)); %% tilt is e^{-k(n-i)}
	endfor;
	(0,0)=.5[z0s,z0e];	%% first slab centred on origin
	for i=0 upto n:
		z[i]e-z[i]s=w*dir(tilt[i]);	
		z[i]sj=z[i]s+.5dy*unitvector((z[i]e-z[i]s) rotated if not odd i:-fi 90);
		z[i]ej=z[i]e+.5dy*unitvector((z[i]e-z[i]s) rotated if odd i:-fi 90);
		z[i]ej=z[i+1]sj;
	endfor
	%% now make the wiggle and add a small initial extension to segment 0.
	wiggle=z0s---z0e for i=1 upto n: ..z[i]s---z[i]e endfor;
	z0alt = whatever[z0s,z0e] = (point 3.5 of wiggle) + whatever*down;
	z0alt--subpath(1,infinity) of wiggle
endgroup enddef;

def roundedrect (expr w,h,r ) =
	(r,0)---(w-r,0)..(w,r)---(w,h-r)..(w-r,h)---(r,h)..(0,h-r)---(0,r)..cycle
enddef;
		


pair shiftoffset; shiftoffset=(0,0);
vardef ^@#=(@# shifted shiftoffset) enddef;
vardef !@#=(@# shifted -shiftoffset) enddef;

def draw_wikipedia(expr origin,penthick,ht,dx,hook,dott,dotb,exht,barht,descent)=begingroup
	save p,x,y;
	path p[];
	%%	Get a wiggle path
	p0=wigglepath(ht,dx,16,0,0) rotated -90 shifted origin;
	%% add an extra point
	z33=whatever[point 32 of p0,point 33 of p0]=(point 29.5 of p0) +whatever*right;
	p0:=p0 -- z33;
	for i=0 upto length(p0):
		z[i]p=point i of p0;
	endfor
	shiftoffset:=z34p-z33p;
	
	
	% grey version
	if debug:
		draw p0 withpen pencircle scaled penthick withcolor .75white;
	fi
	% "W"
	pickup pencircle scaled penthick;
	draw
		if hook>0:
			subpath (0,8) of p0 -- hook[z9p,z8p];
		else:
			subpath (0,7) of p0 -- !z7p;
		fi
	% "iki"
	draw dott[z9p,z8p]--dotb[z9p,z8p];
	draw exht[z9p,z8p]
		if hook>0:
			--subpath(9,12) of p0 -- hook[z13p,z12p]
		else:
			--subpath(9,11) of p0 -- !z11p
		fi;
	draw dott[z14p,z15p]--dotb[z14p,z15p];
	z10a=barht[z10p,z11p];	%% branch-point of k
	z12a=whatever[z13p,z12p]=z10a+whatever*dir(45);	%% point on up-branch of k
	z12b=whatever[z13p,z12p]=z10a+whatever*dir(-45);	%% point on dn-branch of k
	draw exht[z13p,z12p]---z12a..z10a&z10a..z12b---subpath(13,14) of p0--exht[z14p,z15p];
	% "p" traced CCW
	z16a=exht[z17p,z16p];
	z18a=exht[z18p,z19p];
	draw subpath(17,18) of p0---
		^z18a..^z16a
		---descent[z17p,z16p];
	% "e" traced CCW
	z21a=exht[z22p,z23p];
	z22a=exht[z21p,z20p];
	draw barht[z21p,z20p]{down}..barht[z22p,z23p]---^z21a
		..^z22a---subpath(21,22) of p0;
	% "d" CCW
	z25a=exht[z25p,z24p];
	z26a=exht[z26p,z27p];
	draw ^z26a{up}..^z25a
		if hook>0:
			---subpath(25,28) of p0--hook[z29p,z28p]
		else:
			---subpath(25,27) of p0--!z27p
		fi;
	% "iA"
	draw dott[z29p,z28p]--dotb[z29p,z28p];
	draw exht[z29p,z28p]--subpath(29,34) of p0;
	z30a=barht[z30p,z31p];	%% left end of bar on A
	z32a=whatever[z33p,z32p]=z30a+whatever*dir(-45);	%% right end of bar on A
	draw z30a..z32a{down};

	% guides
	if debug:
		pickup pencircle;
		for i=0 upto length(p0):
			drawdot (point i of p0) withpen pencircle scaled .3penthick withcolor .5[red,white];

			label.top (decimal i,point i of p0) withcolor .5[red,white];
		endfor
	fi
endgroup enddef;

beginfig(2)
	draw_wikipedia(centre,3mm,40mm,4mm,-1,.7,.65,.5,.2,-.3);
endfig;

beginfig(3)
	draw wigglepath(30mm,3mm,12,20,.4) withpen pencircle scaled 2mm shifted centre;
	draw wigglepath(30mm,3mm,8,30,.6) withpen pencircle scaled 2mm shifted centre shifted (40mm,0);
	draw wigglepath(20mm,4mm,8,60,.6) withpen pencircle scaled 3mm shifted centre shifted (80mm,0);
endfig;

beginfig(4)
	draw_wikipedia(centre,3mm,40mm,4mm,.95,.7,.65,.5,.2,-.3);
endfig;
verbatimtex
	\font\cmssdc=cmssdc10
	\baselineskip=0pt \lineskiplimit=2pt \lineskip=\lineskiplimit
etex

debug:=false;
beginfig(5)
	save hspace,vspace,padding,logowd,logoht;
	picture pic[];
	%% pic0 is the big wiggle
	pic0=nullpicture;
	addto pic0 doublepath wigglepath(50mm,8mm,8,35,.6) withpen pencircle scaled 6mm shifted centre;
	%% draw wikipedia text and then shift it to pic1
	draw_wikipedia(centre,3mm,33mm,4mm,.99,.88,.82,.7,.25,-.3);
	pic1=currentpicture;
	currentpicture:=nullpicture;
	%% pic2 is text ``The Free Encyclopaedia''
	pic2=thelabel(btex \hbox{\vbox{\halign{\hfil\cmssdc#\cr The Free\cr Encyclop\ae dia\cr}}} etex,(0,0)) scaled 3.5;
	%% now to get spacing right
	padding:=5mm;
	logoht:=ypart(ulcorner pic0 - llcorner pic0)+2*padding;
	logowd:=logoht;
	(llcorner pic0) shifted z0 = (padding,padding);
	(lrcorner pic0) shifted z0 + (hspace,vspace) = (llcorner pic2) shifted z2;
	(urcorner pic2) shifted z2 + (0,1.6vspace) = (lrcorner pic1) shifted z1;
	(urcorner pic1) shifted z1 + (0,.5vspace) + (padding,padding) = (logowd,logoht);

	color c[];
	c0=c1=c2=black;
	c40=c41=white;
	for i=1 step -(1/64) until 0:
		fill unitsquare scaled logowd yscaled i withcolor i[c41,c40];
	endfor
	draw pic0 shifted z0 withcolor c0;
	draw pic1 shifted z1 withcolor c1;
	draw pic2 shifted z2 withcolor c2;
	clip currentpicture to roundedrect(logowd,logoht,padding);
endfig;

beginfig(6)	
	save hspace,vspace,padding,logowd,logoht;
	picture pic[];
	%% pic0 is the big wiggle
	pic0=nullpicture;
	addto pic0 doublepath wigglepath(50mm,8mm,8,35,.6) withpen pencircle scaled 6mm shifted centre;
	%% draw wikipedia text and then shift it to pic1
	draw_wikipedia(centre,3mm,33mm,4mm,.99,.88,.82,.7,.25,-.3) ;
	pic1=currentpicture scaled 1.25;
	currentpicture:=nullpicture;
	%% pic2 is text ``The Free Encyclopaedia''
	pic2=thelabel(btex \hbox{\vbox{\halign{\hfil\cmssdc#\cr The Free\cr Encyclop\ae dia\cr}}} etex,(0,0)) scaled 3.5;
	%% now to get spacing right
	padding:=5mm;
	logoht:=ypart(ulcorner pic0 - llcorner pic0)+2*padding;
	logowd:=logoht;
	(llcorner pic0) shifted z0 = (padding,padding);
	(lrcorner pic0) shifted z0 + (hspace,vspace) = (llcorner pic2) shifted z2;
	(urcorner pic2) shifted z2 + (0,1.6vspace) = (lrcorner pic1) shifted z1;
	(urcorner pic1) shifted z1 + (0,.5vspace) + (padding,padding) = (logowd,logoht);

	color c[];
	c0=white;
	c1=(.2,0,.4);
	c2=white;
	c40=white;
	c41=c1;
	for i=1 step -(1/64) until 0:
		fill unitsquare scaled logowd yscaled i withcolor i[c41,c40];
	endfor
	draw pic0 shifted z0 withcolor c0;
	draw pic1 shifted z1 withcolor c1;
	draw pic2 shifted z2 withcolor c2;
	clip currentpicture to roundedrect(logowd,logoht,padding);
endfig;

for isalpha=0 upto 1:	%% draw this twice: once to get the pic, once for the alpha channel
	beginfig(7+100isalpha)	
		save hspace,vspace,padding,logowd,logoht;
		picture pic[];
		%% pic0 is the big wiggle
		pic0=nullpicture;
		addto pic0 doublepath wigglepath(50mm,8mm,8,35,.6) withpen pencircle scaled 6mm shifted centre;
		%% draw wikipedia text and then shift it to pic1
		draw_wikipedia(centre,3mm,33mm,4mm,.99,.88,.82,.7,.25,-.3) ;
		pic1=currentpicture scaled 1.25;
		currentpicture:=nullpicture;
		%% pic2 is text ``The Free Encyclopaedia''
		pic2=thelabel(btex \hbox{\vbox{\halign{\hfil\cmssdc#\cr The Free\cr Encyclop\ae dia\cr}}} etex,(0,0)) scaled 3.5;
		%% now to get spacing right
		padding:=5mm;
		logoht:=ypart(ulcorner pic0 - llcorner pic0)+2*padding;
		logowd:=logoht;
		(llcorner pic0) shifted z0 = (padding,padding);
		(lrcorner pic0) shifted z0 + (hspace,vspace) = (llcorner pic2) shifted z2;
		(urcorner pic2) shifted z2 + (0,1.6vspace) = (lrcorner pic1) shifted z1;
		(urcorner pic1) shifted z1 + (0,.5vspace) + (padding,padding) = (logowd,logoht);
	
		color c[];
		if isalpha=0:
			c0=white; c1=(.2,0,.4); c2=white;
			c40=white; c41=c1;
		else:
			c0=white; c1=white; c2=white;
			c40=black; c41=white;
		fi
		for i=1 step -(1/64) until 0:
			fill unitsquare scaled logowd yscaled i withcolor i[c41,c40];
		endfor
		draw pic0 shifted z0 withcolor c0;
		draw pic1 shifted z1 withcolor c1;
		draw pic2 shifted z2 withcolor c2;
		clip currentpicture to roundedrect(logowd,logoht,padding);
		if isalpha=1:
			pic3:=currentpicture; currentpicture:=nullpicture;
			fill unitsquare scaled logowd withcolor black;
			draw pic3;
		fi
	endfig;
endfor

bye


Makefile
default:	wikipedia_ak4.png

%-mp.ps:	%.mp
	mpost $<
	echo '\input epsf \input AKboxit' > $*-mp.tex
	ls $*.* | sed -n 's/$*.[0-9]\+/\\vbox{\\leftline{\\tt &}\\boxit{\\hbox{\\epsfbox{&}}}}\\filbreak/p' >> $*-mp.tex
	echo '\bye' >> $*-mp.tex
	tex $*-mp
	dvips $*-mp -o $@

%-mp.pdf:	%.mp
	mpost $<
	echo '\input pdf-prologue' > $*-mp.tex
	ls $*.* | sed -n 's/$*.[0-9]\+/\\pdfpage & /p' >> $*-mp.tex
	echo '\bye' >> $*-mp.tex
	pdftex $*-mp

%.pngs:	%.pdf
	gs -q -dNOPAUSE -sDEVICE=png16m -r300 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -SOutputFile=$*%d.png $< -c quit

%.pnm:	wikip-mp.pngs
	pngtopnm $*.png | pnmscale -width 150 > $@

%.pgm:	%.pnm
	ppmtopgm $< > $@

wikipedia_ak4.png:	wikip-mp7.pnm wikip-mp1.pgm
	pnmtopng -alpha wikip-mp1.pgm wikip-mp7.pnm > $@


pdf-prologue.tex
\input supp-pdf \input AKboxit

\def\pdfpage #1.#2 {{%
	\setbox0=\vbox{\hbox{\convertMPtoPDF{#1.#2}11}\nointerlineskip\null}
	\pdfpagewidth=\wd0
	\pdfpageheight=\ht0
	\hoffset=-1truein
	\voffset=-1truein
	\pageno=#2
	\shipout\box0
	}}