First off I recommend reading about Custom WPS in your device manual
specifically about %s and %ss
https://www.rockbox.org/wiki/CustomWPS#Other_Tags%ss(start, length, tag) Get a substring of another tags value
Do note:
this link is out of date the one in manual will be more up to date..
both DO contain inaccuracies.
That being said you could probably (ab)use the theme parser something like this..
%?if(%ss(0, 10, %it), =, %it)<%al%it|%al%ss(0, 10, %it)>
%?if(%ss(10, 10, %it), =, %ss(10, 10, %it))<%ss(10, 10, %it)|%s%ac%?ia<%ia|Unknown Artist>>
that breaks down like this:
%?if(%ss(0, 10, %it), =, %it)<%al%it | %al%ss(0, 10, %it)>
if string < 11 then display track name (else) then display 10 chars
%?if(%ss(10, 10, %it), =, %ss(10, 10, %it))<%ss(10, 10, %it) | %s%ac%?ia<%ia|Unknown Artist>>
if string > 10 then display 10 more (else) then display artist name
I 'THINK' you could probably carry it out further with..
%?if(%ss(20, 10, %it), =, %ss(20, 10, %it))<%ss(20, 10, %it)|%s%ac%?ia<%ia|Unknown Artist>>
this seems like it could get complicated quickly depending how many variables you wanted to do this with.