Last active
March 4, 2019 10:45
-
-
Save ameenross/e8192222a5414b7de4e99c4bb500a253 to your computer and use it in GitHub Desktop.
Just output a table with fonts and their appearance in PHP Imagick. Inspired by Stefano: http://php.net/manual/en/imagick.queryfonts.php#121010
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach (Imagick::queryFonts() as $fontName) { | |
$image = new Imagick; | |
$draw = new ImagickDraw; | |
$draw->setGravity(Imagick::GRAVITY_CENTER); | |
$draw->setFont($fontName); | |
$draw->setFontSize(12); | |
$draw->setFillColor('black'); | |
$image->newImage(300, 20, 'lightblue'); | |
$image->annotateImage($draw, 0, 0, 0, $fontName); | |
$image->setImageFormat('png'); | |
$base64 = base64_encode($image); | |
echo "<img src='data:image/png;base64,{$base64}'> {$fontName} <br>"; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment