[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freetype-devel
Subject:    [ft-devel] [GSoC-2017] Test Framework for FreeType's Rendering Output
From:       Kushal K S V S <kkushal32 () gmail ! com>
Date:       2017-08-29 13:54:59
Message-ID: CAN7frnH_5ozR8GqNtDgKwYZ_=M75xFGJUt6RAMzoOZdZf5fYcQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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.

[Attachment #5 (text/html)]

<div dir="ltr"><span style="font-size:12.800000190734863px">Hi everyone,</span><div \
style="font-size:12.800000190734863px">I am Kushal K S V S. This summer, I&#39;ve \
been working for FreeType as a part of  </div><div \
style="font-size:12.800000190734863px">Google Summer of Code 2017. I am thrilled to \
present my project to everyone.</div><div \
style="font-size:12.800000190734863px"><br></div><div \
style="font-size:12.800000190734863px">I&#39;ve developed a Test Framework for \
FreeType&#39;s rendering output. This tool  </div><div \
style="font-size:12.800000190734863px">enables the developer to compare the rendering \
output of a &#39;base&#39; version</div><div \
style="font-size:12.800000190734863px">to a &#39;test&#39; (developer) version of \
FreeType.</div><div style="font-size:12.800000190734863px"><br></div><div \
style="font-size:12.800000190734863px">Working Branch:  <a \
href="http://git.savannah.gnu.org/cgit/freetype/freetype2.git/?h=GSoC-2017-kushal" \
target="_blank">http://git.savannah.gn<wbr>u.org/cgit/freetype/freetype2.<wbr>git/?h=GSoC-2017-kushal</a></div><div \
style="font-size:12.800000190734863px">Full Diff:  <span style="font-size:small"><a \
href="http://git.savannah.gnu.org/cgit/freetype/freetype2.git/diff/?id=973cace&amp;id2 \
=6362455^">http://git.savannah.gnu.org/cgit/freetype/freetype2.git/diff/?id=973cace&amp;id2=6362455^</a> \
</span></div><div style="font-size:12.800000190734863px">For the working of the \
Project, go through README in the &#39;Working Branch&#39; link above.</div><div \
style="font-size:12.800000190734863px"><br></div><div \
style="font-size:12.800000190734863px">My Summer at FreeType</div><div \
style="font-size:12.800000190734863px"><br></div><div \
style="font-size:12.800000190734863px">1. Spent the first month going through the \
codebase and documentation thoroughly and getting</div><div \
style="font-size:12.800000190734863px">      ready with the tools to implement the \
project.  </div><div style="font-size:12.800000190734863px">      My First objective \
was to generate bitmap images for given font / rendering mode / point size  \
</div><div style="font-size:12.800000190734863px">      / dpi and to calculate \
MurmurHash3 checksums to compare the image data of the two glyphs</div><div \
style="font-size:12.800000190734863px">      rendered using two version of \
FreeType.</div><div style="font-size:12.800000190734863px">      Although I was able \
to generate and compare bitmaps for different versions of FreeType,</div><div \
style="font-size:12.800000190734863px">      bitmaps turned out to be a bad image \
format because the images are uncompressed and are  </div><div \
style="font-size:12.800000190734863px">      of very big size.</div><div \
style="font-size:12.800000190734863px">      The challenging part was to figure out \
the efficient way to take out the image data from   </div><div \
style="font-size:12.800000190734863px">      FT_Bitmap&#39;s buffer and write it to \
the image for LCD rendered glyphs.  </div><div \
style="font-size:12.800000190734863px">      (  <a \
href="http://git.savannah.gnu.org/cgit/freetype/freetype2.git/diff/?id=b9e22a2&amp;id2 \
=6362455^">http://git.savannah.gnu.org/<wbr>cgit/freetype/freetype2.git/di<wbr>ff/?id=b9e22a2&amp;id2=6362455^</a> \
)<br></div><div style="font-size:12.800000190734863px"><br></div><div \
style="font-size:12.800000190734863px">2. Next, I switched to PNG&#39;s for storing \
the images using the library libpng. I had to write the</div><div \
style="font-size:12.800000190734863px">      whole code again. This didn&#39;t take \
long because now I had idea how to render images  </div><div \
style="font-size:12.800000190734863px">      using FreeType.  </div><div \
style="font-size:12.800000190734863px">      I was running the code two times. Once \
to generate images for the &#39;base&#39; version  </div><div \
style="font-size:12.800000190734863px">      and one for the &#39;test&#39; version. \
Then I was reading from the PNG files to get the image data</div><div \
style="font-size:12.800000190734863px">      and then compare the data to generate \
image(s) after adding effects.This had major  </div><div \
style="font-size:12.800000190734863px">      problems.</div><div \
style="font-size:12.800000190734863px">      -- Too many image files.</div><div \
style="font-size:12.800000190734863px">      -- Extra files for Murmur3Hash \
checksums.</div><div style="font-size:12.800000190734863px">      -- Reading and \
Writing the PNG(s) again making the program in inefficient.</div><div \
style="font-size:12.800000190734863px">      -- Huge amounts of memory was taken up \
by the program.<br></div><div style="font-size:12.800000190734863px">      (  <a \
href="http://git.savannah.gnu.org/cgit/freetype/freetype2.git/diff/?id=dc937cc&amp;id2 \
=690f255^">http://git.savannah.gnu.org/<wbr>cgit/freetype/freetype2.git/di<wbr>ff/?id=dc937cc&amp;id2=690f255^</a> \
)</div><div style="font-size:12.800000190734863px"><br></div><div \
style="font-size:12.800000190734863px">3. The solution to decrease memory usage and \
increase speed was to dynamically link the code</div><div \
style="font-size:12.800000190734863px">      to the two versions of the library. This \
way, running the code once will</div><div style="font-size:12.800000190734863px">     \
--compare two version&#39;s image data for all glyphs in the font.</div><div \
style="font-size:12.800000190734863px">      --Add effects and generate all PNG(s) \
needed.</div><div style="font-size:12.800000190734863px">      ( These effects help \
the user visualise the pixel by pixel differences in the two images of the  \
</div><div style="font-size:12.800000190734863px">      same glyph rendered with two \
different versions of FreeType. )</div><div \
style="font-size:12.800000190734863px"><br></div><div \
style="font-size:12.800000190734863px">4. But the number of PNG(s) was too high so my \
mentors came up with an idea of using CSS<br></div><div \
style="font-size:12.800000190734863px">      Sprite Sheets. This fits all the images \
related to a glyph in one image. This reduced the  </div><div \
style="font-size:12.800000190734863px">      number of images four fold.  </div><div \
style="font-size:12.800000190734863px">      -- A challenge was to compare the images \
generated by the two versions if the dimensions  </div><div \
style="font-size:12.800000190734863px">           are different. I solved this by \
aligning the images with respect to a corner pixel and then  </div><div \
style="font-size:12.800000190734863px">           padding the smaller image with \
white pixels.</div><div style="font-size:12.800000190734863px">      (  <a \
href="http://git.savannah.gnu.org/cgit/freetype/freetype2.git/diff/?id=9e1a9aa&amp;id2 \
=4860049^">http://git.savannah.gnu.org/<wbr>cgit/freetype/freetype2.git/di<wbr>ff/?id=9e1a9aa&amp;id2=4860049^</a> \
)</div><div style="font-size:12.800000190734863px"><br></div><div \
style="font-size:12.800000190734863px">5. Next comes the part to generate HTML pages \
to list all the glyphs generated. This was done</div><div \
style="font-size:12.800000190734863px">      using File IO functions in C. Listing \
was done using  </div><div style="font-size:12.800000190734863px">      -- Glyph \
Index</div><div style="font-size:12.800000190734863px">      -- Glyph Name</div><div \
style="font-size:12.800000190734863px">      -- Difference Metric  </div><div \
style="font-size:12.800000190734863px">      along with the sprite sheets.</div><div \
style="font-size:12.800000190734863px">     To visualise the differences, I used CSS3 \
Animations and devised an interactive webpage.</div><div \
style="font-size:12.800000190734863px">      (  <a \
href="http://git.savannah.gnu.org/cgit/freetype/freetype2.git/diff/?id=39bac75&amp;id2 \
=2774a43^">http://git.savannah.gnu.org/<wbr>cgit/freetype/freetype2.git/di<wbr>ff/?id=39bac75&amp;id2=2774a43^</a> \
)</div><div style="font-size:12.800000190734863px"><br></div><div \
style="font-size:12.800000190734863px">6. At last all this was automated using shell \
script so that the user can  simultaneously test  for  </div><div \
style="font-size:12.800000190734863px">      various fonts / render modes / point \
sizes / dpi and for FreeType versions of his/her choice.</div><div \
style="font-size:12.800000190734863px">      The challenging part was to organise all \
the files generated and to link all the files to one</div><div \
style="font-size:12.800000190734863px">      HTML file so that all the glyphs can be \
examined from one page itself.</div><div \
style="font-size:12.800000190734863px"><br></div><div \
style="font-size:12.800000190734863px">      All the code to generate PNG(s) and HTML \
pages was written in ANSI C.</div><div style="font-size:12.800000190734863px">      ( \
<a href="http://git.savannah.gnu.org/cgit/freetype/freetype2.git/diff/?id=3fdabcd&amp; \
id2=8bbefa6^">http://git.savannah.gnu.org/<wbr>cgit/freetype/freetype2.git/di<wbr>ff/?id=3fdabcd&amp;id2=8bbefa6^</a> \
)</div><div style="font-size:12.800000190734863px">      (  <a \
href="http://git.savannah.gnu.org/cgit/freetype/freetype2.git/diff/?id=973cace&amp;id2 \
=b9120a7^">http://git.savannah.gnu.org/<wbr>cgit/freetype/freetype2.git/di<wbr>ff/?id=973cace&amp;id2=b9120a7^</a> \
)</div><div style="font-size:12.800000190734863px"><br></div><div \
style="font-size:12.800000190734863px">I had an awesome experience working with \
FreeType. I&#39;d like to thank the FreeType community  </div><div \
style="font-size:12.800000190734863px">and my mentors for giving all the guidance \
needed along the way. I am proud to be a part of the</div><div \
style="font-size:12.800000190734863px">FreeType community.</div><div \
style="font-size:12.800000190734863px"><br></div><div \
style="font-size:12.800000190734863px">Testing and Debugging.</div><div \
style="font-size:12.800000190734863px">      --Code is made readable and comments are \
added.</div><div style="font-size:12.800000190734863px"><br></div><div \
style="font-size:12.800000190734863px">Note: There is a problem with the output in \
the chrome browse.</div><div style="font-size:12.800000190734863px">               \
Memory leakages are being fixed.</div><div style="font-size:12.800000190734863px">    \
Additional features are to be added.</div></div>



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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic