font-picker-react
font-picker-react copied to clipboard
onLoad event
Is there a way to know when the new selected font has been loaded? In case of using a canvas for the rendering. Thanks!
Should FontFaceObserver be used?
This seems to work:
componentDidUpdate(prevProps, prevState) {
if (prevState.activeFontFamily !== this.state.activeFontFamily) {
const font = new FontFaceObserver(this.state.activeFontFamily);
font.load().then(() => {
console.log(`${this.state.activeFontFamily} has loaded`);
}, () => {
console.log(`${this.state.activeFontFamily} is not available`);
});
}
}
it's not working for me lol