# Computing letter coordinates (Typesetters Steganography)

Is there a way to find out about the coordinates of letters in a formatted piece of text?

Suppose the compiled text has three columns, and the letters are equally spaced. Then what I'm looking for is a command that decides, depending on its (row, column) coordinates, if a letter is printed bold, or not.

Probably things are getting clearer if I explain what it's used for. It's some sort of superimposed ASCII image, hidden in a text. When reading the text, you may notice that some characters are printed bold, some are not, in a seemingly random fashion.

When looking at the text from a distance, you see the big picture.

An example:

The dots represent regular text, while the s' are a stand-in for bold characters.

The main challenge is that it needs to be a multi-column text which makes it harder to tell which characters need to be printed bold.

I'm heading towards using dvitype for my needs. But does anybody know what, e.g.

131: setchar72 h:=1310720+491521=1802241, hh:=114


might encode? What I do know is that 72 represents H according to ASCII which is the first letter of the Hello World! tex file

Hello World!
\bye


But what's the meaning of the other digits?

• You need to clarify how you expect this to be achieved since I am having to guess you mean in the PDF (fit for printing) which would not be "fixed" until finally saved as complete. Thus post TeX processing phases. The final position is stored in the pdf in a variety of ways some with coordinates and some without coordinates thus an external editor type application is probably necessary to do that type of query. What TeX post processing can do is consider the saving format (say decrypted) such that an external app can do easy stream extraction. It may be possible in TeX to do that using DVI ? – user170109 Mar 20 at 14:46
• Thanks for your help, @KJO! If I got you correctly, there is no way of getting that information at compile time. What I want to achieve is a superimposed image on a poster size text, s.t. the image can be seen from a distance. Purely by means of printing decided characters bold. – Max Herrmann Mar 20 at 14:52
• I'm still unclear of your intended workflow , in TeX you can mix (overlay) text and image but primarily as a typesetting application text is usually small point sizes say 8 - 20 pt and some can readily be emboldened but that natively would not be well suited to mechanisation. Although it can be scaled up for poster or presentation usage. we would likely need to know how tex is being used (by a MWE Minimal Working Example) in order to provide suitable solutions – user170109 Mar 20 at 15:04
• I can explain what those numbers from dvitype mean, but they won't be helpful for you, I think — setchar72 h:=1310720+491521=1802241, hh:=114 means that the command in the DVI file is to set the character H. The effect of this command (apart from putting the character H at the “current” position) is to change the current position's horizontal offset (h) to the right by the width of the char 72 (H) in the current font metrics, from 1310720 to 1310720+491521=1802241. (The units are certain tiny units; I believe 10^-7 m but I forget…) And hh is the rounded value in pixels, for chosen DPI. – ShreevatsaR Mar 21 at 1:52
• More fundamentally, the question does not make sense for typical text typeset by TeX, because it uses variable-width characters and spaces. So firstly you need to restrict to fixed-width font, with moreover fixed-width spaces. That is easily arranged. But if you have such text then you don't need to go via the output of TeX (dvitype) to determine character positions, because they are determined in a simple way from the input itself… almost. When you say multi-column text, what support are you looking for from TeX? Are you willing to manually decide what text goes into what column? – ShreevatsaR Mar 21 at 1:56

Using KJO's idea and simplifying the input:

You can use an environment, say, steganography which makes two characters active and define those two characters to print a dot and a bold dot.

Here's a very crude approach to demonstrate (using . and # as in KJO's example):

\documentclass{article}

\makeatletter
\let\stegchar=.
\newlength\stegVspace  \stegVspace=4\p@
\newlength\stegHspace  \stegHspace=3\p@
\newenvironment{steganography}{%
\catcode\.=\active
\catcode\#=\active
\obeylines
\baselineskip=\stegVspace
\@steganography
}{}
\begingroup
\catcode\.=\active
\catcode\#=\active
\gdef\@steganography{%
\def.{\leavevmode\hb@xt@\stegHspace{\hss\stegchar\hss}}%
\def#{\leavevmode\hb@xt@\stegHspace{\hss\textbf{\stegchar}\hss}}%
}
\endgroup
\makeatother

\begin{document}
\pagestyle{empty}

\begin{steganography}
.##......##..........##..##................##.......##..................##.......##
.##......##..........##..##................##.......##..................##.......##
.##......##..#####...##..##..######........##...#...##..######..######..##.......##
.##########.##...##..##..##.##....##.......##..###..##.##....##..##..#..##...######
.##......##.#######..##..##.##....##.......##.##.##.##.##....##..##.....##..##...##
.##......##.##.......##..##.##....##.......####...####.##....##..##.....##..##...##
.##......##..######.###.###..######........##.......##..######..###.....###..######
\end{steganography}

\end{document}


This is not an answer just a form of Proof Of Concept for one possible approach ??
There must be many other potential answers as seen in some of the "fun" answers on this site.

Using some input for the overlay (in this case a figlet font) we could start with this as input

  .##......##..........##..##................##.......##..................##.......##
.##......##..........##..##................##.......##..................##.......##
.##......##..#####...##..##..######........##...#...##..######..######..##.......##
.##########.##...##..##..##.##....##.......##..###..##.##....##..##..#..##...######
.##......##.#######..##..##.##....##.......##.##.##.##.##....##..##.....##..##...##
.##......##.##.......##..##.##....##.......####...####.##....##..##.....##..##...##
.##......##..######.###.###..######........##.......##..######..###.....###..######


Then it would be very simple to replace the # like this

  .\textbf.\textbf.......\textbf.\textbf...........\textbf.\textbf...\textbf.\textbf.................\textbf.\textbf........\textbf.\textbf...................\textbf.\textbf........\textbf.\textbf.
.\textbf.\textbf.......\textbf.\textbf...........\textbf.\textbf...\textbf.\textbf.................\textbf.\textbf........\textbf.\textbf...................\textbf.\textbf........\textbf.\textbf.
.\textbf.\textbf.......\textbf.\textbf...\textbf.\textbf.\textbf.\textbf.\textbf....\textbf.\textbf...\textbf.\textbf...\textbf.\textbf.\textbf.\textbf.\textbf.\textbf.........\textbf.\textbf....\textbf....\textbf.\textbf...\textbf.\textbf.\textbf.\textbf.\textbf.\textbf...\textbf.\textbf.\textbf.\textbf.\textbf.\textbf...\textbf.\textbf........\textbf.\textbf.
.\textbf.\textbf.\textbf.\textbf.\textbf.\textbf.\textbf.\textbf.\textbf.\textbf..\textbf.\textbf....\textbf.\textbf...\textbf.\textbf...\textbf.\textbf..\textbf.\textbf.....\textbf.\textbf........\textbf.\textbf...\textbf.\textbf.\textbf...\textbf.\textbf..\textbf.\textbf.....\textbf.\textbf...\textbf.\textbf...\textbf...\textbf.\textbf....\textbf.\textbf.\textbf.\textbf.\textbf.\textbf.
.\textbf.\textbf.......\textbf.\textbf..\textbf.\textbf.\textbf.\textbf.\textbf.\textbf.\textbf...\textbf.\textbf...\textbf.\textbf..\textbf.\textbf.....\textbf.\textbf........\textbf.\textbf..\textbf.\textbf..\textbf.\textbf..\textbf.\textbf..\textbf.\textbf.....\textbf.\textbf...\textbf.\textbf......\textbf.\textbf...\textbf.\textbf....\textbf.\textbf.
.\textbf.\textbf.......\textbf.\textbf..\textbf.\textbf........\textbf.\textbf...\textbf.\textbf..\textbf.\textbf.....\textbf.\textbf........\textbf.\textbf.\textbf.\textbf....\textbf.\textbf.\textbf.\textbf..\textbf.\textbf.....\textbf.\textbf...\textbf.\textbf......\textbf.\textbf...\textbf.\textbf....\textbf.\textbf.
.\textbf.\textbf.......\textbf.\textbf...\textbf.\textbf.\textbf.\textbf.\textbf.\textbf..\textbf.\textbf.\textbf..\textbf.\textbf.\textbf...\textbf.\textbf.\textbf.\textbf.\textbf.\textbf.........\textbf.\textbf........\textbf.\textbf...\textbf.\textbf.\textbf.\textbf.\textbf.\textbf...\textbf.\textbf.\textbf......\textbf.\textbf.\textbf...\textbf.\textbf.\textbf.\textbf.\textbf.\textbf.


OR perhaps . for use with \usepackage{easyformat}

[EDIT]

I have removed my poor results for the above since Phelype has now taken that idea much further.

At this point I am unsure in what context this may work since if I apply it how I initially saw it, then it needs a greater emphasis than simply "bold " to work.

See what the emboldened paragraph may contain below ?

• It's a good idea! You could define an environment that makes . and #` both active, and one print a normal dot and the other a bold dot, both with the same width :) – Phelype Oleinik Mar 20 at 19:51
• @PhelypeOleinik thanks my tex skills are very limited for defining any environment other than DOS I can of course always cut paste and modify as seen here :-) – user170109 Mar 20 at 19:55
• May I add an answer with that? – Phelype Oleinik Mar 20 at 20:07
• The challenge is yours I will delete my POC if anyone can replace or better it – user170109 Mar 20 at 20:14
• That's a very valid replacement for my concept I might wait a couple of upvotes and see if I can get my next badge (disciplined= get 3 votes then delete own answer :-) – user170109 Mar 20 at 20:21