Reputation: 971
Please how do i add a custom font to my WebBrowser in Codename one. This is what I tried using but didn't work.
@font-face {
font-family: 'feast';
src: url('/feasfbrg.ttf');
}
body {font-family: 'feast';}
Upvotes: 1
Views: 127
Reputation: 4716
Try to narrow it down:
Instead of bundling the font in the package, just host it at a URL, then try referencing that URL directly. And get that working. e.g.
src: url(http://example.com/path/to/fesfbrg.ttf)
Once you have that working, then you can start focus on getting the URL correct for a locally bundled font.
Can you share the code snippet where you load the page into the WebBrowser? That might give some clues.
Upvotes: 0
Reputation: 52725
Either point the URL at a web address to download the font or package the HTML hierarchy as explained in this blog post and use a relative not absolute path:
https://www.codenameone.com/blog/html-hierarchy-release-plan-teavm.html
Upvotes: 1