1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

Cornucopia Example Problem (newbie question)

Posted by alx on Sep 08, 2008

Hi,

I'm a complete Nodebox newbie, so am probably missing something terribly obvious here, but...

if I try to run the Cornucopia Cornu library / font example in the gallery, I can't seem to get the letters of a string to appear next to each other as they should. They seem to be rendered in the same place (ie on top of each other). Is there a way to have them rendered in a row as they should be (and as they are in the example picture)?

MacOS 10.4.11
PowerMac G5

Thanks in advance,

a|x
http://machinesdontcare.wordpress.com


 
Posted by Lucas on Sep 18, 2008

Hello alx,

I don't know what the problem is in your case since you do not show the code but the following should work, it even ads a fit function that makes the cornu fit in a given space. Hope this helps.

size(500,500)
ximport("cornu")
 
#transform(CORNER)
translate(0,0)
font("American Typewriter", 100)
path = textpath("2008", 0, 0)
 
ptlist = []
 
d = 6.15
for i in range(3):
    for pt in path:
        if pt.cmd == LINETO or pt.cmd == CURVETO:
            ptlist.append((pt.x+random(-d, d), pt.y+random(-d, d)))
 
nofill()
stroke(0)
cp = cornu.path(ptlist)
cp.fit(0, 0, 500, 500)
 
cp.draw()



Posted by a|x on Nov 10, 2008

Ah, thank you, that seems to have fixed it. I was using the code from the gallery page Cornu example.

Cheers!