Issues (331)

examples/text-extents.php (3 issues)

Labels
Severity
1
<?php
2
3
use Cairo\Context;
0 ignored issues
show
The type Cairo\Context was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
4
use Cairo\Surface\Image;
0 ignored issues
show
The type Cairo\Surface\Image was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
5
use Cairo\Surface\ImageFormat;
0 ignored issues
show
The type Cairo\Surface\ImageFormat was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
8
$char = 'Cairo';
9
$surface = new Image(0, 500, 500);
10
$context = new Context($surface);
11
12
$context->selectFontFace('Sans');
13
$context->setFontSize(100);
14
$ext = $context->getTextExtents($char);
15
16
$x = 25.0;
17
$y = 150.0;
18
$context->moveTo($x, $y);
19
$context->showText($char);
20
21
$context->setSourceRgba(1, 0.2, 0.2, 0.6);
22
$context->setLineWidth(6.0);
23
$context->arc($x, $y, 10, 0, 2 * 3.14);
24
$context->fill();
25
$context->moveTo($x, $y);
26
$context->relLineTo(0, -1 * $ext['height']);
27
$context->relLineTo($ext['width'], 0);
28
$context->relLineTo($ext['x_bearing'], -1 * $ext['y_bearing']);
29
$context->stroke();
30
31
$surface->writeToPng(dirname(__FILE__).'/text-extents-php.png');
32