Hello again! I'm here to say help no more required. I solved the issue! I wanted to write here my solution, in case someone else will have some similar issue to solve.
It was simple enough: i used the PHP function imagettfbbox().
Evenif i always thought it returns the real bounding box of a truetype text, i found that the values of it's array had some "gaps" inside. If you do something like:
$lineinfo=imagettfbbox(90,0,$fontfilename,$textline);
You can generally find out text width and height this way:
$line_h=abs($lineinfo[1]-$lineinfo[7]); $line_w=abs($lineinfo[2]-$lineinfo[0]);
But indexes 1 and 7 are not only zero and textheight: if there's a descender or an ascender, you will see also negative values there. So, $lineinfo[1] is simply... the descender offset!
My solution then was easy: i simply made a proportion.
$svg_descender/$calculated_descender=$svg_height/$calculated_height
So:
$svg_descender=($svg_height/$line_h)*$lineinfo[1];
If you do know $svg_height, which is the svg offset you have to "sit" your text to, this helps a lot.
Cya!