Using LuaTeX to convert interword glue to spaces and kerns
Author:
Graham Douglas
Last Updated:
5年前
License:
Creative Commons CC BY 4.0
Abstract:
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.
Note
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.
\begin
Discover why 18 million people worldwide trust Overleaf with their work.