Bold font is *too* bold when rendering as SVG.

33 views
Skip to first unread message

ZHUO Qingliang (KDr2)

unread,
Oct 25, 2019, 2:36:08 AM10/25/19
to Skia-discuss
I attached two images in this mail. Then are both rendered by Skia from the same instructions,
but one rendered as PNG while another rendered as SVG.

As you see, in the SVG one, the bold font is rendered too bold, do we have any options to let it
rendered the same as the PNG driver?


More concretely, I am using PDFium with its Skia backend, and the images are from one same
PDF page. So I can't simply give out the drawing instructions to reproduce these two images,
but I am sure the PDF file is the same one and the difference is that I use different Skia device
drivers.

Does anyone know why this happens and how to get a not such bold rendering while using SVG
device drivers?

Greetings.

ZHUO Qingliang (KDr2, http://kdr2.com)

Skia-PNG-300.png
Skia-SVG-300.png

ZHUO Qingliang (KDr2)

unread,
Oct 28, 2019, 4:32:22 AM10/28/19
to 'ZHUO Qingliang (KDr2)' via skia-discuss
Hi all,

I found it is caused by a not proper `strike-width` attribute of the path node.

The path node Skia generated for the bold text has `stroke-width="1.0003362"`. If I change
this value to 0.2, it will get the same effect as the PNG.

I saw that the `stroke-width` attribute is set in `SkSVGDevice::AutoElement::addPaint` and
the value is simply gotten from the paint. So it must somewhere we set this value (maybe
after getting it from the font and doing some calculation?) into the paint before we use it here, 
did anyone know where to find this detail?


Greetings.

ZHUO Qingliang (KDr2, http://kdr2.com)

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/670494313.486594.1571985364335%40mail.yahoo.com.

Ben Wagner

unread,
Nov 4, 2019, 11:58:43 AM11/4/19
to skia-d...@googlegroups.com
I believe the issue here is that some stroking is being applied twice.
Once by the SkScalerContext when computing the SkPath and then applied
again when drawing that SkPath with a paint which still has a stroke
on it. If the SkFont is set as Embolden, it may also be applying a
stroke. We're currently in the process of consolidating a bunch of
code in this area and may be able to fix issues like this soon.

On Mon, Oct 28, 2019 at 4:32 AM 'ZHUO Qingliang (KDr2)' via
> To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/331261871.1200890.1572251533809%40mail.yahoo.com.
Reply all
Reply to author
Forward
0 new messages