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 4, 2024
1 parent d54c56d commit f7a3e6d
Show file tree
Hide file tree
Showing 5 changed files with 326 additions and 1 deletion.
5 changes: 4 additions & 1 deletion 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": "dev-master",
"kartsims/easysvg": "^2.5",
"symfony/console": "^5.0 || ^6.0 || ^7.0"
},
Expand Down Expand Up @@ -71,5 +72,7 @@
"branch-alias": {
"dev-master": "2.x-dev"
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
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 f7a3e6d

Please sign in to comment.