[英]CSS in Tizen WebView (EFL WebKit) wouldn't honor font-family
我正在使用基於Tizen 2.4和3.0 SDK中的EFL WebKit的WebView渲染一些HTML。
<div className="hexArea" id="hexArea1">
Content
</div>
和相應的CSS:
.hexArea {
position: relative;
height: 95%;
padding: 3px;
white-space: pre;
text-overflow: clip;
overflow: auto;
border: 1px solid #0F0F0F;
color: #0F0F0F;
font-family: "Lucida Console", "Courier New", Courier, monospace;
}
雖然這在桌面,Android WebView,iOS WebView等多種平台上都可以很好地工作,但在Tizen App上卻沒有顯示固定字體。 我似乎無法為頁面上的任何內容設置字體。
我在div
上嘗試過style="font-family: 'monospace'"
,我試圖使CSS成為font-family: monospace
,但是Tizen WebView上的html似乎並不尊重font-family
。
我正在嘗試以十六進制和十進制顯示字節,並且使用常規字體看起來很恐怖。 任何想法如何解決?
編輯:我什至嘗試<pre>
標簽,但以正常字體顯示。
當前,默認情況下Tizen SDK中似乎未提供固定字體資源。 但是可以使用CSS @ font-face或Google Font API在應用程序端顯示固定字體。
將CSS @ font-face與字體資源一起使用。
https://developer.mozilla.org/zh-CN/docs/Web/CSS/@font-face https://www.w3schools.com/cssref/css3_pr_font-face_rule.asp
我認為您可以在應用程序中添加固定字體資源,並使用CSS @ font-face加載和顯示字體。
使用Google字體API。
<html> <head> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto Mono"> <style> .hexArea { font-family: "Roboto Mono"; } </style> </head> <body> <div>normal font:1234567890</div> <div class="hexArea">fixed-font:1234567890</div> </body> </html>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.