[pdftex] Accessible LaTeX for large print (36pt-48pt) with reflow

Ross Moore ozross at icloud.com
Tue Sep 13 02:11:49 CEST 2022


Hello Wayne.

Thank you very much for the question/request.  (included below)

Having done some experiments, I fully understand the issue and what needs to be done.
However, it requires changes in the TeX engine software, which I’m not able to do myself.
That’s why I am copying this reply to several others, who perhaps can help to get it done.


Firstly, typesetting at a large size (36+ pt) is not an issue; all flavours of TeX can certainly do that.
But that’s not such a practical thing to do. 

I think what you really want to do is:
  1.  scale up your view of an existing PDF to larger size ...
  2. … while keeping the paper-size (or viewing window) to A4 or US-letter or similar, and ...
  3. … reflow the text (with these large font sizes) to fit the normal paper/window size.

This *can* be done in HTML, so why not also in PDF?

Well, it can be done in some software, such as Adobe Reader and Acrobat Pro DC for instance.
(I showed this in a TUG talk that I gave, back in 2010, I think it was.)


However, it does *not* work with TeX-produced PDFs, for an easily-identifiable reason.

• TeX output does not (normally) include space characters as a word-boundary marker.

Instead it positions pieces of text at particular places on the page, which have been calculated
to maximise the visual effect when reading — for normally sighted persons.
Alternatively, it uses adjustments to the spacing between the printable characters.
Neither of these methods actually inserts a space character into the output text-strings.

The algorithm behind “reflow” requires being able to identify word boundaries as a plausible place 
to break text streams. Currently this relies on the presence of space characters within the text-strings.

Modern PDF standards prefer to have space characters in the PDF output, for various reasons.
Many years ago (~2009 say) I requested an addition to pdfTeX to include spaces at places that could 
reasonably be identified as being between words. This would provide word-boundaries for the PDF/A
archival format, among others.

Han Thé Thành did this, by introducing a “fake space” that could be inserted either explicitly,
or algorithmically if an appropriate flag was set.
This space comes as the single character in a special font, set at an infinitesimal width
so as to not upset the page rendering. 
It was/is inserted, while making the following adjustments to TeX’s output:
  1. close the text-string of the preceding word;
  2. reset the position, change font, insert the single character;
  3. calculate the position for the next word to commence;
  4. reinstate the original font for the continuation of the text-string.

• This works fine for PDF/A validation, but has *no effect* whatsoever for reflow.

To achieve reflow one must satisfy the following:
  A.  the space character needs to be included in the font subset written into the PDF;
  B.  font characters must occur within the same text-strings as the words themselves.
Otherwise no reflow can occur.

Thus upon recognising where an inter-word space should occur,
the algorithm needs to:
 1. forcefully insert a space character, having a well-defined width;
 2. recalculate the inter-word space as determined by TeX, 
     taking into account the width of the space character in the current font;
 3. insert kerning, by a positive or negative amount, to ensure that the next word
     starts at the exact same place on the page as it would without that space character.

Of course this all requires the current font to have a space character in the normal position in the font.
Early TeX fonts do *not* meet this criterion; but more modern fonts (TeXGyre, etc.) and non-TeX fonts
do have it. 
There are already ways to then include it in a font subset.
The harder part is re-programming TeX to use it, while still producing the same superb visual output.


I’m hoping that one of the pdfTeX developers/maintainers will take on the challenge of making *all* the
changes necessary for the strategy outlined above to work, fully robustly.

This will almost certainly involve adding a new font-dimen parameter that records the width of the space
character in each font either as it is loaded, or when it is requested to be added into a subset.
(If it exists, of course; else the new font-dimen can be set to 0 or -1 or whatever else is appropriate.)
This value will need to be read and scaled to properly account for the width implicit in adding a space character 
into an output string for the font scaled to a particular size.


I believe this to be an important step in TeX development that must be taken, to properly support Accessibility in PDFs.
It is quite independent of Tagging in PDFs; and perhaps even more important for those having partial sight.

So far as pdfTeX is concerned, since it requires changes in multiple places within the code source,
potentially affecting all fonts as well as just doing some calculations for the output, it is a task that should
be carried out by an experienced developer. It is not just something that can be done via a small patch. 
 

All the best.

	Ross

	


>> From: Wayne Dick <Wayne.Dick at csulb.edu>
>> Date: 13 September 2022 at 5:06:57 am AEST
>> To: Ross Moore <ross.moore at mq.edu.au>
>> Subject: Accessible LaTeX for large print (36pt-48pt) with reflow
>> 
>> 
>> Dear Dr. Ross,
>> I am  one of the very few people to earn  a PhD in mathematics with low vision in the 1980's. 
>> I see that your main interest is in  tagging PDF for non-visual users. My interest is in enhancing print for partial  visual users. I am sure we are  both interested in automating  these  efforts as  much  as  possible so that authors can do  this  invisibly.
>> Are you familiar with any work in that  direction. 
>> Sincerely, 
>> Wayne Dick


Dr Ross Moore
Department of Mathematics and Statistics 
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.moore at mq.edu.au
http://www.maths.mq.edu.au

I respectfully acknowledge the traditional custodians of the Macquarie University Land, the Wallumedegal clan of the Darug nation, whose cultures and customs have nurtured and continue to nurture this land since the Dreamtime. I pay my respects to Elders past, present, and future.


CRICOS Provider Number 00002J. Think before you print. 
Please consider the environment before printing this email.

This message is intended for the addressee named and may 
contain confidential information. If you are not the intended 
recipient, please delete it and notify the sender. Views expressed 
in this message are those of the individual sender, and are not 
necessarily the views of Macquarie University. <http://mq.edu.au/>
CRICOS Provider Number 00002J. Think before you print. 
Please consider the environment before printing this email.

This message is intended for the addressee named and may 
contain confidential information. If you are not the intended 
recipient, please delete it and notify the sender. Views expressed 
in this message are those of the individual sender, and are not 
necessarily the views of Macquarie University.
 <http://mq.edu.au/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/pdftex/attachments/20220913/9a62db26/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: not available
URL: <https://tug.org/pipermail/pdftex/attachments/20220913/9a62db26/attachment-0001.png>


More information about the pdftex mailing list.