Font engineering: from genomes to typography​

22 June 2018

As a Cambridge-trained physicist, who later worked on the genetic causes of autoimmune diseases​, Dr Hin-Tak Leung (Croucher Scholarship 1991, Croucher Fellowship 1995) appears an unlikely candidate for a career in typography. However, the scientist has turned a hobby into a profession where he can utilise his data processing skills to ensure that digital fonts meet quality standards.​

The design of both online and printed media is constantly changing with the demand for faster, richer, and more sophisticated-yet-legible fonts. Leung is at the forefront of research into making sure new typefaces meet quality standards and perform well across a range of operating systems and platforms before they are launched. A tool for quality analysis of OpenType fonts, known as Font Validator, was developed by Microsoft and was used by font vendors and developers for qualifying their fonts prior to release.

“As a research scientist, publication is my lifeblood. Living in the UK 20 years ago, when Chinese typesetting was technologically challenging, I ended up taking time to learn all about fonts and printing,” recalled Leung, of a hobby which went on to redefine his career.

Leung arrived in Cambridge as an undergraduate to study natural sciences and continued as a doctoral student with support from the Croucher Foundation. His PhD studies were on structural phrase transitions of rock-forming minerals, and he continued with a postdoctoral fellowship from the Foundation on superconducting ceramics and magnetic thin films.

Leung then joined the Wellcome Trust Sanger Institute as a data scientist and worked on the genetics of autoimmune diseases, and had to work with proprietary software to process genetic data: Illumina DNA micro-arrays. It was at this point Leung learned the C# programming language to an advanced level to gain an insider’s insight into Illumina’s data algorithms, and was able to get Illumina Technology to run on Linux.

Dr Hin-tak Leung at the TYPO Lab 2018

“As my personal needs justified professional needs, my understanding and knowledge of fonts grew, and in the last 20 years I have been consulting on fonts and printing,” explained Leung. “It has turned out to be a hobby that pays well; the new version of Font Validator is a summary of my two phases, as a physicist and a data scientist.”

The last version of the validator was released in 2003, however, the development within Microsoft gradually stopped, until Google showed interest in integrating a font validating pipeline into its web font effort. The original Font Validator is based on a heavily customised Windows kernel. While a big part of the source code was open for engineers to modify, Microsoft didn’t release the entire code. Since 2015, Leung has been working on a FreeType-based prototype. In September last year, Leung re-implemented the validator and version 2.1 was realised.

After over a decade as a physicist and another decade as a data scientist for genomic analysis, Leung was excited by a change of career. This was when Google was approaching people to rewrite Font Validator, which was originally on the C# based MS .NET Framework, to the Python programming language. Leung approached Google with his knowledge of Font Validator, and was offered a job. Within weeks Leung and his team had created a prototype that was operational. “One problem was, Microsoft had kept some Font Validator technology under wraps, and it’s understandable, given it’s a part of their core desktop intellectual property they take pride in, and also its security-sensitive nature of being derived from the Windows kernel,” he added.

A large part of Leung’s job was emulating the diagnostic capability of the original validator to replace the hidden bit of technology that Microsoft didn’t want to share, known as ‘hinting’, with a prototype that would work similarly. He replaced it with FreeType, a rendering engine for Linux, as FreeType has understanding of hinting instructions and what sort of errors could cause problems. Hinting instructions are programming instructions within a font which tells the operating system how to subtly adjust each glyph at any given size, so they are displayed clear and legible.

“Now instead of silently working around buggy fonts, it gives a report saying you could improve the font in this area,” said Leung, of the new version. “Over the years, the numbers of tests have increased and so has the error messages and warnings, meaning the validator is improving and is faster.”

Leung also keeps track of Font Validator users and has found that about half of users today are using the Mac version. At the same time, while the US accounted for the most downloads, Germany came second, before UK, by a significant margin.

Challenges and new developments

A major driving force in the industry, and the reason for all the latest technology changes, is the popularity of mobile devices. Unlike desktop computers that come with a good set of fonts and are also extendable, smartphones and tablets aren't, and fonts are streamed from the server just like pictures in web pages. This font streaming also gives more consistent look-and-feels across different devices and browsers, compared to using host-resident fonts.

Earlier this year, it was announced that Gmail will changing its default font away from Arial and towards ones that work better on mobile devices. The menu items in Gmail will switch from Arial to Product Sans, while emails and messages will now be displayed in Roboto.

“Two of the three recent developments in typography are because of colour fonts (emojis) and font variations. The third, about complex layouts in Arabic, Persian, and the Middle-East languages, is interesting on its own and has been a challenge for a while.”

“While the new version of font validator is as good as the 2003 version, the OpenType specification has since been added to, in terms of font variations and colour fonts, and we need to keep up with that,” added Leung.

An interesting area for future development is augmented and virtual reality: floating text annotations, giving information. For example, to look up somebody's Facebook profile and display that as an overlay in users’ glasses as they meet somebody and see their faces. ​These are technologically quite challenging because people want them to display in real time, and also want the text to be legible as the head moves to look at the surrounding. The scenery can be light or dark, so the letters need to be visible against all kinds of backgrounds.

Leung's transition from genome analysis to font analysis is now complete. He said: "I am excited about my project, and as a scientist, I think we should be able to explain our work, which in turn should be meaningful to the society and the wider community."

Dr Hin-Tak Leung received the Prince Philip Scholarship for his undergraduate Natural Science degree at Girton College, Cambridge University in 1988, a Croucher scholarship for his PhD in 1991, and a fellowship in 1995 on superconducting ceramics and magnetic thin films at the University of Cambridge. Dr Leung is one of the 13-people Data and (Statistical) Analysis Committee of the Wellcome Trust Case Control Consortium (WTCCC). Starting 2015 he has been working with Google to negotiate with Microsoft and migrate part of Microsoft's desktop publishing-related technology to an open source platform, to better support Google's Web Font effort.

To view Dr Leung’s Croucher profile, please click here