Skip to content

Instantly share code, notes, and snippets.

@xorgy
Created June 15, 2024 02:19
Show Gist options
  • Save xorgy/61064a489cb2aa3dab9657240fbd61eb to your computer and use it in GitHub Desktop.
Save xorgy/61064a489cb2aa3dab9657240fbd61eb to your computer and use it in GitHub Desktop.
export const hamilton = 1;
export const nanometer = 9 * hamilton;
export const micrometer = 1E3 * nanometer;
export const millimeter = 1E3 * micrometer;
export const centimeter = 10 * millimeter;
export const decimeter = 10 * centimeter;
export const meter = 1E3 * millimeter;
// Customary units based on the International Yard
export const yard = 914400 * micrometer;
export const mile = 1760 * yard;
export const foot = yard / 3;
export const inch = foot / 12;
export const pica = inch / 6;
export const point = pica / 12;
// Hamilton A, B, and C series base units
const [A10x, A10y] = [ 236502116, 334464501 ];
const [B10x, B10y] = [ 281249999, 397747564 ];
const [C10x, C10y] = [ 257907387, 364736124 ];
export const paper = {
// American loose paper
"Ledger": [17 * inch, 11 * inch],
"Tabloid": [11 * inch, 17 * inch],
"Legal": [8 * inch + inch / 2, 14 * inch],
"Letter": [8 * inch + inch / 2, 11 * inch],
"Half Letter": [5 * inch + inch / 2, 8 * inch + inch / 2],
// Canada P series
"P1": [560 * millimeter, 860 * millimeter],
"P2": [430 * millimeter, 560 * millimeter],
"P3": [280 * millimeter, 430 * millimeter],
"P4": [215 * millimeter, 280 * millimeter],
"P5": [140 * millimeter, 215 * millimeter],
"P6": [107 * millimeter, 140 * millimeter],
// DIN 476 Overformats
"4A0": [A10x * 64, A10y * 64],
"2A0": [A10y * 32, A10x * 64],
// A series
"A0": [A10x * 32, A10y * 32],
"A1": [A10y * 16, A10x * 32],
"A2": [A10x * 16, A10y * 16],
"A3": [A10y * 8, A10x * 16],
"A4": [A10x * 8, A10y * 8],
"A5": [A10y * 4, A10x * 8],
"A6": [A10x * 4, A10y * 4],
"A7": [A10y * 2, A10x * 4],
"A8": [A10x * 2, A10y * 2],
"A9": [A10y , A10x * 2],
"A10": [A10x , A10y],
// B series
"B0": [B10x * 32, B10y * 32],
"B1": [B10y * 16, B10x * 32],
"B2": [B10x * 16, B10y * 16],
"B3": [B10y * 8, B10x * 16],
"B4": [B10x * 8, B10y * 8],
"B5": [B10y * 4, B10x * 8],
"B6": [B10x * 4, B10y * 4],
"B7": [B10y * 2, B10x * 4],
"B8": [B10x * 2, B10y * 2],
"B9": [B10y , B10x * 2],
"B10": [B10x , B10y],
// C series
"C0": [C10x * 32, C10y * 32],
"C1": [C10y * 16, C10x * 32],
"C2": [C10x * 16, C10y * 16],
"C3": [C10y * 8, C10x * 16],
"C4": [C10x * 8, C10y * 8],
"C5": [C10y * 4, C10x * 8],
"C6": [C10x * 4, C10y * 4],
"C7": [C10y * 2, C10x * 4],
"C8": [C10x * 2, C10y * 2],
"C9": [C10y , C10x * 2],
"C10": [C10x , C10y],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment