Tcanvas,logfont,如何在SVG中绘制文本

时间:2019-06-18 08:18:05

标签: javascript c++ node.js svg 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

我希望文字会按比例缩放,这是他对我的看法

0 个答案:

没有答案