Forum Bugs

Text SVG Filter

daneren2005
It appears that it is trying to do something, but I can't get it to work correctly. For example, here is the SVG I tried putting in:

<svg height="36.04998779296875" width="120.66667175292969">
<defs>
<filter height="160%" width="160%" y="-30%" x="-30%" id="shadow-ee3be6fc-b344-a035-312d-9f497a448c8c">
<feGaussianBlur result="glow" stdDeviation="4 4"/>
<feMerge>
<feMergeNode in="glow"/>
<feMergeNode in="glow"/>
<feMergeNode in="glow"/>
<feMergeNode in="glow"/>
<feMergeNode in="glow"/>
<feMergeNode in="glow"/>
</feMerge>
</filter>
</defs>

<text style="font-size: 19.2pt; filter: url(#shadow-ee3be6fc-b344-a035-312d-9f497a448c8c); fill: #ff8040" y="25">Type here</text>
<text style="font-size: 19.2pt;" y="25">Type here</text>
</svg>

If you run this, you will see that there is the black "Type here" text with an ever so slight orange highlight behind some of the words. I'm figuring I'm just doing this not in the way Prince was programmed to expect it. Can you specify what form I am supposed to use (or make this way work) to get filtered text behind and offseted from the original text?
mikeday
Prince does not support SVG filters, as they require rasterising the SVG to a bitmap. We plan to support this in a future release. In the meantime, you will need to rasterise the SVG to a PNG with Batik, or a similar SVG rendering tool.
daneren2005
It appears that this is supported now, but can result in terrible quality in some cases. Ie:

<svg width="127.18334045410157" height="33.866666666666674"><defs><filter x="-50%" y="-50%" width="200%" height="200%" id="drop-shadow-963a03be-b93d-25aa-c543-1f3608810e6e"><feGaussianBlur stdDeviation="0.49444444444444446 0.49444444444444446" result="shadow"/><feOffset dx="0.6944444444444444" dy="0.6944444444444444"/></filter><filter x="-50%" y="-50%" width="200%" height="200%" id="drop-shadow-d106a400-1a9a-95a3-7872-852caaef6be1"><feGaussianBlur stdDeviation="0.49444444444444446 0.49444444444444446" result="shadow"/><feOffset dx="0.6944444444444444" dy="0.6944444444444444"/></filter></defs><text x="1.6" y="19.986666666666668" class="clone" filter="url(#drop-shadow-d106a400-1a9a-95a3-7872-852caaef6be1)" fill="rgb(0, 0, 255)"><tspan style="font-size: 18.6667px;" fill-opacity="0">Type</tspan><tspan style="font-size: 18.6667px;">&nbsp;h&nbsp;moere</tspan></text><text x="1.6" y="19.986666666666668" class="clone" filter="url(#drop-shadow-963a03be-b93d-25aa-c543-1f3608810e6e)" fill="rgb(0, 255, 0)"><tspan style="font-size: 18.6667px;">Type</tspan><tspan style="font-size: 18.6667px;" fill-opacity="0">&nbsp;h&nbsp;moere</tspan></text><text x="1.6" y="19.986666666666668"><tspan style="font-size: 18.6667px;">Type</tspan><tspan style="font-size: 18.6667px;">&nbsp;h&nbsp;moere</tspan></text></svg>


is terrible, but

<svg width="655.5000061035156" height="193.8832794189453"><defs><filter x="-50%" y="-50%" width="200%" height="200%" id="drop-shadow-326e8a48-d574-ac2d-87c3-9bab3b5e760b"><feGaussianBlur stdDeviation="1.6333333333333333 1.6333333333333333" result="shadow"/><feOffset dx="1.8333333333333333" dy="1.8333333333333333"/></filter></defs><text x="1.6" y="127.67999999999998" class="clone" filter="url(#drop-shadow-326e8a48-d574-ac2d-87c3-9bab3b5e760b)" fill="rgb(255, 128, 64)"><tspan style="font-size: 128px; font-family: crafty girls;">Type&nbsp;</tspan><tspan style="font-size: 128px; font-family: crafty girls; font-weight: bold;">here</tspan></text><text x="1.6" y="127.67999999999998"><tspan style="font-size: 128px; fill: rgb(0, 255, 255); font-family: crafty girls;">Type&nbsp;</tspan><tspan style="font-size: 128px; fill: rgb(0, 255, 255); font-family: crafty girls; font-weight: bold;">here</tspan></text></svg>


is fine. I tried increasing the raster quality with `$prince->setRasterDPI(400);`, but it didn't appear to change anything here (the quality is still bad and the file size did not change).
mikeday
The latest build requires setting the filter resolution like this in CSS:
@prince-pdf {
    prince-filter-resolution: 400dpi
}

With hindsight it should probably default to the raster dpi value if none is specified. Perhaps we will change this back next release.
daneren2005
Sweet that fixed it thank you! Glad there was already an easy way to control this.