summaryrefslogtreecommitdiff
path: root/docs/samples/index.html
blob: 6d984bb32a734e2393a94a12fa65040b45e6a271 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
<!DOCTYPE HTML>
<html lang="en" prefix="og: http://ogp.me/ns#">
  <head>
    <meta charset="utf-8">
    <title>Inter UI font family</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta property="og:title" content="Inter UI font family">
    <meta property="twitter:title" content="Inter UI font family">
    <meta property="description" content="Inter UI is a new typeface optimized for computer user interfaces">
    <meta property="og:description" content="Inter UI is a new typeface optimized for computer user interfaces">
    <meta property="twitter:description" content="Inter UI is a new typeface optimized for computer user interfaces">
    <meta property="twitter:card" content="summary">
    <meta property="twitter:site" content="@rsms">
    <meta property="twitter:creator" content="@rsms">
    <meta property="og:image" content="https://rsms.me/inter/res/poster.png">
    <meta property="twitter:image" content="https://rsms.me/inter/res/poster.png">
    <meta property="fb:app_id" content="38027689216">
    <meta property="og:url" content="https://rsms.me/inter/">
    <meta property="og:site_name" content="rsms.me">
    <meta property="og:type" content="product">
    <meta property="og:locale" content="en_US" />
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" type="image/png" href="../favicon.png" />
    <link href="../inter-ui.css?v=2.5" rel="stylesheet">
    <link href="../index.css?v=5" rel="stylesheet">
    <style type="text/css">
body {
  padding-bottom: 0;
  background: white;
}

.row.footer h2 {
  margin:0;
  text-align:center;
}

/*.row.menu {
  background: white;
}*/

livesample {
  display: block;
  color: #111;
  outline: none;
  padding-left: 20px;
  border-left: 2px solid transparent;
  margin-left:-22px;
  margin-top: 1em;
  margin-bottom: 1.6em;
}
livesample:hover {
  /*color: rgb(3, 102, 214);*/
  border-left-color: rgb(3, 102, 214);
}
livesample:focus {
  border-left-color: #eee;
}
livesample > p {
  margin-top: 0;
}
livesample.s1 {
  padding-left: 16px;
  letter-spacing: -0.005em;
  font-size: 5em;
  font-weight: 600;
  line-height: 1.1;
  margin-top: 0;
  margin-bottom: 0.3em;
}
livesample.s2 {
  max-width: 400px;
  font-size: 1em;
}
livesample.s3 {
  font-size: 13px;
  line-height: 18px;
}
  livesample.s3 b, livesample.s3 strong {
    font-weight:500;
    color: black;
  }

livesample.col3 {
  -moz-column-width: 20em;
  -moz-columns:      20em;
  -webkit-columns:   20em;
  columns:           20em;

  -moz-column-gap:    2em;
  -webkit-column-gap: 2em;
  column-gap:         2em;
}
livesample.col2 {
  -moz-column-count: 2;
  -webkit-column-count: 2;
  column-count: 2;
}

.font-style-regular       { font-weight:400 !important; font-style:normal !important; }
.font-style-italic        { font-weight:400 !important; font-style:italic !important; }
.font-style-medium        { font-weight:500 !important; font-style:normal !important; }
.font-style-medium-italic { font-weight:500 !important; font-style:italic !important; }
.font-style-bold          { font-weight:700 !important; font-style:normal !important; }
.font-style-bold-italic   { font-weight:700 !important; font-style:italic !important; }
.font-style-black         { font-weight:900 !important; font-style:normal !important; }
.font-style-black-italic  { font-weight:900 !important; font-style:italic !important; }

div.live {
  margin-top:1em;
  margin-bottom:100px;
  padding-bottom:100px;
  border-bottom: 1px solid #ddd;
}
  div.controls {
    position: absolute;
    right: 0;
    top: 150px;
    width: 220px;
    padding: 10px 16px;
    /*background:#eee;*/
    opacity:0.3;
    border:1px solid #bbb;
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
    border-right:none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  div.controls:hover {
    opacity:1;
    background:#f5f5f5;
    border-color: transparent;
  }
  div.controls .control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    height:30px;
  }
  div.controls .control > * {
    /*max-width: 50%;*/
    flex: 1 1 auto;
    margin:0;
    margin-right: 16px;
    box-sizing: border-box;
  }
  div.controls .control > :last-child {
    margin-right: 0;
  }
  div.controls .control > select {
    min-width: 6em;
    align-items: center;
    justify-content: center;
  }
  div.controls .control > input,
  div.controls .control > select {
    width: 0;
    outline: none;
  }
  div.controls .control > input[type="number"],
  div.controls .control > input[type="text"] {
    background: none;
    border: none;
    padding: 4px 0;
    font-size: 13px;
    /*border-radius: 2px;*/
  }
  div.controls .control > input[type="number"] {
    max-width: 60px;
    text-align: right;
    -moz-font-feature-settings:    'calt' 1, 'zero' 1, 'tnum' 1;
    -ms-font-feature-settings:     'calt' 1, 'zero' 1, 'tnum' 1;
    -o-font-feature-settings:      'calt' 1, 'zero' 1, 'tnum' 1;
    -webkit-font-feature-settings: 'calt' 1, 'zero' 1, 'tnum' 1;
    font-feature-settings:         'calt' 1, 'zero' 1, 'tnum' 1;
  }
  div.controls .control > input[type="range"] {
    /*max-width: 80%;*/
    flex: 1 1 auto;
    display: block;
  }
  div.controls .control > img.icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    margin-right: 16px;
    opacity: 0.8;
  }

  /*div.controls .control > input.foo {
    background-color: hotpink;
    border:none;
    border-radius: 90px;
  }*/


/* narrow windows */
@media only screen and (max-width: 1200px) {
  div.live div.controls {
    width: 200px;
  }
}
@media only screen and (max-width: 1024px) {
  div.live div.controls {
    width: 100px;
  }
  div.controls .control > input[type="range"] {
    width: 0;
    flex: 0 1 0%;
    display: none;
  }
  div.controls .control > input[type="number"] {
    max-width: 100%;
    flex: 1 1 auto;
  }
}
@media only screen and (max-width: 740px) {
  livesample.s1 {
    font-size:4.5em;
  }
  div.live div.controls {
    display: none;
  }
}
@media only screen and (max-width: 565px) {
  livesample.s1 {
    font-size:4em;
  }
}
@media only screen and (max-width: 414px) {
  livesample.s1 {
    font-size:3.4em;
  }
}
    </style>
  </head>
  <body>

    <div class="row menu">
      <ul class="menu">
        <li class="home"><a href="../">Inter UI</a></li>
        <li><a class="download-link"
          href="https://github.com/rsms/inter/releases/latest/"
        >Download</a></li>
        <li><a href="/inter/samples/" class="active">Samples</a></li>
        <li><a href="lab/">Playground</a></li>
        <li><a href="https://github.com/rsms/inter/">Source</a></li>
      </ul>
    </div>

    <div class="row white"><div>
      <div class="live">

        <div class="controls">
          <div class="control">
            <img title="Style" class="icon" src="icons/style.svg">
            <select data-binding="style">
              <option value="regular" default>Regular</option>
              <option value="italic">Italic</option>
              <option value="medium" default>Medium</option>
              <option value="medium-italic">Medium Italic</option>
              <option value="bold" default>Bold</option>
              <option value="bold-italic">Bold Italic</option>
              <option value="black" default>Black</option>
              <option value="black-italic">Black Italic</option>
            </select>
          </div>
          <div class="control">
            <img title="Size" class="icon" src="icons/font-size.svg">
            <input type="range" min="8" max="100" step="1" data-binding="font-size">
            <input type="number" min="4" max="400" step="1" data-binding="font-size">
          </div>
          <div class="control">
            <img title="Letter spacing in EM" class="icon" src="icons/letter-spacing.svg">
            <input type="range" min="-0.05" max="0.06" step="0.001" data-binding="letter-spacing">
            <input type="number" min="-0.15" max="1" step="0.001" data-binding="letter-spacing">
          </div>
          <!-- <div class="control">
            <img class="icon" src="icons/font-size.svg">
            <input type="text" class="foo" data-binding="foo">
            <input type="text" class="foo" data-binding="foo">
          </div> -->
        </div>

        <livesample contenteditable class="s1">
          Fabulous typography encountering spring
        </livesample>

        <livesample contenteditable class="s2">
          The user interface (UI), in the industrial design field of human-computer
          interaction, is the space where interactions between humans and machines occur.
        </livesample>

        <livesample contenteditable class="s3 col3">
<p><b>Fire Island Beach</b> is a barrier of sand, stretching for twenty miles
along the south coast of Long Island, and separating the Great South Bay
from the Atlantic ocean.
</p><p>
To reach it, you must make a sail of from three to seven miles, and once
upon it, you find it a wild, desolate, solitary spot, wind-searched and
surf-pounded.
</p><p>
Its inner shore is covered with a growth of tide-wet sedge, with here
and there a spot where dry meadow comes down to make a landing-place.
</p><p>
The outline of this inner shore is most irregular, curving and bending
in and out and back upon itself, making coves and points and creeks and
channels, and often pushing out in flats with not water enough on them
at low tide to wet your ankles.
</p><p>
A third of the distance across the Beach, the meadow ends and sand
begins. This slopes gradually up for another third of the distance, to
the foot of the sand hills, which seem tumbled into their places by some
mighty power, sometimes three tiers of them deep, sometimes two, and
sometimes only one.
</p><p>
These sand hills are the most striking features of the Beach. The
biggest of them are not more than sixty feet high, yet so hard a feat is
it to climb to the top, and so extended is the view below you—on one
side the wide Bay, on the other, the ocean stretching its restless
surface to the horizon—that you feel yourself upon an elevation tenfold
as high.
</p><p>
Through these hills the wind makes a great galloping, whirling out deep
bowl-shape hollows among them, and piling the shifting sand upon their
summits. Now and then you will notice a hill with its shoulder knocked
off by the wind, and a ton of sand gone no one can tell where. In every
storm their contour changes, and yet their general formation is so
similar at all times that the change is seldom thought of. A coarse
spear-like grass finds a sparse growth upon them, and does what it can
to hold the sand in place; but it has a hard time of it, as its blades
buried to their tips or its naked roots often testify.
</p><p>
But there is one part of this Beach that is ever much the same. It is a
broad, shelving strip of sand between the hills and the sea, where the
tide rises and falls, pounding and grinding, year in and year out—the
play-ground and the battle-ground of the surf.
</p><p>
On a summer’s day, I have seen this surf so low and quiet that one could
launch a sharpie upon it, single-handed, and come ashore again without
shipping a quart of water. At other times it is a terror to look at—a
steady break of waves upon the outer bar, with row after row coming in,
rearing and plunging as they strike the shore. In such a sea there is no
launching yawl or surf-boat, and no coming ashore.
</p><p>
When the tide is on the right moon and the wind has blown a gale from
the southeast, the strand is entirely submerged, and people upon the
main shore three miles away can see the surf breaking over the Beach
hills.
</p><p>
Such a riot of sea and wind strews the whole extent of beach with
whatever has been lost or thrown overboard, or torn out of sunken ships.
Many a man has made a good week’s work in a single day by what he has
found while walking along the Beach when the surf was down.
</p><p>
“The Captain” knew all this and had patrolled that Beach scores of
times.
</p><p>
Ten years had passed since the first time which laid the habit of
wandering along the surf-shore apparently in search of whatever the sea
had cast up. Sometimes a spar, sometimes sheets of copper torn from a
wreck and carried by a high surf far along the strand, sometimes a
vessel’s gilded name, at other times only scattered drift-wood were the
rewards of these lonely walks.
</p>
        </livesample>
      </div>

      <p class="sample-images">
        <img src="img/01.png" srcset="img/01@2x.png 2x" width="888">
        <img src="img/02.png" srcset="img/02@2x.png 2x" width="888">
        <!-- <img src="img/02.svg" width="888"> -->
        <img src="img/03.png" srcset="img/03@2x.png 2x" width="888">
        <img src="img/04.png" srcset="img/04@2x.png 2x" width="888">
        <img src="img/05.png" srcset="img/05@2x.png 2x" width="888">
        <img src="img/dark-phone.jpg" srcset="img/dark-phone@2x.jpg 2x" width="888">
        <img src="img/06.png" srcset="img/06@2x.png 2x" width="888">
        <img src="img/07.png" srcset="img/07@2x.png 2x" width="888">
        <img src="img/08.png" srcset="img/08@2x.png 2x" width="888">
        <img src="img/09.png" srcset="img/09@2x.png 2x" width="888">
        <img src="img/10.png" srcset="img/10@2x.png 2x" width="888">
        <img src="img/11.png" srcset="img/11@2x.png 2x" width="888">
        <img src="img/12.png" srcset="img/12@2x.png 2x" width="888">
        <img src="img/13.png" srcset="img/13@2x.png 2x" width="888">
        <img src="img/14.png" srcset="img/14@2x.png 2x" width="888">
        <img src="img/15.png" srcset="img/15@2x.png 2x" width="888">
      </p>
      <p style="text-align:center">
        <a href="https://www.figma.com/file/WmU5NWr52bnUcqv5os0V4sWi/" class="plain">Open these samples in Figma</a>
      </p>
    </div></div>

    <script src="../index.js?v=2"></script>
    <script src="bindings.js"></script>
    <script type="text/javascript">(function(){



// InterUIDynamicTracking takes the font size in points or pixels and returns
// the compensating tracking in EM.
//
function InterUIDynamicTracking(fontSize, weightClass) {
  // if (!weightClass) { -- currently unused
  //   weightClass = 400
  // }
  //
  // y = -0.01021241 + 0.3720623 * e ^ (-0.2808687 * x)
  // [6-35]  0.05877 .. -0.0101309  (13==0; stops growing around 30-35)
  // See https://gist.github.com/rsms/8efdbca5f8145a584ed08a7c3d6e5788
  //
  return -0.01021241 + 0.3720623 * Math.pow(Math.E, (-0.2808687 * fontSize))

  // y = 0.025 - (ln(x) * 0.01)
  // return 0.025 - Math.log(fontSize) * 0.01
}


function InterUIDynamicLeading(fontSize, weightClass) {
  var lineHeight = Math.round(fontSize * 1.4)
  //
  // TODO
  //
  // console.log(
  //   'lineHeight:', lineHeight,
  //   `(${Math.round(fontSize * 1.45)})`,
  // )

  return lineHeight
}


var bindings = new Bindings()

var s2 = $('livesample.s2')

function updateWidth() {
  var fontSize = bindings.value('font-size', 0)
  var letterSpacing = bindings.value('letter-spacing', 0)
  var w = fontSize * (letterSpacing + 1) * 25
  s2.style.maxWidth = Math.round(w) + 'px'
}

bindings.configure('letter-spacing', 0, 'float', function (letterSpacing) {
  s2.style.letterSpacing = letterSpacing + 'em'
  updateWidth()
})

bindings.configure('font-size', 18, 'int', function(fontSize, prevval) {
  s2.style.fontSize = fontSize + 'px'
  updateWidth()

  var letterSpacing = InterUIDynamicTracking(fontSize, 400)
  letterSpacing = parseFloat(letterSpacing.toFixed(3)) // lower precision

  var lineHeight = InterUIDynamicLeading(fontSize, 400)
  s2.style.lineHeight = lineHeight + 'px'

  bindings.setValue('letter-spacing', letterSpacing)
})

bindings.configure('style', null, null, function (style) {
  var cl = s2.classList
  cl.remove('font-style-regular')
  cl.remove('font-style-italic')
  cl.remove('font-style-medium')
  cl.remove('font-style-medium-italic')
  cl.remove('font-style-bold')
  cl.remove('font-style-bold-italic')
  cl.remove('font-style-black')
  cl.remove('font-style-black-italic')
  cl.add('font-style-' + style)
})


bindings.bindAllInputs('div.live .control input')
bindings.bindAllInputs('div.live .control select')



    })();</script>
  </body>
</html>