gpt4 book ai didi

android - 供 webview 使用的自定义字体

转载 作者:太空宇宙 更新时间:2023-11-04 13:40:09 27 4
gpt4 key购买 nike

大家好我有一个应用程序可以打开一个包含文本和图像组合的文章的 WebView 。如您所知,文章有不同的字体,我想知道是否有办法让 Web View 呈现几种 Helvetica 字体,就像在安装了这些字体的计算机上一样;以某种方式将它们添加到我的元素中?提前致谢。

我正在使用的一些示例 html

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE>fin SUB_ The Lego Movie - Trent Erickson.docx</TITLE>
<META NAME="GENERATOR" CONTENT="LibreOffice 4.1.5.3 (Linux)">
<META NAME="CREATED" CONTENT="0;0">
<META NAME="CHANGED" CONTENT="20140330;153648463119746">
<STYLE TYPE="text/css">
<!--
@page { margin: 1in }
P { margin-bottom: 0.08in }
A:link { so-language: zxx }
-->
</STYLE>
<link rel="stylesheet" type="text/css" href="mystyle.css">

</HEAD>
<BODY LANG="en-US" BGCOLOR="#ffffff" DIR="LTR">
<P STYLE="margin-bottom: 0in; page-break-inside: auto; widows: 0; orphans: 0; page-break-after: auto">
<FONT COLOR="#ff3333"><FONT FACE="Helvetica LT Std Cond"><FONT SIZE=2>Arts
&amp; Culture</FONT></FONT></FONT></P>
<P STYLE="margin-bottom: 0in; widows: 0; orphans: 0">“<FONT FACE="HelveticaNeueLT Std Thin"><FONT SIZE=4 STYLE="font-size: 16pt">The
Lego Movie” Lego Sets: Lego Misunderstood Their Own Movie</FONT></FONT>
<img src="lego.jpg">
</P>
<P ALIGN=RIGHT STYLE="margin-bottom: 0in; page-break-inside: auto; widows: 0; orphans: 0; page-break-after: auto">
<FONT FACE="Helvetica LT Std Cond">By:
</FONT><FONT FACE="Helvetica LT Std Cond">Trent Erickson
</FONT><FONT FACE="Helvetica LT Std Cond">Issue 3</FONT></P>

<P ALIGN=RIGHT STYLE="margin-bottom: 0in; widows: 0; orphans: 0">
</P>
<P STYLE="text-indent: 0.5in; margin-bottom: 0in; page-break-inside: auto; widows: 0; orphans: 0; page-break-after: auto">
<FONT FACE="HelveticaNeueLT Std">With over 4 billion dollars of
revenue, Lego is one of the most successful names in the toy
business, and rightly so: Lego is fantastic. It’s gender neutral,
it’s for kids, and it’s for adults. You can make a plane, a
train, or an automobile. Lego can be whatever you want it to be, but
it can also be constructed to perfectly match the instructions on the
cover of the set. </FONT>
</P>

我的样式表

 html {
background-color: #e6e9e9;
background-image: linear-gradient(270deg,rgb(230,233,233) 0%,rgb(216,221,221) 100%);
background-image: -o-linear-gradient(270deg,rgb(230,233,233) 0%,rgb(216,221,221) 100%);
background-image: -moz-linear-gradient(270deg,rgb(230,233,233) 0%,rgb(216,221,221) 100%);
background-image: -webkit-linear-gradient(270deg,rgb(230,233,233) 0%,rgb(216,221,221) 100%);
background-image: -ms-linear-gradient(270deg,rgb(230,233,233) 0%,rgb(216,221,221) 100%);
}

body {
margin: 0 auto;
padding: 2em 2em 2em;
max-width: 800px;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
font-size: 16px;
line-height: 1.5em;
color: #545454;
background-color: #ffffff;
-webkit-box-shadow: 0 0 2px rgba(0, 0, 0, 0.06);
-moz-box-shadow: 0 0 2px rgba(0, 0, 0, 0.06);
box-shadow: 0 0 2px rgba(0, 0, 0, 0.06);
}


img {
background: transparent;

display: block;
margin: 1.3em auto;
max-width: 100%;
-webkit-animation: colorize 2s cubic-bezier(0, 0, .78, .36) 1;
}

@keyframes colorize {
0% {
-webkit-filter: grayscale(100%);
}
100% {
-webkit-filter: grayscale(0%);
}
}

@-webkit-keyframes colorize {
0% {
-webkit-filter: grayscale(100%);
}
100% {
-webkit-filter: grayscale(0%);
}
}

和我的 webview 的男女同校

public class Article extends Activity{
private WebView webview;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.articleview);

Bundle b = getIntent().getExtras();
String KEY_LINK = b.getString("b");
String url = getIntent().getStringExtra("key");

webview = (WebView) findViewById(R.id.webView);



webview.loadUrl(url);

webview.loadUrl(KEY_LINK);



}


}

最佳答案

你可以简单地buy the Helvetica Webfont用于您的元素。然后您只需包含提供给您的 css 链接,文本将在每个远程现代浏览器中以 Helvetica 呈现。

关于android - 供 webview 使用的自定义字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22749069/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com