Hello experts,
In my PCF control, I need to include a custom font (sap-icons.ttf) to display icon.
Is there any way to achieve that?
Thanks,
Kim Anh
If your font is web-hosted, you can import it in your CSS. Try following this short guide, which uses font-awesome.
If your font is local to your machine you will need to upload it somewhere and do the same. I haven't tried this approach, but I found this article from 2016 that describes uploading the font file as a .CSS web resource to be used in an HTML page. I imagine you could do the same to host the font file for your PCF control.
Hi @kalluu91 ,
The manifest doesn't support any ttf files. I needed that too, and the only workaround I could come up, was to try to declare it as image. So you can use in the manifest (eventually rename your ttf to a png to avoid checks here, or just remove the extension)
<resources>
<img path="your_path_to_ttf.png" />
</resources>
and in the end try to load it using context.resources.getResource(..)
In some cases, there could work if you have the icons declared inside the css, using the icon url with a relative path ( like src: url(./your_ttf) ) . That would save you the loading the resource by yourself. But it works only sometimes, it depends what kind of app you are using.
But all these are kind of unsupported. Would be great if you can find another way to get the icons.
Hope this helps!
WarrenBelz
109
Most Valuable Professional
Michael E. Gernaey
82
Super User 2025 Season 1
mmbr1606
71
Super User 2025 Season 1