KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Utility method for converting text to picture
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: September 5, 2023

The following utility method converts a given text into a picture.

// Method: convertTextToPicture
#DECLARE($text_t : Text; $fontName_t : Text; $fontSize_l : Integer)->$letter_m : Picture

var $svg_t; $textId_t : Text
If (Count parameters>=3)
    $svg_t:=SVG_New
    $textId_t:=SVG_New_text($svg_t; $text_t; 1; 1; $fontName_t; $fontSize_l)
    SVG EXPORT TO PICTURE($svg_t; $letter_m)
    SVG_CLEAR($svg_t)
End if


Example:

$picture:=convertTextToPicture("Hello World"; "Menlo"; 28)