1--TEST--
2Test ImagickDraw, setFontStretch
3--SKIPIF--
4<?php
5$imageMagickRequiredVersion=0x675;
6require_once(dirname(__FILE__) . '/skipif.inc');
7?>
8--FILE--
9<?php
10
11require_once(dirname(__FILE__) . '/functions.inc');
12
13$backgroundColor = 'rgb(225, 225, 225)';
14$strokeColor = 'rgb(0, 0, 0)';
15$fillColor = 'DodgerBlue2';
16
17function setFontStretch($fillColor, $strokeColor, $backgroundColor) {
18
19    $draw = new \ImagickDraw();
20    setFontForImagickDraw($draw);
21
22    $draw->setStrokeColor($strokeColor);
23    $draw->setFillColor($fillColor);
24    $draw->setStrokeWidth(2);
25    $draw->setFontSize(36);
26
27    $fontStretchTypes = array(\Imagick::STRETCH_ULTRACONDENSED, \Imagick::STRETCH_CONDENSED, \Imagick::STRETCH_SEMICONDENSED, \Imagick::STRETCH_SEMIEXPANDED, \Imagick::STRETCH_EXPANDED, \Imagick::STRETCH_EXTRAEXPANDED, \Imagick::STRETCH_ULTRAEXPANDED, \Imagick::STRETCH_ANY);
28
29    $offset = 0;
30    foreach ($fontStretchTypes as $fontStretch) {
31        $draw->setFontStretch($fontStretch);
32        $draw->annotation(50, 75 + $offset, "Lorem Ipsum!");
33        $offset += 50;
34    }
35
36    $imagick = new \Imagick();
37    $imagick->newImage(500, 500, $backgroundColor);
38    $imagick->setImageFormat("png");
39    $imagick->drawImage($draw);
40
41    $bytes = $imagick->getImageBlob();
42    if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
43}
44
45setFontStretch($fillColor, $strokeColor, $backgroundColor) ;
46echo "Ok";
47?>
48--EXPECTF--
49Ok