Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger refresh on font load #54

Open
ellan11 opened this issue Apr 30, 2019 · 2 comments
Open

Trigger refresh on font load #54

ellan11 opened this issue Apr 30, 2019 · 2 comments

Comments

@ellan11
Copy link

ellan11 commented Apr 30, 2019

It appears that in current implementation refresh won’t be triggered when a font is loaded, and elements’ resize caused by the font load won’t be detected.
Is this assumption correct, and if so do you plan to add a support for it?

@HolgerJeromin
Copy link

FYI: I needed that event in another project. We need browser support for that, which is not polyfillable. Here with typescript annotations:

// register event for loading new font files
const fontFaceSet: EventTarget = (document as any).fonts;
if (fontFaceSet && fontFaceSet.addEventListener) {
	fontFaceSet.addEventListener('loadingdone', () => {
		// layout / glyphs could have been changed
	});
} else {
	// no fallback is possible without this API as a font files download can be triggered
	// at any time when a new glyph is rendered on screen
}

@ellan11
Copy link
Author

ellan11 commented May 1, 2019

Cool, thanks.
I'll use that approach to trigger refresh when fontFaceSet is supported, and will try to upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants