Array Index Out of Bounds error on PGraphics.text()

Well-thought out workaround! If the 2nd and/or the 3rd passed arguments are floating values, the 7th signature kicks in, b/c the 4th sig demands int values for its index parameters: :ok_hand:

size(100, 100)
noLoop()

pg = createGraphics(width, height)
s = 'QuickFox'

with pg.beginDraw():
    pg.textSize(020)
    pg.fill(0xffFFFF00)
    pg.text(s, 10, 10.0, width>>1, height>>1)

background(0xff0000FF)
image(pg, 0, 0)

Another workaround is to go w/ the 3rd sig if you don’t need the box constraint: :flushed:
text(str, x, y)

Notice this overloaded mess doesn’t affect the “global canvas” PApplet::text(): :open_mouth:

Only when we’re using the PGraphics::text() returned from PApplet::createGraphics(): :roll_eyes:

1 Like