Android Question How change webview font?

Discussion in 'Android Questions' started by omidaghakhani1368, Feb 6, 2015.

  1. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    Hi.
    I try to change webview font with font-face but i cannot
    Is there any way to change font?
    It's very very important for me
     
    amir lotfi likes this.
  2. sorex

    sorex Expert Licensed User

    gimme a minute and I'll show you how
     
  3. sorex

    sorex Expert Licensed User

    here you go

    Code:
    WebView1.LoadHtml("<html><head><style>.f1{font-family:""Arial"";} .f2{font-family:""Times New Roman"";}</style></head><body><p class=f1>abcdef</p><p class=f2>abcdef</p></body></html>")
     

    Attached Files:

    amir lotfi and thedesolatesoul like this.
  4. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    I want to use external font
     
  5. sorex

    sorex Expert Licensed User

    if webview supports it then you can define your external font via CSS aswell.
     
    amir lotfi and thedesolatesoul like this.
  6. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    Which version of webview support external font?
     
    amir lotfi likes this.
  7. NJDude

    NJDude Expert Licensed User

    You only need to reference the external font, like this for example:
    Code:
    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
    You have to include that line in the HEAD of your HTML.
     
    amir lotfi and thedesolatesoul like this.
  8. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    Thank you.i test it
     
    amir lotfi likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice