Skip to content

Commit

Permalink
Implement SvgTextSizeCalculator
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Komarev authored and antonkomarev committed Jan 5, 2024
1 parent 5bdeee9 commit 8ee8901
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 8ee8901

Please sign in to comment.