lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

streamlining \eyeglasses


From: Mark Polesky
Subject: streamlining \eyeglasses
Date: Sat, 7 Mar 2009 00:08:06 -0800 (PST)

Hey all, long time no post...

Recently I've been swimming around in the odd 
ocean of postscript, and I'm starting to see 
weird ways of streamlining ps code. I was
looking at Reinhold's fantastic \eyeglasses
command and I tried streamlining it a little
(as an exercise for myself). If anyone is 
remotely interested, here's what I got:

First, the original code, currently at line 
473 in define-markup-commands.scm

eyeglassesps = #\"
  0.15 setlinewidth
  -0.9 0 translate
  1.1 1.1 scale
  1.2 0.7 moveto
  0.7 0.7 0.5 0 361 arc
  stroke
  2.20 0.70 0.50 0 361 arc
  stroke
  1.45 0.85 0.30 0 180 arc
  stroke
  0.20 0.70 moveto
  0.80 2.00 lineto
  0.92 2.26 1.30 2.40 1.15 1.70 curveto
  stroke
  2.70 0.70 moveto
  3.30 2.00 lineto
  3.42 2.26 3.80 2.40 3.65 1.70 curveto
  stroke\"

And here's my streamlined code, using about
40% fewer operators/operands, and about
40% less space in the file. 

eyeglassesps = #\"
  0.15 setlinewidth
1.1 1.1 scale
  1.3 0.7 0.5 0 360 2.7
-0.2 0.7 0.5 -180 180 0.25
  2 {1.7 moveto
     0.15 0.7 -0.23 0.56 -0.35 0.3 rcurveto
     arc} repeat
stroke
  0.55 0.85 0.30 0 180 arc
stroke\"

I know, not a big deal, just thought I'd share.
Maybe the concept is of interest to someone.

Hope you're all well!
- Mark


      




reply via email to

[Prev in Thread] Current Thread [Next in Thread]