groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why isn't the device resolution exposed to the formatter?


From: G. Branden Robinson
Subject: Why isn't the device resolution exposed to the formatter?
Date: Thu, 17 Nov 2022 13:31:04 -0600

The horizontal and vertical motion quanta from a device's DESC file are
exposed via the `.H` and `.V` registers, respectively.  But the device
resolution is not.

This seems like it would be a useful thing to have, so that a document
could dynamically adapt to it.

There is a somewhat sleazy way to get this information; your document
can read the `.o` (page offset) register, which _conventionally_ is set
to 1 inch, so that will give you the number of basic units per inch,
which is the definition of device resolution.

However, this technique will fail with the following, for instance:

groff -rO0.5i -mm

The mm(7) package allows the page offset to be overridden by the `O`
register on the command-line, so by the time a document can query the
`.o` register, it's too late--and the user could have set it to any old
thing.

Also, the page offset is usually zero on terminal devices, though
admittedly these output devices are so inflexible in positioning that
having resolution information might not enable much.  But perhaps my
imagination is too limited here.

If nobody has a good answer I'm strongly tempted to add a new read-only
register, `.res`.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]