Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This is the final project report of the work I did during my Google Summer of Code 2021.

GSoC 2021 | Sarthak Bhardwaj

GSoC 2020

Project Details

Project Description:

FreeType is an open-source library used to render fonts and is packed with a lot of font-related features. This framework helps the developer to compare the rendering output of a ‘base’ version to a ‘test’ (developer) version of FreeType. Upon each commit, several builds are triggered for various operating systems and build configurations. Each build creates artifacts containing the newly-built FreeType libraries for developers and users to download.

Goals

The following goals were framed according to the requirements and the scope of the project:

  • Modifying ftlint to output glyph md5 hashes for fast testing.
  • Creating a script for regression testing, that can be run locally or in CI
  • Adding regression test CI.
  • Adding macOS builds for Autotools and meson.
  • Adding image comparison functionality to the website.
  • Improving the layout of generated web pages.

Milestone 1
Modifying ftlint from ft-demos repo to output glyph md5 hash.

Milestone 2
Writing a proof-of-concept script for detection of rendering differences in glyphs, using output from tools like ftlint and ftgrid.

Milestone 3
Integrating the output with HTML pages, to provide an easy-to-use interface to see regressions. I ended up storing the directory structure inside a string variable in a .js file and loading it from HTML to show the data.

Milestone 4
Linking the different web pages with each other, since it's not easy to pass data from one local web page to other, I solved this by appending the data to the URL of the web page, separated by "-" as a delimiter.

Milestone 5
Adding a CI build for macOS

Milestone 6
After the integration part was over, I focused on improving the layout of the generated web pages. Added image comparison functionality to the website, The diff was generated by XOR-ing the base and test images. Added translucent overlay of the diff/another image which appears over the glyph images by clicking it, with a short animation. This also made blinking comparison made easy by pressing and releasing a mouse button in quick succession. Added a selectable button so that, image to be used in the overlay can be selected from the select menu beneath both images.

Related Links:

MRs:

Usage

The script checks a "base" version of FreeType vs a "test" version.

Follow these steps to test FreeType

  1. Build and install ft-demos linked with the "base" version of FreeType.
  2. Call ./gen_base.sh
  3. Build and install ft-demos linked with the "test" version of FreeType.
  4. Call ./regression.sh
  5. If regressions are found,
    the script generates a file "report.tar.gz"
    that contains web pages to browse the list of regressions.

You can download the artifacts from the test job on the jobs page here: https://gitlab.freedesktop.org/thesarthakbhardwaj/freetype/-/pipelines/358373/builds. The zip file will extract from the "report" folder, open the index.html file inside it to browse the regressions.

Follow this link to have the visual result of the semi-permanent web page, and see how it work: https://1sarthakbhardwaj.github.io/FreeType/

You can simply add/remove any fonts by simply putting the font file inside font/ folder,
the script will automatically read it.

Conclude

And finally, I'd like to thank everyone, who has helped me in completing my project:

I would like to thank Werner Lemberg, my mentor for guiding me throughout the process and for helping me out to write well-structured and clean code. Our interaction has been very productive which led me to write code with better logic and quality, He was so cooperative and supported me everytime i needed help.

In addition, I would like to thanks Alexei Podtelezhnikov for helping me, Alexei's knowledge of the FreeType codebase is incredible and He helped me learn more about FreeType's internals and fonts.

Last but not the least, I want to thank Anurag Thakur, He was super supportive throughout the process and He helped me with many issues.

It was great working along with such amazing and helpful people. It is because of them that I was able to complete the project on time. I would also like to thank Google and The FreeType Project for this amazing opportunity. Looking forward to keeping the project growing.

Best Regards,
Sarthak Bhardwaj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment