UWSpace is currently experiencing technical difficulties resulting from its recent migration to a new version of its software. These technical issues are not affecting the submission and browse features of the site. UWaterloo community members may continue submitting items to UWSpace. We apologize for the inconvenience, and are actively working to resolve these technical issues.
 

Analysis and Optimization of TrueType Font Bytecode

Loading...
Thumbnail Image

Date

2018-12-19

Authors

Liu, Zeming

Journal Title

Journal ISSN

Volume Title

Publisher

University of Waterloo

Abstract

TrueType is one of the most widely used vectorized font formats. It can be optimally rendered on screens with different resolutions and different font sizes thanks to hints expressed as bytecode programs. Font engines execute the bytecode programs to adjust the outlines of the glyphs. TrueType font bytecode is a highly-dynamic stack-based bytecode language. It manipulates data with a global stack, and it uses hardware related information, such as screen resolutions and font sizes, which are unknown at compile time. Thus, it is hard to perform static analysis and optimizations on this bytecode. Fonts are sometimes subsetted to only include the glyphs that appear in a webpage before sending to the client. Existing font manipulation techniques do not touch the bytecode, so subsetted fonts contain un-optimized bytecode programs. TrueType bytecode analysis can help reduce bandwidth demands for serving webpages. This thesis presents improvements to COI, a tool for manipulating TrueType bytecode. New features include enhanced abstract execution as well as basic optimizations on COI, such as tree shaking, no-effect instruction removal, and dead block elimination. Finally, it completes the cycle by translating the COI back to TrueType bytecode. We tested our tool on fonts from different font families, including Microsoft Core TrueType font Arial, and NotoSansTibetan-Bold. Our experiments show that our optimizations can reduce the size of bytecode by 0.37\% to 18.82\% of the test fonts in our benchmarks. On average, we can reduce the size of bytecode of our test fonts by 7.10\%. Our optimized fonts yield the same bitmaps as the original font.

Description

Keywords

static analysis, TrueType font

LC Keywords

Citation