使用CSS字体家庭选择的Droid字体不工作在Android [英] Using CSS font-family to select Droid fonts not working on Android
问题描述
我发现下面的HTML code不能在Android的工作(它将只使用默认的字体:德罗伊德桑在桌面上,它正在按照预期
。 < p风格=字体家庭:德罗伊德桑,无衬线;> V和威士忌对龙舌兰酒,preT修复< / P>
< p风格=字体家庭:德罗伊德桑单,等宽;> V和威士忌对龙舌兰酒,preT修复< / P>
< p风格=字体家庭:Droid的衬线,衬线;> V和威士忌对龙舌兰酒,preT修复< / P>
您可能没有一个@字体面声明在CSS中的其他字体。我想你只有一个用于德罗伊德桑。你需要为每个字体。例如,在你的CSS,你应该有:
@字体面{
字体家庭:DroidSans;
SRC:网址(字体/ DroidSans-webfont.eot?')格式('EOT'),
URL(字体/ DroidSans-webfont.woff')格式(WOFF),
URL(字体/ DroidSans-webfont.ttf')格式(TrueType字体),
URL(字体/ DroidSans-webfont.svg#webfontw7zqO19G')格式(SVG);
字体重量:正常;
字体风格:正常;
}
@字体面{
字体家庭:DroidSansMono;
SRC:网址(字体/ DroidSans单 - webfont.eot?')格式('EOT'),
URL(字体/ DroidSans单 - webfont.woff')格式(WOFF),
URL(字体/ DroidSans单 - webfont.ttf')格式(TrueType字体),
URL(字体/ DroidSans单 - webfont.svg#webfontSOhoM6aS')格式(SVG);
字体重量:正常;
字体风格:正常;
}
@字体面{
字体家庭:DroidSerif;
SRC:网址(字体/ DroidSerif-webfont.eot?')格式('EOT'),
URL(字体/ DroidSerif-webfont.woff')格式(WOFF),
URL(字体/ DroidSerif-webfont.ttf')格式(TrueType字体),
URL(字体/ DroidSerif-webfont.svg#webfontw7zqO19G')格式(SVG);
字体重量:正常;
字体风格:正常;
}
,然后在code,你的字体家庭应该是一样,你在上面的CSS声明(如字体家庭:德罗伊德桑'是不一样的字体家庭:DroidSans ')
< p风格=字体家庭:DroidSans,无衬线;> V和威士忌对龙舌兰酒,preT修复< / P>
< p风格=字体家庭:DroidSansMono,等宽;> V和威士忌对龙舌兰酒,preT修复< / P>
< p风格=字体家庭:DroidSerif,衬线;> V和威士忌对龙舌兰酒,preT修复< / P>
试试吧,看看你的身体情况如何。
I discovered that the following HTML code does not work on Android (it will only use the default font: Droid Sans. On desktop it is working as expected.
<p style='font-family: "Droid Sans",sans-serif;'>vând whisky și tequila, preț fix.</p>
<p style='font-family: "Droid Sans Mono",monospace;'>vând whisky și tequila, preț fix.</p>
<p style='font-family: "Droid Serif",serif;'>vând whisky și tequila, preț fix.</p>
You probably don't have an @font-face declaration for the other typefaces in your css. I imagine you only have one for Droid Sans. You need one for each typeface. For example, in your css you should have:
@font-face {
font-family: 'DroidSans';
src: url('font/DroidSans-webfont.eot?') format('eot'),
url('font/DroidSans-webfont.woff') format('woff'),
url('font/DroidSans-webfont.ttf') format('truetype'),
url('font/DroidSans-webfont.svg#webfontw7zqO19G') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'DroidSansMono';
src: url('font/DroidSans-Mono-webfont.eot?') format('eot'),
url('font/DroidSans-Mono-webfont.woff') format('woff'),
url('font/DroidSans-Mono-webfont.ttf') format('truetype'),
url('font/DroidSans-Mono-webfont.svg#webfontSOhoM6aS') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'DroidSerif';
src: url('font/DroidSerif-webfont.eot?') format('eot'),
url('font/DroidSerif-webfont.woff') format('woff'),
url('font/DroidSerif-webfont.ttf') format('truetype'),
url('font/DroidSerif-webfont.svg#webfontw7zqO19G') format('svg');
font-weight: normal;
font-style: normal;
}
And then in your code, your font-family should be the same as those you declared in the css above (i.e. font-family: 'Droid Sans'; is not the same as font-family: 'DroidSans')
<p style='font-family: "DroidSans",sans-serif;'>vând whisky și tequila, preț fix.</p>
<p style='font-family: "DroidSansMono",monospace;'>vând whisky și tequila, preț fix.</p>
<p style='font-family: "DroidSerif",serif;'>vând whisky și tequila, preț fix.</p>
Try it and see how you get on.
这篇关于使用CSS字体家庭选择的Droid字体不工作在Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!