PHP | GmagickDraw settextencoding() function Last Updated : 23 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The GmagickDraw::settextencoding() function is an inbuilt function in PHP which is used to set the code set used for text annotations. These code sets tell the computer how to interpret raw zeroes and ones into real characters. Usually, they produce the same text but use different code sets. Syntax: GmagickDraw GmagickDraw::settextencoding( string $encoding ) Parameters:This function accepts a single parameter $encoding which holds the encoding. Return Value: This function returns GmagickDraw object on success. Exceptions: This function throws GmagickDrawException on error. Below given programs illustrate the GmagickDraw::settextencoding() function in PHP: Program 1: php <?php // Create a GmagickDraw object $draw = new GmagickDraw(); // Set the encoding $draw->settextencoding('utf-32'); // Get the encoding $encoding = $draw->gettextencoding(); echo $encoding; ?> Output: utf-32 Program 2: php <?php // Create a new Gmagick object // https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png $gmagick = new Gmagick('geeksforgeeks.png'); // Create a GmagickDraw object $draw = new GmagickDraw(); // Draw rectangle for background $draw->rectangle(-100, -1000, 800, 400); // Set the fill color $draw->setfillcolor('white'); // Set the font size $draw->setfontsize(30); // Set the stroke color $draw->setstrokecolor('green'); // Set the encoding $draw->settextencoding('utf-8'); // Create a rectangle $draw->annotate(20, 110, 'This text is encoded using ' . $draw->gettextencoding()); // Use of drawimage function $gmagick->drawImage($draw); // Display the output image header("Content-Type: image/png"); echo $gmagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/gmagickdraw.settextencoding.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw setTextEncoding() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Gmagick Similar Reads PHP | ImagickDraw setTextEncoding() Function The ImagickDraw::setTextEncoding() function is an inbuilt function in PHP which is used to set the code set used for text annotations. These code sets tell the computer how to interpret raw zeroes and ones into real characters. Usually, they produce the same text but use different code sets. Syntax: 2 min read PHP | ImagickDraw setTextKerning() Function The ImagickDraw::setTextKerning() function is an inbuilt function in PHP which is used to set the text kerning which defines the spacing between the text. Syntax: bool ImagickDraw::setTextKerning( float $kerning ) Parameters: This function accepts a single parameter $kerning which holds the text ker 1 min read PHP | GmagickDraw settextdecoration() Function The GmagickDraw ::settextdecoration() function is an inbuilt function in PHP that is used to specify the decoration to be applied when annotating with text. Syntax: public GmagickDraw::settextdecoration( $decoration ) : GmagickDraw Parameters: This function accepts a single parameter $decoration wh 2 min read PHP | ImagickDraw setTextDecoration() Function The ImagickDraw::setTextDecoration() function is an inbuilt function in PHP which is used to specify the decoration to be applied when annotating with text. Syntax: bool ImagickDraw::setTextDecoration( $decoration ) Parameters: This function accepts a single parameter $decoration which is used to ho 2 min read PHP | ImagickDraw setTextInterwordSpacing() Function The ImagickDraw::setTextInterwordSpacing() function is an inbuilt function in PHP which is used to used to set the text interword spacing which means nothing but space between each word. The greater the number the greater the space will be. The default spacing is 0. Syntax: bool ImagickDraw::setText 1 min read PHP | GmagickDraw setfont() function The GmagickDraw::setfont() function is an inbuilt function in PHP which is used to set the fully-specified font to use when annotating with text. Syntax: GmagickDraw GmagickDraw::setfont( string $font ) Parameters:This function accepts a single parameter $font which is used to hold the value of font 1 min read Like