Skip to content

[QUESTION] Achieve same text rendering like Chrome #1253

@Danielku15

Description

@Danielku15

The question might sound stupid at the beginning but please give it a chance 😉 It might not be dedicated 100% to this library but I'm giving it a shot to maybe catch an expert.

How can I achieve the exact same text/font rendering as Chrome does it with the HTML5 canvas?

I am maintaining a library available in JavaScript and in .net which is rendering music notation to a canvas. For this library I created a visual regression test suite based on images rendered in Chrome. On my .net version I use SkiaSharp and my tests fail with slight differences on the text rendering.

As Chrome is using Skia underneath and I'm testing on the same machine/platform I guess it should be possible to achieve the same render output. Here an example test that fails:

Reference (Chrome) SkiaSharp
image image
image image

The difference is subtle for humans but significant on technical comparison. On the first example you can see it very good on the character t of "Standard" how the character alignment is different. Also the whole anti aliasing is slightly different heavily on the second example.

Are there some special settings on the font rendering and anti aliasing that chrome uses? Do they use a different text shaper than SkiaSharp? Skia mentions that the text layouting is done by another library and Chrome is using HarfBuzz. For text hinting I guess GDI is used.

I am wondering if SkiaSharp is using the same settings as Chrome for compiling Skia native. Are there settings to control the text rendering allowing me to achieve the same output in SkiaSharp as in Chrome?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions