Hello everyone, I would like to know if it is possible to add a custom font to my WebApp project in ABB AppStudio. The font is already installed on my local PC, but I need to know the proper way to import or reference it as an asset so it renders correctly on the FlexPendant; any guidance would be greatly appreciated!
Yes, you can directly add the following JavaScript code to the onMounted event of a component like the Page component:
if (!document.getElementById("custom-font-style")) {
const style = document.createElement("style");
style.id = "custom-font-style";
style.textContent = `
@font-face {
font-family: "MyCustomFont";
src: url("./fonts/MyFont.woff2") format("woff2");
font-weight: normal;
font-style: normal;
}
`;
document.head.appendChild(style);
}
However, please note that if the font is only installed on your computer, it may not be available on the FlexPendant.
You need to locate the actual font file (such as .woff2, .woff, or .ttf) and include it in the deployed WebApp folder. Then, reference that file using the correct relative path in your CSS.
For reference, you can look at how AppStudio loads its own icon fonts in index.html, as shown in the screenshot. It references an iconfont.css file, which loads the corresponding font files from the WebApp directory.
This is just an example of how font resources can be organized and referenced. You will need to adjust the file paths according to your own WebApp structure.
Hey Yitong!
Thank you very much for the help.
If you don’t mind, could you explain a bit more about this? I don’t think I fully understand it yet.
Thanks in advance!
Sure. The main idea is that installing a font on your PC does not automatically make it available in your WebApp or on the FlexPendant.
To use a custom font, you need two things:
- The actual font file (for example,
MyFont.woff2). - A CSS definition that tells the WebApp where to find that file and how to use it.
For example, after exporting your WebApp, you could organize the files like this:
WebApp/
├── index.html
├── fonts/
│ └── MyFont.woff2
└── ...
Then, the JavaScript code I shared earlier can be added to the onMounted event of your Page component in AppStudio.
The important part is:
@font-face {
font-family: "MyCustomFont";
src: url("./fonts/MyFont.woff2") format("woff2");
}
This tells the WebApp to load the font file from the fonts folder.
Once the font is loaded, you can apply it to your text using:
font-family: "MyCustomFont";
One important thing to remember is that the font file must also be included when deploying the WebApp to the FlexPendant(Maybe you need copy the deployed file to controller manually) . Otherwise, the font may work on your PC but not on the FlexPendant.
The iconfont.css example in my previous screenshot was just to show how AppStudio itself loads font files using a similar approach.
I hope this makes the idea clearer. 😀

