i have misunderstanding about locating the text in svg file via EasySVG. I have an image in svg format 1200x1400px.
I need to put the text to place by setting coordinates.
require '../../lib/easysvg/src/easySVG.php';
$svg = new EasySVG($pattern);
$svg->setFont($fontPath, 32, '#000000');
$ppo = 3.779527559;
$left=1200/$ppo;
$top=1400/$ppo;
//there i convert values for pxs to mms
$svg->addText("Text", $left, $top);
file_put_contents('result.svg',$svg->asXML());
The result is next image, but i really do not understand why text included in (1536;-404). Position of the "rectangle" is the same as at the 1st photo. I have never worked with vector imgs or inkscape, i admit that these coordinates could be "transformed" according to some relativities or smth like that.
Solution!
Finally my problem was solved by recalculating of x and y of added text. Here is the code that helped me.
$sizeCoef = 2.7069767442;
$newSize = $size/$sizeCoef;
//if i put 43(for example) as font size to ->setFont() method it drawed me 116.4 px height text
$ppo = 3.779527559;
//1 mm = 3.779... pxs
$shift = 1.133786;
// i do not know why, but i calculeted that if i try to shift text position,
//for example, to 100 pxs righter and 100 lower, i get text, moved by 88,2
//in both directions instead of 100 (i think it`s the solution of my problem)
$x = $left/$ppo*$shift;
$y = $top/$ppo*$shift;
// here i recalculate coordinates to mms
$svg->addText($text,$x,$y);