Tech Tip: Utility method to convert text into picture.
PRODUCT: 4D | VERSION: 20 R | PLATFORM: Mac & Win
Published On: January 27, 2025
The followiing is a utility method to convert a given text into a picture.
// Method: textToPicture #DECLARE($text_t : Text; $font_t : Text; $size_l : Integer) : Picture var $svg_t; $tid_t : Text var $text_m : Picture If ($font_t="") $font_t:="Arial" End if If ($size_l=0) $size_l:=42 End if $svg_t:=SVG_New $tid_t:=SVG_New_text($svg_t; $text_t; 1; 1; $font_t; $size_l) SVG EXPORT TO PICTURE($svg_t; $text_m) SVG_CLEAR($svg_t) CONVERT PICTURE($text_m; ".jpg") return $text_m |
Example:
$picture:=textToPicture("Hello 4D Developer"; "Courier"; 36) |
