如何在android手机中嵌入字体样式

How to embed font style in android mobile?

本文关键字:字体 样式 手机 android      更新时间:2023-09-26

我开发了phonegap应用程序。在我的应用程序有两种语言英语和高棉语。但我的设备显示不出高棉语。如何在代码中嵌入字体?

把你的CSS放到一个文件中,例如:

@font-face {
    font-family: "customfont";
    src: url("./fonts/arial.ttf") format("opentype");   
        /* Make sure you defined the correct path, which is related to
            the location of your file `example.css` */ 
    }
    body {
        font-family: "customfont";
        font-size:30px;
    }

-在HTML中引用你的CSS文件example.css:

<link rel="stylesheet" href="./css/example.css" />

确保遵循正确的目录结构

例如,假设您有以下目录结构:

www

  • example.html
css

  • example.css

  • arial.ttf