Every single banner ad I’ve produced has used images of type, PNG or SVG, rather than live HTML type itself. I know, crazy! No one’s wanted to use a standard font in their designs—until now.
Using a Google font inside of Hype is easy peasy, no questions there. But since my first foray with inserting Roboto will be a run of about 800(!) banners, I’d prefer not to have any surprises halfway thru.
Playing around, I've noticed there's a split second lag before the text appears. Are there any other quirks I should know about?
Yeah, that sound like block … that option allows up to 3 seconds of blank space. You could hide the entire ad and display it using document.fonts.ready.then(function () { /*... all fonts loaded...*/ });although IE 11 doesn't support the API
Here is a snippet that hides the Hype document until fonts are loaded or if 3 seconds pass (fallback). To try it out, put it in your Head HTML in a script-tag:
function HypeDocumentLoad(hypeDocument, element, event) {
var fontTimout;
var fontReadyCallback = function(){
clearTimeout(fontTimout);
element.style.visibility = 'visible';
}
element.style.visibility = 'hidden';
document.fonts.ready.then(fontReadyCallback);
fontTimout = setTimeout(fontReadyCallback, 3000);
}
if("HYPE_eventListeners" in window === false) { window.HYPE_eventListeners = Array(); }
window.HYPE_eventListeners.push({"type":"HypeDocumentLoad", "callback":HypeDocumentLoad});
By default, Hype puts the Google css links prior to anything I can add to the head. Is the workaround to remove those Google links as Hype assets and instead manually put them in the head after this preconnect link? Actually, I just tried that and it doesn't work.
The order doesn't matter so much here, since as soon as the browser sees the preconnect instruction, it will do it -- this will happen before the css file is downloaded. (So you can just add preconnect to the head and you should see a small speedup)
My tip to using Google fonts, or maybe any custom fonts, is to include the following within the head tag, to ensure everything looks as consistent as possible across browsers.
Hello Daryl, did this campaign go well with your native Google Fonts on the HTML banners? I'm also looking into using Google Fonts for a Google campaign in Hype just wanted to make sure everything will come out fine and bug free...
Thanks!