Skip to content

Add typographic length units - #885

Open
ChrisJr404 wants to merge 1 commit into
sharkdp:mainfrom
ChrisJr404:typographic-units
Open

Add typographic length units#885
ChrisJr404 wants to merge 1 commit into
sharkdp:mainfrom
ChrisJr404:typographic-units

Conversation

@ChrisJr404

Copy link
Copy Markdown

This adds a units::typography module with point, pica and twip, plus the TeX point/pica, and imports it in the prelude so they are available by default. Closes #797.

The point is defined as inch / 72 (the PostScript/DTP/CSS point), pica as 12 points, twip as 1/20 of a point, and the TeX variants are based off inch / 72.27. So you can do things like 12 pt -> mm or 1 pica -> inch.

I left Q out of the original request on purpose. Defining it would claim the single-letter Q identifier globally, which already collides with existing use (one of the examples uses Q for a flow rate), and it felt like exactly the kind of one-character name the project would rather keep free for variables. Happy to add it under a longer name if you want it.

Consistency checks are in examples/tests/unit_consistency_misc.nbt, and I regenerated book/src/prelude/list-units.md.

Adds a units::typography module with point, pica and twip, plus the
TeX point and pica, and wires it into the prelude. Handy for going
between CSS/DTP and physical lengths, e.g. 12 pt -> mm.

Closes sharkdp#797.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support typographic length units

1 participant