Tcanvas, logfont, Как нарисовать текст в SVG - PullRequest
0 голосов
/ 18 июня 2019

Я сейчас программирую конвертер для своей компании.Они использовали tcanvas для рисования.Я должен написать конвертер, который рисует SVG.Пока у меня нет проблем, но я не могу идти в ногу с текстом, потому что я не могу его масштабировать

Я уже пытался адаптировать текст с помощью "transform = 'scale'".

TCANVAS (как они привыкли рисовать)

    TCanvas = *dc
    dc->Brush->Style = bsClear; //eliminate flicker when the object repaints. 
    dc->Font->Name = "Arial";   //set Font to Arial
    dc->Font->Color = (TColor) Farben[Farbe];   //Set color to givenColor
    GetObject (dc->Font->Handle, sizeof (logFont), &logFont); //what is logfont and how i get this in SVG
    logFont.lfWidth  = Groesse.x;   //set width
    logFont.lfHeight = Groesse.y;   //set height
    unsigned int OldAlign = SetTextAlign (dc->Handle, TA_LEFT | TA_TOP);    // set align but wtf where? 
    dc->TextOut (Point.x + offset->x, Point.y + offset->y, Texte);  //print text
    SetTextAlign (dc->Handle, OldAlign);    //set align

SVG (Мой новый конвертер в JS)

     svg = svg + "<text x='" + x+ "' y='" + (y +dy)+ "'  style='fill:"+farbe+"; font-family:Arial;'>" + text + "  </text> \n";

 farbe: is the given Color.
    x: is the x position of the text
    y: is the y position of the text
    dx: is the width of a letter
    dy: is the height of a letter
    text: is the printed text
    textlänge: is the length of the text

For Example:
    farbe: #0000ff
    x: 9
    y: 14
    dx: 5
    dy: 9
    text: "FILTER"
    textlänge: 6

Я ожидаю, что текст будет масштабироваться, что он не делает со мной

...