From 6f6f6683ed47818d44864452a94dbb2bded9aab6 Mon Sep 17 00:00:00 2001 From: Rasmus Andersson Date: Sun, 30 Sep 2018 12:34:27 -0700 Subject: web: VF: slant axis instead of italic axis --- docs/lab/index.html | 51 +++++++++--------- docs/lab/lab.css | 8 +-- docs/lab/var.html | 151 ++++++++++++++++++++++++++++++---------------------- 3 files changed, 114 insertions(+), 96 deletions(-) (limited to 'docs/lab') diff --git a/docs/lab/index.html b/docs/lab/index.html index 7d0a37198..2f5862ebf 100644 --- a/docs/lab/index.html +++ b/docs/lab/index.html @@ -1037,6 +1037,7 @@ for (const ch of uniqueChars) { @font-face { font-family: 'Inter-UI-var-VERSION'; font-weight: 400 900; + font-style: oblique 0deg 10deg; src: url('fonts/var/Inter-UI.var.woff2') format("woff2-variations"); } @@ -1134,9 +1135,11 @@ for (const ch of uniqueChars) { } @font-face { + /* Note: Not hinted */ font-family: 'Inter-UI-var-hinted-VERSION'; font-weight: 400 900; - src: url('fonts/var-hinted/Inter-UI.var.woff2') format("woff2-variations"); + font-style: oblique 0deg 10deg; + src: url('fonts/var/Inter-UI.var.woff2') format("woff2-variations"); } /* ----------------------------------------------------------------------- */ @@ -1222,9 +1225,9 @@ document.head.appendChild(fontCSS) @@ -1781,9 +1784,9 @@ function main() { }) let usingVarFont = false - var varWeightRange, varItalicRange + var varWeightRange, varSlantRange var varWeightSettingValueImpl = false - var varItalicSettingValueImpl = false + var varSlantSettingValueImpl = false let currentBodyWeightClass = null vars.bind('weight', (e, v) => { @@ -1796,32 +1799,32 @@ function main() { var italicVar = vars.bind('italic', (e, on) => { document.body.classList[on ? 'add' : 'remove']('italic') - if (usingVarFont && !varItalicSettingValueImpl) { - if (varItalicRange) { - varItalicRange.setValue(on ? 100 : 0) + if (usingVarFont && !varSlantSettingValueImpl) { + if (varSlantRange) { + varSlantRange.setValue(on ? 100 : 0) } updateVarFont() } }) let varState = { - weight: 400, - italic: 0, + weight: 400, // 400-900 + slant: 0, // 0-10 } function updateVarFont() { if (usingVarFont) { - varItalicSettingValueImpl = true - if (varState.italic <= 0.1) { - varState.italic = 0 + varSlantSettingValueImpl = true + if (varState.slant <= 0.1) { + varState.slant = 0 italicVar.setValue(false) } else { italicVar.setValue(true) } - varItalicSettingValueImpl = false + varSlantSettingValueImpl = false setCSSProp( "font-variation-settings", - `"wght" ${varState.weight}, "ital" ${varState.italic}` + `"wght" ${varState.weight}, "slnt" ${varState.slant}` ) } else { setCSSProp("font-variation-settings", null) @@ -1851,9 +1854,9 @@ function main() { } }) - let varItalicNum = vars.bind('varItalicNum', (e, v) => { - if (varItalicRange && !varItalicSettingValueImpl) { - varItalicRange.setValue(v) + let varSlantNum = vars.bind('varSlantNum', (e, v) => { + if (varSlantRange && !varSlantSettingValueImpl) { + varSlantRange.setValue(v) } }) @@ -1870,11 +1873,11 @@ function main() { return e.valueAsNumber !== undefined ? e.valueAsNumber : e.value }) - varItalicRange = vars.bind('varItalic', (e, v) => { - varState.italic = v - varItalicSettingValueImpl = true - varItalicNum.setValue(v) - varItalicSettingValueImpl = false + varSlantRange = vars.bind('varSlant', (e, v) => { + varState.slant = v + varSlantSettingValueImpl = true + varSlantNum.setValue(v) + varSlantSettingValueImpl = false updateVarFont() }, (e, prevValue, ev) => { if (prevValue === undefined) { diff --git a/docs/lab/lab.css b/docs/lab/lab.css index 719bc949c..7c799feec 100644 --- a/docs/lab/lab.css +++ b/docs/lab/lab.css @@ -154,16 +154,10 @@ samples, boxes { samples { display: flex; padding: 24px 0; - width:100%; + width: 100%; } body.italic samples { font-style: italic; -} -body.varfont.italic samples { - /* [BUG] (Safari 11.1) font-style:italic and ital axis is not - mutually exclusive, meaning we have to set either or. */ - font-style: normal; - font-variation-settings: 'ital' 100; } sample { margin: 0; diff --git a/docs/lab/var.html b/docs/lab/var.html index 0ed45c444..6f95b9a2c 100644 --- a/docs/lab/var.html +++ b/docs/lab/var.html @@ -8,6 +8,7 @@ @font-face { font-family: 'Inter UI var'; font-weight: 400 900; + font-style: oblique 0deg 10deg; src: url('fonts/var/Inter-UI.var.woff2') format("woff2-variations"), url('../font-files/Inter-UI.var.woff2') format("woff2-variations"); } @@ -24,9 +25,9 @@ body { .sample { padding: 40px 40px 40px 35px; - font-size: 96px; + font-size: var(--size); letter-spacing: -0.03em; - /*font-variation-settings: 'wght' 400, 'ital' 0;*/ + font-variation-settings: 'wght' var(--weight), 'slnt' var(--slant); } @supports (font-variation-settings: normal) { @@ -61,59 +62,63 @@ label {
- - + + +
-Inter UI 2.6 coming soon
-Refined glyphs & kerning
-Variable weight axis
-Major overhaul 123ABC!
+Inter UI 3.0 is variable and flexible
+Variable weight axis
+Variable slant/oblique axis
+ABCDEFGHIJKLMNOPQRSTUVWXYZ
+abcdefghijklmnopqrstuvwxyz
+1234567890?!()[]{}&*^%$#@~<>