Skip to content

Instantly share code, notes, and snippets.

@zaydek-old
Last active November 7, 2019 19:25
Show Gist options
  • Save zaydek-old/4f6375ec33319362b5d21f356fed75e5 to your computer and use it in GitHub Desktop.
Save zaydek-old/4f6375ec33319362b5d21f356fed75e5 to your computer and use it in GitHub Desktop.
Inter dynametrics (use em)
function InterDynamicTracking(fontSize) {
var a = -0.0223, b = 0.185, c = -0.1745;
// tracking = a + b * e ^ (c * fontSize)
return a + b * Math.pow(Math.E, c * fontSize)
}
// See rsms.me/inter/dynmetrics for reference.
const A = -0.0223 // Don’t change.
const B = 0.185 // Don’t change.
const C = -0.1745 // Don’t change.
function calcInterDynametrics(fontSize) {
return A + B * Math.pow(Math.E, C * fontSize)
}
let ret = ""
function calc(fontSize) {
ret += `${calcInterDynametrics(fontSize).toFixed(4)}\n`
}
calc(0)
calc(2)
calc(4)
calc(6)
calc(8)
calc(10)
calc(12)
calc(14)
calc(16)
calc(18)
calc(20)
calc(22)
calc(24)
calc(26)
calc(28)
calc(30)
calc(32)
calc(36)
calc(40)
calc(44)
calc(48)
calc(52)
calc(56)
calc(60)
calc(64)
0.1627
0.1082
0.0698
0.0426
0.0235
0.0100
0.0005
-0.0062
-0.0110
-0.0143
-0.0167
-0.0183
-0.0195
-0.0203
-0.0209
-0.0213
-0.0216
-0.0220
-0.0221
-0.0222
-0.0223
-0.0223
-0.0223
-0.0223
-0.0223
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment