Can I integrate a TTF font (like Arial) into my Android app so that it can be accessed by a externally loaded webpage's CSS?
For instance, imagine my website is and its CSS file contains the following:
@font-face {
font-family: "CustomArial";
src: url('Arial.ttf');
}
h1 {
font-family: 'CustomArial', serif;
}
I've experimented with different variations for setting the font-face URL source, but none seem to work:
/mnt/sdcard/Arial.ttf
file://mnt/sdcard/Arial.ttf
I am aware that this approach works if the Arial.ttf file is in the same directory as the CSS file on the server. However, I want to use the Arial.ttf file located in my app's /assets folder or somewhere else on the SDCard. The reason being that the Arial.ttf file is 775kb, and users would need to download it before the page can be displayed.
Is there a way to achieve this? I understand that I could do this if the HTML loaded into the WebView was local and I used WebView.loadData(), but I specifically need to utilize WebView.loadUrl().
Any insights or assistance would be greatly appreciated!