Add typographic length units - #885
Open
ChrisJr404 wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a
units::typographymodule withpoint,picaandtwip, plus the TeXpoint/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 offinch / 72.27. So you can do things like12 pt -> mmor1 pica -> inch.I left
Qout of the original request on purpose. Defining it would claim the single-letterQidentifier globally, which already collides with existing use (one of the examples usesQfor 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 regeneratedbook/src/prelude/list-units.md.