HOW TO
When developing custom themes for ArcGIS Experience Builder, users may wish to specify custom fonts that do not ship with ArcGIS Experience Builder or are not installed in the operating system. A custom font can either be sourced from a file (woff2, ttf, etc.), or from a URL. To enable this functionality, a few steps must be taken to bring the font into ArcGIS Experience Builder so it can then be applied to the text in various widgets as desired.
<your_install_path>\ArcGISExperienceBuilder\client\your-extensions\themes
@font-face { font-family: 'Tangerine-Regular'; src: url('./assets/fonts/Tangerine-Regular.ttf') format('truetype'); } @import url("https://fonts.googleapis.com/css?family=Tangerine");
Note:
There is a difference in the name of the font between the two methods above. the @import statement imports the font and sets the name to "Tangerine", while the @font-face statement will set the font name to "Tangerine-Regular". Make sure to use the correct font name in the next steps depending on which font import method you used.
TIP:
Open the entire demo-theme folder in Microsoft Visual Studio Code or Notepad++ to facilitate quickly moving between the files we'll be editing.
} } }, "typography": { "fontFamilyBase": "Tangerine-Regular", "fontSizeRoot": "100%", "fontSizeRoot": "0.875rem", "sizes": {
<your_install_path>\ArcGISExperienceBuilder\server\public\apps\1\resources\config\config.json
"widget_21": {
"uri": "widgets/common/text/",
"version": "1.15.0",
"config": {
"text": "",
"placeholder": "<p><span style=\"font-size: 24px; font-family: Tangerine-Regular; color: var(--dark-800);\">This text
is rendered using the custom font!</span></p>",
"style": {
"verticalAlign": "start",
"wrap": true
}
}
Note:
You may also need to reselect your custom theme in the themes list to get the font to be applied. If that doesn't work, try restarting the client with Ctrl+C then Y and then npm start.
Article ID: 000033861
Get help from ArcGIS experts
Download the Esri Support App