Friday, June 12, 2026
HomeLanguagesPHP | Imagick queryFonts() Function

PHP | Imagick queryFonts() Function

The Imagick::Imagick::queryFonts function is an inbuilt function in PHP which is used to returns the configured fonts of Imagick library.

Syntax:

array Imagick::queryFonts( $pattern = "*" )

Parameters: This function accepts single parameter $pattern which stores the value of the query pattern.

Return Value: This function returns an array containing all configured fonts.

Below programs illustrate the Imagick::queryFonts() function in PHP:

Program 1:




<?php 
  
$output = '';
$output .= "Fonts that match 'Times*' are:<br>";
  
// Imagick Object
$fontList = Imagick::queryFonts( "Times*" );
   
foreach ($fontList as $fontName) {
    $output .= $fontName;
}
  
// Output
echo $output; 
?>


Output:

Fonts that match 'Times*' are:
Times-Bold
Times-BoldItalic
Times-Italic
Times-Roman

Program 2:




<?php
  
// Create new Imagick object
$im = new Imagick(); 
  
// Display all fonts
var_dump( $im->queryFonts() ); 
?>


Output:

string(5) "array"
array(326) {
  [0] => string(5) "aakar"
  [1] => string(14) "Abyssinica-SIL"
  ...
  ...
  ...
  [325] => string(13) "Waree-Oblique"
}

Reference: http://php.net/manual/en/imagick.queryfonts.php

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12013 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6964 POSTS0 COMMENTS