7

Is it possible for LaTeX or any of its derivates to calculate, how much of a page is covered in ink?

I came to this question via a link to ecofont posted on TeXhax, ecofont sells carved out versions of standard fonts. I know there are also light/condensed versions of for instance the Iwona, I also found an outline of Computer Modern (Computer Modern Outline) and would like to calculate the percentage of ink by switching from the standard one.

Uwe Ziegenhagen
  • 13,168
  • 5
  • 53
  • 93
  • 5
    I don't think latex could help much, basically you just want to make a png or similar bitmap of each page and then use a bitmap tool to tell you how many white pixels there are.... – David Carlisle Jul 29 '14 at 10:17
  • Good question! I have, too, wondered about this; in particular, whether one can specify optimal intervals for the percentage of coloured dots according to the task. – the_fox Mar 24 '15 at 00:21
  • I am sure that each language is different, but for example in English, http://en.wikipedia.org/wiki/Letter_frequency provides a nice table showing the frequency at which letters appear in random text. One could use these numbers multiplied by the ink saved in each of the respective letters to get an aggregate ink savings for a given font alternative. But as pointed out, that would be done by measuring the areal coverage of the font glyphs themselves, which is not done by LaTeX per se. – Steven B. Segletes Mar 24 '15 at 10:13

1 Answers1

4

This is not possible with any derivative of TeX without invoking some sort of bitmap processor (possibly via a LuaTeX callback) as mentioned in David's comment. This is because TeX does not care or even know what the glyph looks like; it only knows about its box.

From the TeXbook:

From TeX's viewpoint, a single character from a font is a box; it's one of the simplest kinds of boxes. The font designer has decided what the height, width, and depth of the character are, and what the symbol will look like when it is in the box; TeX uses these dimensions to paste boxes together, and ultimately to determine the locations of the reference points for all characters on a page. [...] TeX doesn't have any idea where the ink will go—only the output device knows this.

Paul Gessler
  • 29,607
  • To be pedantic, in XeTeX and LuaTeX, you can chop the box up a little bit further by accessing the sidebearings, but this, of course, doesn't help you get at the position, nor the amount, of the actual ink in the glyph. – Brent.Longborough Mar 24 '15 at 04:31
  • @Brent.Longborough http://www.toothpastefordinner.com/081009/pedants-funeral.gif ;-) – Paul Gessler Mar 25 '15 at 16:01