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

How to fonts smaller

Posted by INV on Oct 28, 2009

I am trying to make a list with all the country's in the world. The size of the type stands for the scale of the type.

Is there a way to do this in Nodebox with simple coding, because i'm totaly new with NB.


 
Posted by HendersonMedia on Oct 30, 2009

Do you mean you want to alter the fontsize() as in the example given below?

size(300, 300)
font("Helvetica")
fontsize(30)
text("hello", 100, 100)
fontsize(10)
text("world", 170, 100)



Posted by Lucas on Nov 02, 2009

#make your list or get it from somewhere
countrylist=[("United States",280),("Belgium",42),("France",80),("United Kingdom",80),("The Netherlands",16)]
L = len(countrylist)
nextline = 100 
#this works for every length of list you may have
for i in range(L):
    #do some calculation to avoid too small or too big numbers
    fs = (countrylist[i][1]/4)+5 
    #set the fontsize to this calculation
    fontsize(fs) 
    #calculate next baseline so the lines don't mess up
    nextline = nextline + fs 
    #throw it on there
    text(countrylist[i][0], 100, nextline)