It’s pretty easy to embed font to windows phone application, but I cannot find way to use my fonts in WebBrowser control, that is showing static html file. Is there any way to do it?
I’m using code below to show my html file:
Uri uri = new Uri(AppResources.red_termsOfUse_URI, UriKind.Relative);
Stream stream = Application.GetResourceStream(uri).Stream;
using (StreamReader reader = new StreamReader(stream, new System.Text.UnicodeEncoding()))
{
string htmlDocument = reader.ReadToEnd();
this.webBrowser.NavigateToString(htmlDocument);
}
The webBrowser Control will display the page with the font defined in the css (or style element) of the page. (It will not use the Embedded font)
You can use Javascript to set the Font at runtime OR you can define the font you want inside the HTML file itself (if the file is under your control).
To learn more about Injecting JavaScript in WP7 WebBrowser control read this.
Edit:
If you have access to
cssthen you can also try this to use embedded font (same as we do in any HTML page).See this to learn How to Display Local Html page along with Asset.
I hope that makes sense, I can’t test it right now.