Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
523 views
in Technique[技术] by (71.8m points)

html - Font-Family Not getting Visible Correctly In JavaFX Webview

I am trying to open a Simple webpage in JavaFX Webview. I have used my organization's custom font file. When I am opening the webpage in browser manually it's working fine and looking like this. View In Browser

but when I am running my JavaFX application and displaying the webpage in webview, it's getting displayed like this: enter image description here

It's clearly visible that Font-family is not correct when displaying the webpage in WebView. User Agent used by WebEngine is:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/602.1 (KHTML, like Gecko) JavaFX/8.0 Safari/602.1

Html Page:

<!DOCTYPE html>
<html>
<head>
<style>
@font-face {
       font-family: Sample;
        src: url(fonts/Sample.woff2);
    }


h1 {
    width: 100%;
    height: 76px;
    font-size: 72px;
    font-family:Sample;
    font-weight: bold;
    font-stretch: normal;
    font-style: normal;
    line-height: 1.00;
    letter-spacing: normal;
    text-align: center;
    color: #333333;
}

</style>
</head>
<body>

<h1>Checkout unavailable</h1>

</body>

</html>

Can anybody please suggest what can resolve this issue.

question from:https://stackoverflow.com/questions/65842814/font-family-not-getting-visible-correctly-in-javafx-webview

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...