hasanghaforian
hasanghaforian

Reputation: 14022

load font family from Assests into WebView dinamically

I have some ttf files in assets directory of my application, for example AdobeArabic-Regular.ttf. Now I want to run this javascript code in WebView:

object.style.fontFamily = "AdobeArabic-Regular";

But I do not know how I can load that font dynamically? As font family will be changed dinamically, using this described way does not solve my problem.

Upvotes: 0

Views: 91

Answers (1)

Alireza Tizfahmfard
Alireza Tizfahmfard

Reputation: 583

You need to inject CSS into webview this link is helpful

And set the font in CSS

body {
  font-family: "Times New Roman", Times, serif;
}

Upvotes: 1

Related Questions