Skip to content

Commit

Permalink
SVG output, text is not centered vertically (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
ValenokPC committed Jun 15, 2021
1 parent 3ab66e3 commit f501925
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Avatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,13 @@ public function toSvg()
.'" fill="'.$this->background.'" />';
}

$svg .= '<text x="'.$center.'" y="'.$center;
$svg .= '" font-size="'.$this->fontSize;
$svg .= '<text font-size="'.$this->fontSize;

if ($this->fontFamily) {
$svg .= '" font-family="'.$this->fontFamily;
}

$svg .= '" fill="'.$this->foreground.'" alignment-baseline="middle" text-anchor="middle" dominant-baseline="central">';
$svg .= '" fill="'.$this->foreground.'" x="50%" y="50%" dy=".1em" style="line-height:1" alignment-baseline="middle" text-anchor="middle" dominant-baseline="central">';
$svg .= $this->getInitial();
$svg .= '</text>';

Expand Down

0 comments on commit f501925

Please sign in to comment.