4

我正在使用 phonegap 构建 android 应用程序,但我遇到了一些问题。

<style type="text/css">
@font-face{
    font-family: customfont;
    src: url("fonts/THSarabunNew.ttf") format('truetype');

}
body {
    font-family: customfont;
    font-size:30px;
}
</style>

我尝试在index.html文件中使用此代码,但我无法在应用程序中使用我的自定义字体。

请告诉我在 android 应用程序的 phonegap 中使用自定义字体的方法。

谢谢

4

1 回答 1

5
<style type="text/css" media="screen">
        @font-face {
            font-family: centurySchoolbook;
            src: url(/fonts/century-schoolbook.ttf);
        }
       body {
           font-family: centurySchoolbook;
           font-size:30px;
       }
</style>

如果您的字体仍然无法使用,请确保您正确拼写其字体名称和文件名,您的应用程序缓存正常,您的移动操作系统没有乱用字体。首先检查css覆盖的东西。

于 2012-05-09T11:01:53.867 回答