php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70488 GMagick fails to render Google Fonts in SVG
Submitted: 2015-09-14 09:51 UTC Modified: -
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: sayan dot engineer at gmail dot com Assigned:
Status: Open Package: gmagick (PECL)
PHP Version: Irrelevant OS: Ubuntu
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-09-14 09:51 UTC] sayan dot engineer at gmail dot com
Description:
------------
My Ubuntu 14.04 laptop has GraphicsMagick and the PHP extension (GMagick) installed. When I run the following from the command line,

gm convert -font /usr/share/fonts/truetype/google-fonts/RockSalt.ttf svg_file.svg jpeg_file.jpg

renders the JPEG with the font as desired. However, the PHP code fails to do the same and creates a JPEG with a default font. What could be the issue here?

This is the SVG:

<?xml version="1.0"?><svg xmlns="http://www.w3.org/2000/svg"    xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="737" height="521"><defs/> <g class="main">  <title>Main</title>  <rect fill="#ffffff" stroke-width="0" x="27.24188" y="429.44421" width="682.51626" height="68.18413" id="svg_2" class="element" opacity="0.75" stroke="#000000"/>  <g text-anchor="start" font-family="Rock Salt" fill="#000" font-size="20" class="element textarea" id="svg_3">   <rect opacity="0"  stroke-width="0" x="27.24188" y="429.44421" width="682.51626" height="68.18413" id="svg_4"/>   <g class="textGroup">    <text class="eol" y="470.98331" x="44.46314" xml:space="preserve">Your&#xA0;memories&#xA0;will&#xA0;last&#xA0;forever</text>   </g>  </g> </g></svg>

Test script:
---------------
$gm = new Gmagick();
$draw = new GmagickDraw();
$draw->setfont("/usr/share/fonts/truetype/google-fonts/RockSalt.ttf");
$gm->readImageBlob($svg);
$gm->setImageFormat("jpeg");
$gm->drawimage($draw);
$gm->writeImage($jpgFile);
$gm->clear();


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 07:01:29 2024 UTC