Hello People,
I am currently working on a Drawbot Proof to get into Python and I wanted to have an inverter, just vor the fun of it (draw black rect and make text white).
The test works, but in the final proof, the text doesn’t accept the white fill, probably because its inside a function. But how do I get the fill from the invert function to respond to my text? Its hard to describe, i guess you have to look at it. When i put col2 into the text variables, i get a not defined error.
1 is on, 0 (or else) is off
Test:
invert=1
size=('A4Landscape')
newPage(size)
if invert==1:
col1=(0)
col2=(1)
else:
col1=(1)
col2=(0)
fill(col1)
rect(0,0,width(),height())
fill(col2)
fontSize(200)
textBox("test", (0,0, width(), height()))
In the Proof:
# Inverter
charVert=1
textVert=1
def invert(invert):
if invert==1:
#Farben
col1=(0)
col2=(1)
else:
#Switch
col1=(1)
col2=(0)
fill(col1)
rect(0, 0, width(), height())
fill(col2)
My Charakter Set Proof (for example) looks like this:
# Technik
invert(charVert)
info('Charakter Set Proof')
punkt(charFontSize, raster)
# Charset
charsetString = FormattedString(charset,
font=fontPath,
fallbackFont=fallback,
fontSize=charFontSize,
lineHeight=charLh,
align="center")
textBox(charsetString, (raster2, raster, width()-raster2*2, height()-raster2*2))
Thanks in advance