Change language

PHP Imagick function queryFontMetrics ()

Syntax:
array Imagick::queryFontMetrics ($properties, $text, $multiline)
Parameters: This function takes three parameters as above and described below:
  • $properties:This parameter contains the properties of the font.
  • $text:this parameter contains text content.
  • $multiline:contains the multiline parameter. If left blank, it is automatically detected.
Return Value: Returns a multidimensional array representing font metrics.The following program illustrates the Imagick function::queryFontMetrics() in PHP: Program: This example returns the font properties of the text content "GeeksForGeeks".
/ * Create a new Imagick object * / $im = new Imagick();  
/ * Create ImagickDraw object * / $draw = new ImagickDraw();  
/ * Install font * / $draw -> setFillColor ( new ImagickPixel ( ’gray’ ));  
// Top left will be the starting point $draw -> setGravity (Imagick::GRAVITY_NORTHWEST);  
/ * Dump font metrics, autodetect multiline * / var_dump ( $im -> queryFontMetrics ( $draw , "GeeksForGeeks" ));  
?>
Output:
array (10) {["characterWidth"] = > float (12) ["characterHeight"] = > float (12) ["ascender"] = > float (9) ["descender"] = > float (-3) ["textWidth"] = > float (88) ["textHeight"] = > float (15) ["maxHorizontalAdvance"] = > float (13) ["boundingBox"] = > array (4) {["x1"] = > float (0.40625) ["y1"] = > float (-0.046875) ["x2"] = > float (5.515625) ["y2"] = > float (7)} ["originX"] = > float (88) ["originY"] = > float (0)}
Link: https://www .php.net / manual / en / imagick.queryfontmetrics.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method