readingtype / typegauge Goto Github PK
View Code? Open in Web Editor NEWGem for validating and converting measurements used in letterpress printing
License: BSD 2-Clause "Simplified" License
Gem for validating and converting measurements used in letterpress printing
License: BSD 2-Clause "Simplified" License
TYPEGAUGE ========= Docs for Version 0.1 TypeGauge is a gem providing a very basic class that tries to guess whether a given input string represents a legitimate description of a dimension of a typeface. It knows about quite a few of the traditional names for type sizes (currently based entirely on http://en.wikipedia.org/wiki/Point_(typography)#Traditional_point-size_names). It can be used on the type size and the line height; you might find it useful for some other measurement related to page layout. If it's not happy it has three moderately descriptive errors which can be incorporated into code. My initial use case was as part of the validation process for a model and I wanted users to have some idea of what was wrong with their input. If it's happy nothing much happens -- there isn't (yet) a public method for asking for a cleaned-up version of the string. You can get a TypeGauge object to tell you the units in which the input value was supplied and you can convert its size to mm or to points (2 decimal places), which could be useful for sorting a number of measurements. tg = TypeGauge.new('12 didot') tg.unit => :didot tg.to_mm => 4.5108 tg.to_point => 12.83 Let me know if you find it useful. require 'future' --------------- I would like to handle the case where there a single 'traditional' name maps to more than one 'modern' type size better. I can imagine a way, but for now I've simply left symbols that somebody might use (:uk, :us) in the TRADITIONAL_NAMES array. There is only one case at the moment but I am sure more will emerge from the typeracks... It would be nice to convert 'modern' type sizes to traditional names. There are more ambiguities going that way. Old iron[y] ----------- I see nothing incongruous in writing software that is entirely dedicated to the measuring systems of a redundant technology such as letterpress. It makes me feel better :) Ben Weiner
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.