Using LuaTeX to convert interword glue to spaces and kerns
4 years ago
Creative Commons CC BY 4.0
PDF accessibility requirements stipulate that word breaks must be represented explicitly in the PDF. However, TeX engines do not use space characters to separate words: they use interword glue. This project shows how you can use LuaTeX to replace interword glue with space characters and kerns without affecting the visual appearance of typeset text.
To understand the difference this makes for users of accessibility software, listen to this sound recording made using Adobe Reader DC's Read Out Loud feature. It records the two lines of text in this project being read out loud, before and after converting glue to spaces.
This is a plain TeX file compiled using LuaTeX. It is for experimental use only and not intended to be a full, production-quality solution. Primarily, it is designed to assist with understanding technical issues related to accessible PDFs. The Lua code in this project is based on the earlier Overleaf article Boxes and Glue: A Brief, but Visual, Introduction Using LuaTeX.
This project uses its own simple and very minimal OpenType font loader derived from this code: http://wiki.luatex.org/index.php/Use_a_TrueType_font.