Gradients of multline text

I’m just converting an old app from graphics 1 to graphics 2. It’s quite an old app; it even predated multiline text support! Back in the day I used an old function to manually split long strings into a group of text display objects. That allowed me to then apply an individual gradient to every line of text, which looked quite nice. Now I’ve gotten rid of the code, I discovered that applying a gradient to a text object applies it to all lines. In hindsight that’s not surprising.

Anyway, I was wondering whether anyone has managed to recreate individual line stylings in G2 - or do I just need to revert the code to its pre graphics 2 ways?

Eh, not sure how robust this is, it involves some guestimation, but here’s my solution:
  

[lua]local text=display.newText({ … })

local paddedFont=size/0.7 – based on a few experiments, but I wont vouch for how accurate it is
local lines=math.floor(text.height/paddedFont+0.5)
display.setDefault( “textureWrapY”, “repeat” )
text.fill={ type=“image”, filename=“img/texttexture.png” }
local textureHeight=200 – hard coded but could be read from image
text.fill.scaleY=1/lines
text.fill.y=(lines+1%2)*0.5[/lua]

Eh, not sure how robust this is, it involves some guestimation, but here’s my solution:
  

[lua]local text=display.newText({ … })

local paddedFont=size/0.7 – based on a few experiments, but I wont vouch for how accurate it is
local lines=math.floor(text.height/paddedFont+0.5)
display.setDefault( “textureWrapY”, “repeat” )
text.fill={ type=“image”, filename=“img/texttexture.png” }
local textureHeight=200 – hard coded but could be read from image
text.fill.scaleY=1/lines
text.fill.y=(lines+1%2)*0.5[/lua]