简体   繁体   中英

Android WebView safe font family?

No, like others, I don't want to use custom fonts. I am looking for list of WebView safe fonts that can be used without using CSS3's custom @font-face, which loads ttf/wof/eot font from web/local storage.

More refined question would be: What are the list font's that are included with Android Operating System which can be used inside WebView?

For example, Arial, Verdana, sans-serif, etc font can be used (not sure), so where exactly to look for to be 100% sure?

Thanks

Webview : It uses the WebKit rendering engine to display web pages

According to the source code, android.webkit.WebSettings contains the following fields:

private String          mStandardFontFamily = "sans-serif";
private String          mFixedFontFamily = "monospace";
private String          mSansSerifFontFamily = "sans-serif";
private String          mSerifFontFamily = "serif";
private String          mCursiveFontFamily = "cursive";
private String          mFantasyFontFamily = "fantasy";

Accordingly, these are the fonts.

There is probably more fonts buried somewhere in the WebKit. However, they do not appear to be accessible.


This complies with the default fonts of Linux:

  • Sans-serif fonts : Arial Black, Arial, Comic Sans MS, Trebuchet MS, and Verdana
  • Serif fonts : Georgia and Times New Roman
  • Monospace fonts : Andale Mono and Courier New
  • Fantasy fonts : Impact and Webdings

Bottom line, there is no comprehensive list of fonts for the Android WebKit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM