PhantomJS无法呈现斜体和粗体,但Chrome可以

时间:2016-08-23 06:22:21

标签: javascript svg phantomjs fabricjs

enter image description here

我通过phantomJS(左侧)将正常的SVG渲染为PDF, 但结果与Chrome中显示的SVG不同。

我使用的是一种叫做AlexBrush'的字体,这是一种真正的字体并且只有常规的样式,我想粗体和斜体的结果只是" SIMULATED"通过铬?

如何像幻灯片一样正确渲染phantomJS?

这是我的测试SVG的一部分,它由fabricJS生成:

<g transform="translate(509.4 276.56) scale(3.89 3.89)">
    <text font-family="AbrilFatface" font-size="42" font-weight="normal" style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" >
        <tspan x="-131.5" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;">i</tspan>
        <tspan x="-122.01" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;">t</tspan>
        <tspan x="-109.53" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;"> </tspan>
        <tspan x="-101.22" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;">i</tspan>
        <tspan x="-91.73" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;">s</tspan>
        <tspan x="-76.65" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;"> </tspan>
        <tspan x="-68.33" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;">a</tspan>
        <tspan x="-51.03" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;"> </tspan>
        <tspan x="-42.71" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;">l</tspan>
        <tspan x="-32.51" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;">a</tspan>
        <tspan x="-15.2" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;">z</tspan>
        <tspan x="1.01" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;">y</tspan>
        <tspan x="16.55" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;"> </tspan>
        <tspan x="24.87" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;">f</tspan>
        <tspan x="35.03" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;">o</tspan>
        <tspan x="46.83" y="13.23" font-family="AlexBrush" font-weight="bold" style="stroke: rgb(0,0,0); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: ; opacity: 1;">x</tspan>
    </text>
</g>

更新:所以这&#34; SIMULATED&#34;风格被称为&#34; FAUX&#34;胆大。 但是,我仍然不知道如何让phantomJS像chrome那样做。

http://alistapart.com/article/say-no-to-faux-bold

0 个答案:

没有答案