Issues (331)

examples/font-matrix-translation.php (4 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\Matrix;
0 ignored issues
show
The type Cairo\Matrix 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\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...
6
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...
7
8
function boxText($context, $string, $x, $y)
9
{
10
	$context->save();
11
	$ext = $context->getTextExtents($string);
12
	$lw = $context->getLineWidth();
13
	$context->rectangle($x + $ext['x_bearing'] - $lw / 2, $y + $ext['y_bearing'] - $lw / 2, $ext['width'] + $lw, $ext['height'] + $lw);
14
	$context->stroke();
15
	$context->moveTo($x, $y);
16
	$context->showText($string);
17
	$context->restore();
18
}
19
20
$surface = new Image(ImageFormat::ARGB32, 38, 34);
21
$context = new Context($surface);
22
23
$context->setSourceRgb(1, 1, 1);
24
$context->paint();
25
$context->selectFontFace('Bitstream Vera Sans');
26
$context->setFontSize(12);
27
$context->translate(4, 4);
28
$context->setLineWidth(1);
29
$context->setSourceRgb(0, 0, 0);
30
31
$ext = $context->getTextExtents('text');
32
33
boxText($context, 'text', 0, -$ext['y_bearing']);
34
35
$matrix = new Matrix();
36
$matrix->translate(6, 16);
37
$matrix->scale(12, 12);
38
$context->setFontMatrix($matrix);
39
$context->setSourceRgb(0, 0, 1);
40
41
boxText($context, 'text', 0, -$ext['y_bearing']);
42
43
$surface->writeToPng(dirname(__FILE__).'/font-matrix-translation-php.png');
44