Published
Edited
Jul 17, 2019
1 fork
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
me = await new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => {
mutable aspect = img.width/img.height
resolve(img);
}
img.onerror = reject;
img.crossOrigin = "";
img.src = "https://avatars0.githubusercontent.com/u/679386";
})
Insert cell
mutable aspect = null
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
html`<style>.custom-font { font-family: '${font}' }</style>`
Insert cell
mutable font_loaded = false
Insert cell
{
var font = new FontFaceObserver(`${font}`, {
weight: 400
});
font.load().then(function () {
mutable font_loaded = true
}, function () {
console.log('Font is not available');
});
return 'font face observer set-up'
}
Insert cell
html`<link href="https://fonts.googleapis.com/css?family=${font.replace(' ','+')}" rel="stylesheet">`
Insert cell
FontFaceObserver = require('https://bundle.run/fontfaceobserver@2.1.0')
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more