TrueType is one of the most widely used vectorized font formats. It can be optimally rendered on screens with differentresolutions 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.
【 预 览 】
附件列表
Files
Size
Format
View
Analysis and Optimization of TrueType Font Bytecode