freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] [GSoC] Initial canvas results


From: suzuki toshiya
Subject: Re: [ft-devel] [GSoC] Initial canvas results
Date: Thu, 22 Jun 2017 17:30:26 +0900
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Thunderbird/54.0a1

Dear Arvinder,

On 2017/06/22 0:54, Arvinder Bhathal wrote:
First, Suzuki-san had mentioned the following regarding canvas:

And, although I've not checked the latest implementation of Canvas
in modern browsers, I remember some experts complained that the
color or grayscale levels might be changed during the loading of
the pixel data onto canvas element. For bi-level monochrome images,
it would not be harmful, but, if you would consider the subpixel
or anti-alias rendering, please prepare some code to check the
hi-fideliy of canvas implementations.


Canvas does report incorrect pixel data in the case when individual
pixels are set using putImageData() with the alpha channel anything
other than 255 or 0, then read using getImageData(). This is because
pixels are set using straight alpha channel and canvas converts it to
pre-multiplied. This would be a problem if we want to change pixel
data in the browser. But, I believe we'll only be reading pixel data.
My tests confirm canvas reports the correct pixel data for grayscale
anti-aliased images. Iirc, FT uses pre-multiplied alpha values for
subpixel rendering and canvas should also report the correct pixel
data. I am testing this next.

That's good to hear, thank you for confirmation.

Next, what I've done with canvas so far:

- Generate grayscale bitmaps for characters A - Z using FT 2.5.1 and 2.8*
- Manually populate an HTML table with a few glyphs from both versions**
- Use JS to go through an array of all images in the current pages and
put them into a canvas element, zoomed in without smoothing

* I chose such an old version of FT to guarantee rendering differences
** Something to note is canvas requires a URL to the image or an HTML
element with the image. So, the HTML generation code needs to create
<img> elements of all the glyphs with the appropriate filename/type,
which are then stored in canvas elements when the .html file is
opened.

For the browser, I see the following as next steps:
- Confirm pixel data for subpixel rendering
- Test direct HTML generation using C or with an HTML templating
library to ensure no surprises later on
These two I will report back on tonight.

It should be interesting.

Regarding the glyph comparison, almost every pair of glyphs from 2.5.1
and 2.8 differ in their dimensions. As Hin-Tak has mentioned before,
1-to-1 pixel comparisons are pretty much out. I've yet to try using
the surrounding 4 or 8 pixels.

My code is in the arv-test branch and I put the files inside the
glyphtest folder. The bitmap generation code is a small snippet I
wrote using the QDBMP library. Of course, Kushal's code will be used
later on.

So now your code is ready to build & execute? I will take a look...

For now, I will work on the two items I listed above. Please respond
with any comments or concerns.

If I have something in the execution of your code, I will ask
something, but I don't have at present. Please proceed.

Regards,
mpsuzuki

_______________________________________________
Freetype-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/freetype-devel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]