I'm getting the api response which contains html tags, I want to load those data into the webview with the custom font style. Can anyone please tell me how to load fonts from asset to the api response data.
For the desired output, I replaced the first string with:-
replace("<p>", "<p style='font-family:Caecilia-Roman; src: url(file:///android_assets/fonts/pmn/Caecilia-Roman.otf)'><style> p:nth-child(1)::first-letter { color: #000; font-size: 40px; } p a{color: #dc3535;}</style>");
Update
String uu = "<p class='my-fonts'><style> @font-face {\n" +
" font-family: 'feast';\n" +
" src: url('fonts/pmn/Caecilia-Roman.otf');\n" +
"}\n" +
"\n" +
".my-fonts {font-family: 'feast';}p:nth-child(1)::first-letter { color: #000; font-size: 40px; } p a{color: #dc3535;}</style>Fusion GPS, a firm paid by Hillary Clinton’s campaign, was paying the wife of a senior Department of Justice official as part of its efforts to gather opposition research on Trump, and the official then brought that research to the FBI — raising the question of to what extent the firm may have been attempting to pay for heightened access to the criminal justice system, and whether they would have hired her absent her spousal connection.</p> <p style='font-family: Caecilia-Roman; src: url(file:///android_assets/fonts/pmn/Caecilia-Roman.otf)'><style> p:nth-child(1)::first-letter { color: #000; font-size: 40px; } p a{color: #dc3535;}</style>A declassified memo said Bruce “Ohr’s wife was employed by Fusion GPS to assist in the cultivation of opposition research on Trump. Ohr later provided the FBI with all of his wife’s opposition research, paid for by the DNC and Clinton campaign via Fusion GPS. The Ohrs’ relationship with Steele and Fusion GPS was inexplicably concealed from the” court when it was used to obtain a surveillance warrant.</p> <p style='font-family: Caecilia-Roman; src: url(file:///android_assets/fonts/pmn/Caecilia-Roman.otf)'><style> p:nth-child(1)::first-letter { color: #000; font-size: 40px; } p a{color: #dc3535;}</style>Bruce Ohr was deputy associate attorney general until December. House investigators determined that he met personally with Glenn Simpson, Fusion GPS’ founder.</p> <p style='font-family: Caecilia-Roman; src: url(file:///android_assets/fonts/pmn/Caecilia-Roman.otf)'><style> p:nth-child(1)::first-letter { color: #000; font-size: 40px; } p a{color: #dc3535;}</style>The FBI has limited resources to deal with a firehouse of information, so people seeking the FBI’s attention could potentially benefit from greasing the wheels in order to get info to the front of the queue and to a high level.</p> <p style='font-family: Caecilia-Roman; src: url(file:///android_assets/fonts/pmn/Caecilia-Roman.otf)'><style> p:nth-child(1)::first-letter { color: #000; font-size: 40px; } p a{color: #dc3535;}</style>“The money sweetened the pot for the Ohrs, and it certainly made it easier for Fusion to get the dossier to be used before the court if they made that payment to Bruce Ohr’s wife,” former judge and Texas GOP Rep. Louie Gohmert told The Daily Caller News Foundation,</p> <p style='font-family: Caecilia-Roman; src: url(file:///android_assets/fonts/pmn/Caecilia-Roman.otf)'><style> p:nth-child(1)::first-letter { color: #000; font-size: 40px; } p a{color: #dc3535;}</style>“Fusion had to have known that because of the relationship between Bruce Ohr and his wife, they were bringing Fusion, the DOJ and the DNC together under one roof to work for the same goal, which was to stop Donald Trump from becoming president,” he said.</p> <p style='font-family: Caecilia-Roman; src: url(file:///android_assets/fonts/pmn/Caecilia-Roman.otf)'><style> p:nth-child(1)::first-letter { color: #000; font-size: 40px; } p a{color: #dc3535;}</style>Ohr’s wife, Nellie, is a Russia expert, but it is not known what her specific contribution to the dossier was.</p> <p style='font-family: Caecilia-Roman; src: url(file:///android_assets/fonts/pmn/Caecilia-Roman.otf)'><style> p:nth-child(1)::first-letter { color: #000; font-size: 40px; } p a{color: #dc3535;}</style>“The financial arrangement between Mrs. Ohr and Fusion GPS gives the appearance of government-for-hire,” said Tom Anderson, an ethics expert at the conservative-leaning watchdog group the National Legal and Policy Center. It “appears to be a sophisticated scheme to get access to the highest levels of our government … ensuring the use of government resources in an attempt to influence an election.”</p> <p style='font-family: Caecilia-Rom";
mWebView.loadDataWithBaseURL("file:///android_assets/",uu,"text/html", "UTF-8", null);
I have added the fonts in the asset folder.
String formatting has got, but custom font didn't loaded.
Here is my tried effort
Thank you.