Change font address



  • hi how are you?
    i have qwebview widget on my application ,it doesn't show my text correctly
    now i want to make it to use a specefic font that i get him address
    or how can i add this font to my font list of application to use it
    how can i do that?



  • You have two options:

    1. Use QWebSettings and specify the font in C# ++

    Example:

    @QWebSettings* websettings = QWebSettings::globalSettings();
    websettings->setFontFamily(QWebSettings::StandardFont, font.family());@

    Don't forget to run that before instantiating the QWebView.

    1. Use HTML 5's web font feature + CSS. In the <head></head> section of your page put the following:

    @
    <link href='http://fonts.googleapis.com/css?family=Allerta' rel='stylesheet' type='text/css' />
    @

    Then you can use the font in your CSS. You can of course change the font to your own, as long as you have a URL for it. I included one of Google's fonts just as an example.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.