Skip to content

Commit

Permalink
Implement SvgTextSizeCalculator (#97)
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Komarev <akomarev@belkacar.ru>
  • Loading branch information
antonkomarev and Anton Komarev committed Jan 6, 2024
1 parent 5bdeee9 commit 6bc1998
Show file tree
Hide file tree
Showing 5 changed files with 323 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"php": "^8.1",
"ext-gd": "*",
"ext-simplexml": "*",
"cybercog/php-svg-font": "^1.0",
"kartsims/easysvg": "^2.5",
"symfony/console": "^5.0 || ^6.0 || ^7.0"
},
Expand Down
15 changes: 15 additions & 0 deletions spec/PUGX/Poser/Calculator/GDTextSizeCalculatorSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace spec\PUGX\Poser\Calculator;

use PhpSpec\ObjectBehavior;

class GDTextSizeCalculatorSpec extends ObjectBehavior
{
public function it_should_compute_text_width(): void
{
$this->calculateWidth('MIT', 8)->shouldBeLike(24.0);
$this->calculateWidth('MIT', 10)->shouldBeLike(29.0);
$this->calculateWidth('MIT', 14)->shouldBeLike(34.0);
}
}
15 changes: 15 additions & 0 deletions spec/PUGX/Poser/Calculator/SvgTextSizeCalculatorSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace spec\PUGX\Poser\Calculator;

use PhpSpec\ObjectBehavior;

class SvgTextSizeCalculatorSpec extends ObjectBehavior
{
public function it_should_compute_text_width(): void
{
$this->calculateWidth('MIT', 8)->shouldBeLike(24.1);
$this->calculateWidth('MIT', 10)->shouldBeLike(27.7);
$this->calculateWidth('MIT', 14)->shouldBeLike(34.8);
}
}
Loading

0 comments on commit 6bc1998

Please sign in to comment.