| 4D v18SVG_New_text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | 
    4D v18
 SVG_New_text 
         | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SVG_New_text ( parentSVGObject ; Text {; x {; y {; font | styleDef {; Größe {; Stil {; Ausrichtung {; color {; rotation {; lineSpacing {; stretching}}}}}}}}}} ) -> Funktionsergebnis | ||||||||
| Parameter | Typ | Beschreibung | ||||||
| parentSVGObject | SVG_Ref |   | Reference of parent element | |||||
| Text | Text |   | Text to insert | |||||
| x | Zahl |   | Coordinate on X axis | |||||
| y | Zahl |   | Coordinate on Y axis | |||||
| font | styleDef | Text |   | Font name or Style definition | |||||
| Größe | Lange Ganzzahl |   | Size of characters in points | |||||
| Stil | Lange Ganzzahl |   | Style of characters | |||||
| Ausrichtung | Lange Ganzzahl |   | Alignment | |||||
| color | String |   | Text color | |||||
| rotation | Zahl |   | Angle of rotation of text | |||||
| lineSpacing | Zahl |   | Line spacing in points | |||||
| stretching | Zahl |   | Horizontal stretch factor | |||||
| Funktionsergebnis | SVG_Ref |   | Reference of SVG text object | |||||
The SVG_New_text command inserts the text in text in the SVG container designated by parentSVGObject and returns its reference. If parentSVGObject is not an SVG document, an error is generated.
Note: Starting with 4D v15, the SVG_New_text command supports simple Styled text (the text can contain different styles, but SPAN attributes must not be nested). See example 5.
The optional x and y parameters can be used to specify the position on the X and Y axis of the upper corner of the first character of text. This point is situated differently according to the alignment value: to the left for a left alignment, to the right for a right alignment or in the center when the text is centered.
The SVG_New_text command accepts two different syntaxes for setting characters:
0 = PlainThe optional alignment parameter can be used to set the type of alignment to be applied to the drawn text. You can pass one of the following values:
1 = Bold
2 = Italic
4 = Underline
8 = Strikethrough
2 = Align left
3 = Center
4 = Align right
The optional color parameter contains  the name of the font color. (For more information about colors, please  refer to the Colors and Gradients section).
The optional rotation parameter can be used to specify the rotation to be applied to the text.
The optional lineSpacing parameter can be used to specify the value of the line spacing if the text has more than one line. Default value = 1.
The optional stretching parameter can  be used to specify a horizontal stretching (value >1) or condensing  (value included between 0 and 1) factor of the text.
 SVG_New_textArea($Dom_svg;"Hello World !";x;y;vWidth;vHeight;style_definition)style="font-size:48px;fill:red;"
Simple text using default text properties:
 $SVG:=SVG_New
 $textID:=SVG_New_text($SVG;"Hello world!")Text that is blue, italic, underlined and aligned to the right:
 $SVG:=SVG_New
 $text:="Hello world!\rBonjour le monde!\rHola Mundo!"
 $size:=48
 $font:="helvetica"
 $textID:=SVG_New_text($SVG;$text;400;10;$font;$size;Italic+Underline;Align right;"blue")Vertical text:
 $SVG:=SVG_New
 $textID:=SVG_New_text($SVG;$text;-250;0;"";48;-1;-1;"red";-90)Condensed or expanded text:
 $SVG:=SVG_New
 $textID:=SVG_New_text($SVG;"Hello world (condensed)";0;0;"";-1;-1;-1;"blue";0;1;0,8)
 $textID:=SVG_New_text($SVG;"Hello world (normal)";0;24)
 $textID:=SVG_New_text($SVG;"Hello world (stretched)";0;48;"";-1;-1;-1;"red";0;1;2)Display of multi-style text:
 C_TEXT($Dom_svg;$Dom_text;$Txt_buffer)
  //definition of multi-style text
 $Txt_buffer:="<SPAN STYLE=\"font-size:18pt\">Hello </SPAN>"+\
 "<SPAN STYLE=\"font-size:24pt;font-weight:bold;color:#D81E05\">World</SPAN>"+\
 "<SPAN STYLE=\"font-size:36pt\">!</SPAN><BR/>"+\
 "<SPAN STYLE=\"font-size:19pt;font-style:italic\">It's </SPAN>"+\
 "<SPAN STYLE=\"font-size:24pt\">Monday</SPAN>"
 $Dom_svg:=SVG_New
 
  //title
 SVG_SET_FONT_COLOR(SVG_New_text($Dom_svg;"_______ svg_Newtext _______";10;30);"blue")
  //text
 $Dom_text:=SVG_New_text($Dom_svg;$Txt_buffer;50;50)
 
 SVGTool_SHOW_IN_VIEWER($Dom_svg)
 SVG_CLEAR($Dom_svg)
	Produkt: 4D
	Thema: Text
	Nummer: 
        65958
        
        
        
	
	Erstellt: Composant 4D SVG v11.3
	Geändert: 4D v13
	
	
	
	
	4D SVG ( 4D v18)
	
	
 Fehler melden
Fehler melden