Once created driven by our AdServer, the texts will change based on established parameters (Geolocation, weather, date/time, cookies, retargeting…).
To dynamize texts you have 4 methods at your service :
To dynamize a text:
The setText function allows you to insert a text in an element.
ADventori.Display.setText(element, data, fontName);
This function needs two mandatory parameters:
There is one optional parameter:
The adaptText function allows you to adapt the text size to its container.
ADventori.Display.adaptText(element, minFontSize, objectWidth, objectHeight, fontName);
This function needs four mandatory parameters:
There is one optional parameter:
The setAndAdaptText function allows you to combine the two previous functions.
ADventori.Display.setAndAdaptText(element, data, minFontSize, objectWidth, objectHeight, fontName);
This function needs five mandatory parameters:
There is one optional parameter:
The verticalAlign function allows you to vertically align the text in its container.
ADventori.Display.verticalAlign(element, objectHeight, objectYPosition);
This function needs three mandatory parameters:
Adobe Animate cc allows you to manage web fonts with Adobe typeKit and Google Fonts. Nevertheless for a digital advertising campaign, we do not recommend to call fonts online (security problems, scalability. …).
We also recommend that you don’t choose too heavy fonts (recommended weight <50 ko) and favor loading your fonts locally.
Export your HTML Template, edit it and add the following code just before the closing tag </head>
:
<style>
@font-face {
font-family: 'fontName';
src: url('fontPath/fontName.woff2');
font-weight: normal;
}
</style>
<link rel="preload" as="font" href="fontPath/fontName.woff2" type="font/woff2" crossorigin="anonymous">
After completing this step, reload the HTML Template (Publish Settings-> Advanced-> Import New).
Once the fonts are loaded, you can apply the custom font to the textField (s):
ADventori.Display.setFont(element, fontName);
You can also add the name of your font to the methods of adding text:
ADventori.Display.setText(element, data, fontName);
ADventori.Display.adaptText(element, minFontSize, objectWidth, objectHeight, fontName);
ADventori.Display.setAndAdaptText(element, data, minFontSize, objectWidth, objectHeight, fontName);
<style>
@font-face {
font-family: 'FrancoisOne-Regular';
src: url('fonts/FrancoisOne-Regular.woff2');
font-weight: normal;
}
</style>
<link rel="preload" as="font" href="fonts/FrancoisOne-Regular.woff2" type="font/woff2" crossorigin="anonymous">
ADventori.Display.setText(this.textField1,ADventori.data.wording, 'FrancoisOne-Regular');