freetype
[Top][All Lists]
Advanced

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

[ft] [GSoC-2017] Test Framework for FreeType's Rendering Output


From: Kushal K S V S
Subject: [ft] [GSoC-2017] Test Framework for FreeType's Rendering Output
Date: Tue, 29 Aug 2017 19:24:35 +0530

Hi everyone,
I am Kushal K S V S. This summer, I've been working for FreeType as a part
of
Google Summer of Code 2017. I am thrilled to present my project to everyone.

I've developed a Test Framework for FreeType's rendering output. This tool
enables the developer to compare the rendering output of a 'base' version
to a 'test' (developer) version of FreeType.

Working Branch: http://git.savannah.gnu.org/cgit/freetype/freetype2.
git/?h=GSoC-2017-kushal
Full Diff:
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/diff/?id=973cace&id2=6362455^

For the working of the Project, go through README in the 'Working Branch'
link above.

My Summer at FreeType

1. Spent the first month going through the codebase and documentation
thoroughly and getting
    ready with the tools to implement the project.
    My First objective was to generate bitmap images for given font /
rendering mode / point size
    / dpi and to calculate MurmurHash3 checksums to compare the image data
of the two glyphs
    rendered using two version of FreeType.
    Although I was able to generate and compare bitmaps for different
versions of FreeType,
    bitmaps turned out to be a bad image format because the images are
uncompressed and are
    of very big size.
    The challenging part was to figure out the efficient way to take out
the image data from
    FT_Bitmap's buffer and write it to the image for LCD rendered glyphs.
    ( http://git.savannah.gnu.org/cgit/freetype/freetype2.git/di
ff/?id=b9e22a2&id2=6362455^ )

2. Next, I switched to PNG's for storing the images using the library
libpng. I had to write the
    whole code again. This didn't take long because now I had idea how to
render images
    using FreeType.
    I was running the code two times. Once to generate images for the
'base' version
    and one for the 'test' version. Then I was reading from the PNG files
to get the image data
    and then compare the data to generate image(s) after adding
effects.This had major
    problems.
    -- Too many image files.
    -- Extra files for Murmur3Hash checksums.
    -- Reading and Writing the PNG(s) again making the program in
inefficient.
    -- Huge amounts of memory was taken up by the program.
    ( http://git.savannah.gnu.org/cgit/freetype/freetype2.git/di
ff/?id=dc937cc&id2=690f255^ )

3. The solution to decrease memory usage and increase speed was to
dynamically link the code
    to the two versions of the library. This way, running the code once will
    --compare two version's image data for all glyphs in the font.
    --Add effects and generate all PNG(s) needed.
    ( These effects help the user visualise the pixel by pixel differences
in the two images of the
    same glyph rendered with two different versions of FreeType. )

4. But the number of PNG(s) was too high so my mentors came up with an idea
of using CSS
    Sprite Sheets. This fits all the images related to a glyph in one
image. This reduced the
    number of images four fold.
    -- A challenge was to compare the images generated by the two versions
if the dimensions
       are different. I solved this by aligning the images with respect to
a corner pixel and then
       padding the smaller image with white pixels.
    ( http://git.savannah.gnu.org/cgit/freetype/freetype2.git/di
ff/?id=9e1a9aa&id2=4860049^ )

5. Next comes the part to generate HTML pages to list all the glyphs
generated. This was done
    using File IO functions in C. Listing was done using
    -- Glyph Index
    -- Glyph Name
    -- Difference Metric
    along with the sprite sheets.
   To visualise the differences, I used CSS3 Animations and devised an
interactive webpage.
    ( http://git.savannah.gnu.org/cgit/freetype/freetype2.git/di
ff/?id=39bac75&id2=2774a43^ )

6. At last all this was automated using shell script so that the user
can simultaneously test for
    various fonts / render modes / point sizes / dpi and for FreeType
versions of his/her choice.
    The challenging part was to organise all the files generated and to
link all the files to one
    HTML file so that all the glyphs can be examined from one page itself.

    All the code to generate PNG(s) and HTML pages was written in ANSI C.
    ( http://git.savannah.gnu.org/cgit/freetype/freetype2.git/di
ff/?id=3fdabcd&id2=8bbefa6^ )
    ( http://git.savannah.gnu.org/cgit/freetype/freetype2.git/di
ff/?id=973cace&id2=b9120a7^ )

I had an awesome experience working with FreeType. I'd like to thank the
FreeType community
and my mentors for giving all the guidance needed along the way. I am proud
to be a part of the
FreeType community.

Testing and Debugging.
    --Code is made readable and comments are added.

Note: There is a problem with the output in the chrome browse.
          Memory leakages are being fixed.
          Additional features are to be added.


reply via email to

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