Skip to content

Commit

Permalink
maint: Improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
famoser committed Dec 29, 2024
1 parent 2679458 commit 7a1e7a7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Frontend/Printer.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,18 @@ public function printText(string $text, TextStyle $textStyle): void
*/
public function printPhrases(array $phrases): void
{
$heightShift = 0;
if (count($phrases) > 0) {
$phrase = $phrases[0];
$fontMeasurement = $this->fontRepository->getFontMeasurement($phrase->getTextStyle());
$heightShift = $fontMeasurement->getAscender();
}

/** @var Text\Phrase[] $IRPhases */
$IRPhases = [];
foreach ($phrases as $phrase) {
$textStyle = self::createTextStyle($phrase->getTextStyle());
$IRPhases[] = new Text\Phrase($phrase->getText(), $textStyle);
}

$heightShift = 0;
if (count($phrases) > 0) {
$fontMeasurement = $this->fontRepository->getFontMeasurement($phrases[0]->getTextStyle());
$heightShift = $fontMeasurement->getAscender();
}
$position = $this->getPosition($heightShift);

$paragraph = new Paragraph($IRPhases, $position);
Expand Down

0 comments on commit 7a1e7a7

Please sign in to comment.